Decompiled source of ValheimRoleplay v1.4.5
files/plugins/modelchanger.dll
Decompiled a week agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("modelchanger")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("1010101110")] [assembly: AssemblyProduct("modelchanger")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("3B95EEF7-4A97-4393-91A0-3626434F3631")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace modelchanger; [BepInPlugin("1010101110.modelchanger", "modelchanger", "1.0.4")] public class Mod : BaseUnityPlugin { [HarmonyPatch(typeof(Player), "Start")] private static class PlayerStartPatch { private static void Postfix(Player __instance) { if ((Object)(object)CustomRuntime == (Object)null) { CustomRuntime = MakeAOC(replacementMap, ((Character)__instance).m_animator.runtimeAnimatorController); } if (!Object.op_Implicit((Object)(object)Player.m_localPlayer)) { return; } string @string = ((Character)__instance).m_nview.m_zdo.GetString("KGmodelchanged", ""); if (!string.IsNullOrWhiteSpace(@string)) { ApplyModelOnPlayer(__instance, @string); } if (Humanoids != null) { return; } Humanoids = new Dictionary<string, string>(); foreach (GameObject prefab in ZNetScene.instance.m_prefabs) { Humanoid component = prefab.GetComponent<Humanoid>(); if (Object.op_Implicit((Object)(object)component)) { if (((Character)component).m_name != null) { Humanoids.Add(((Object)prefab.gameObject).name, ((Character)prefab.GetComponent<Humanoid>()).m_name); } else { Humanoids.Add(((Object)prefab.gameObject).name, ((Object)prefab.gameObject).name); } } OrderedHumanoids = Humanoids.OrderBy(delegate(KeyValuePair<string, string> name) { Localization instance = Localization.instance; KeyValuePair<string, string> keyValuePair = name; return instance.Localize(keyValuePair.Value); }); } } } [HarmonyPatch(typeof(ZNetScene), "Awake")] private static class AddingZroutMethods { private static void Postfix() { ZRoutedRpc.instance.Register<ZPackage>("KGchangemodel", (Action<long, ZPackage>)PlayerChangedModel); } } [HarmonyPatch(typeof(Terminal), "InitTerminal")] public static class addcheats { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static ConsoleEvent <>9__0_0; public static ConsoleEvent <>9__0_1; internal void <Postfix>b__0_0(ConsoleEventArgs args) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown //IL_0058: Unknown result type (might be due to invalid IL or missing references) if (args.Length == 2) { if (Humanoids.ContainsKey(args[1])) { ((Character)Player.m_localPlayer).m_nview.m_zdo.Set("KGmodelchanged", args[1]); ZPackage val = new ZPackage(); val.Write(((Character)Player.m_localPlayer).GetZDOID()); val.Write(args[1]); ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.Everybody, "KGchangemodel", new object[1] { val }); args.Context.AddString("model changed! " + args[1]); } else { args.Context.AddString("invalid model"); } } else { args.Context.AddString("you must specify a model, use modellist to get the options"); } } internal void <Postfix>b__0_1(ConsoleEventArgs args) { string text = "Models you can change to(hopefully): "; foreach (KeyValuePair<string, string> orderedHumanoid in OrderedHumanoids) { text = text + orderedHumanoid.Key + ", "; } args.Context.AddString(text); } } private static void Postfix() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_006b: 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) //IL_0062: Expected O, but got Unknown object obj = <>c.<>9__0_0; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown //IL_0058: Unknown result type (might be due to invalid IL or missing references) if (args.Length == 2) { if (Humanoids.ContainsKey(args[1])) { ((Character)Player.m_localPlayer).m_nview.m_zdo.Set("KGmodelchanged", args[1]); ZPackage val3 = new ZPackage(); val3.Write(((Character)Player.m_localPlayer).GetZDOID()); val3.Write(args[1]); ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.Everybody, "KGchangemodel", new object[1] { val3 }); args.Context.AddString("model changed! " + args[1]); } else { args.Context.AddString("invalid model"); } } else { args.Context.AddString("you must specify a model, use modellist to get the options"); } }; <>c.<>9__0_0 = val; obj = (object)val; } new ConsoleCommand("modelchange", "", (ConsoleEvent)obj, true, false, false, true, false, (ConsoleOptionsFetcher)null, false, false, false); object obj2 = <>c.<>9__0_1; if (obj2 == null) { ConsoleEvent val2 = delegate(ConsoleEventArgs args) { string text = "Models you can change to(hopefully): "; foreach (KeyValuePair<string, string> orderedHumanoid in OrderedHumanoids) { text = text + orderedHumanoid.Key + ", "; } args.Context.AddString(text); }; <>c.<>9__0_1 = val2; obj2 = (object)val2; } new ConsoleCommand("modellist", "", (ConsoleEvent)obj2, true, false, false, true, false, (ConsoleOptionsFetcher)null, false, false, false); } } public static readonly Harmony harmony = new Harmony(typeof(Mod).GetCustomAttributes(typeof(BepInPlugin), inherit: false).Cast<BepInPlugin>().First() .GUID); private static RuntimeAnimatorController CustomRuntime; private static Dictionary<string, string> Humanoids; private static IOrderedEnumerable<KeyValuePair<string, string>> OrderedHumanoids; private static Dictionary<string, string> replacementMap = new Dictionary<string, string>(); public static Dictionary<string, AnimationClip> ExternalAnimations = new Dictionary<string, AnimationClip>(); private void Awake() { harmony.PatchAll(); } private void OnDestroy() { harmony.UnpatchSelf(); } private static void ResetPlayerModel(Player p) { Transform val = ((Component)p).transform.Find("NewVisual"); if (Object.op_Implicit((Object)(object)(((Object)(object)val != (Object)null) ? ((Component)val).gameObject : null))) { Object.Destroy((Object)(object)((Component)((Component)p).transform.Find("NewVisual")).gameObject); } ((Character)p).m_visual = ((Component)((Component)p).transform.Find("Visual")).gameObject; ((Character)p).m_visual.transform.SetSiblingIndex(0); ((Character)p).m_visual.SetActive(true); ((Character)p).m_animator = ((Character)p).m_visual.GetComponent<Animator>(); ((Character)p).m_zanim.m_animator = ((Character)p).m_visual.GetComponent<Animator>(); ((Humanoid)p).m_visEquipment.m_visual = ((Character)p).m_visual; ((Component)p).GetComponent<FootStep>().m_feet = (Transform[])(object)new Transform[2] { Utils.FindChild(((Character)p).m_visual.transform, "LeftFoot", (IterativeSearchType)0), Utils.FindChild(((Character)p).m_visual.transform, "RightFoot", (IterativeSearchType)0) }; ((Humanoid)p).m_visEquipment.m_rightHand = Utils.FindChild(((Character)p).m_visual.transform, "RightHand_Attach", (IterativeSearchType)0); ((Humanoid)p).m_visEquipment.m_leftHand = Utils.FindChild(((Character)p).m_visual.transform, "LeftHand_Attach", (IterativeSearchType)0); ((Humanoid)p).m_visEquipment.m_helmet = Utils.FindChild(((Character)p).m_visual.transform, "Helmet_attach", (IterativeSearchType)0); ((Collider)((Character)p).m_collider).enabled = true; } private static void ApplyModelOnPlayer(Player p, string changedModel) { //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) ResetPlayerModel(p); GameObject prefab = ZNetScene.instance.GetPrefab(changedModel); if (!Object.op_Implicit((Object)(object)prefab) || !Object.op_Implicit((Object)(object)prefab.GetComponent<Humanoid>())) { return; } prefab = ((Component)prefab.GetComponentInChildren<Animator>()).gameObject; ((Character)p).m_visual = Object.Instantiate<GameObject>(prefab, ((Component)p).transform); ((Character)p).m_visual.transform.SetSiblingIndex(0); ((Object)((Character)p).m_visual.transform).name = "NewVisual"; Collider val = CopyComponent<Collider>(ZNetScene.instance.GetPrefab(changedModel).GetComponent<Collider>(), ((Character)p).m_visual); ((Component)val).gameObject.layer = ((Component)((Character)p).m_collider).gameObject.layer; Transform val2 = Utils.FindChild(((Character)p).m_visual.transform, "Armature", (IterativeSearchType)0); if (Object.op_Implicit((Object)(object)val2)) { Vector3 localScale = val2.localScale; Bounds bounds = ((Character)p).m_visual.GetComponentInChildren<SkinnedMeshRenderer>().sharedMesh.bounds; Vector3 val3 = Vector3.Scale(localScale, ((Bounds)(ref bounds)).size); if (((Vector3)(ref val3)).magnitude >= 12f) { val2.localScale = new Vector3(val2.localScale.x / 3.5f, val2.localScale.y / 3.5f, val2.localScale.z / 3.5f); CapsuleCollider val4 = (CapsuleCollider)(object)((val is CapsuleCollider) ? val : null); if ((Object)(object)val4 != (Object)null) { val4.radius /= 3.5f; } } } ((Character)p).m_visual.transform.localPosition = Vector3.zero; ((Character)p).m_visual.GetComponent<Animator>().runtimeAnimatorController = CustomRuntime; ((Character)p).m_animator = ((Character)p).m_visual.GetComponent<Animator>(); ((Character)p).m_zanim.m_animator = ((Character)p).m_visual.GetComponent<Animator>(); ((Component)((Component)p).transform.Find("Visual")).gameObject.SetActive(false); ((Humanoid)p).m_visEquipment.m_visual = ((Character)p).m_visual; if ((Object)(object)Utils.FindChild(((Character)p).m_visual.transform, "RightHand_Attach", (IterativeSearchType)0) != (Object)null) { ((Humanoid)p).m_visEquipment.m_rightHand = Utils.FindChild(((Character)p).m_visual.transform, "RightHand_Attach", (IterativeSearchType)0); ((Humanoid)p).m_visEquipment.m_leftHand = Utils.FindChild(((Character)p).m_visual.transform, "LeftHand_Attach", (IterativeSearchType)0); ((Humanoid)p).m_visEquipment.m_helmet = Utils.FindChild(((Character)p).m_visual.transform, "Helmet_attach", (IterativeSearchType)0); } else if ((Object)(object)Utils.FindChild(((Character)p).m_visual.transform, "RightAttach", (IterativeSearchType)0) != (Object)null) { ((Humanoid)p).m_visEquipment.m_rightHand = Utils.FindChild(((Character)p).m_visual.transform, "RightAttach", (IterativeSearchType)0); ((Humanoid)p).m_visEquipment.m_leftHand = Utils.FindChild(((Character)p).m_visual.transform, "LeftAttach", (IterativeSearchType)0); ((Humanoid)p).m_visEquipment.m_helmet = Utils.FindChild(((Character)p).m_visual.transform, "HelmetAttach", (IterativeSearchType)0); } else if ((Object)(object)Utils.FindChild(((Character)p).m_visual.transform, "RightHand", (IterativeSearchType)0) != (Object)null) { ((Humanoid)p).m_visEquipment.m_rightHand = Utils.FindChild(((Character)p).m_visual.transform, "RightHand", (IterativeSearchType)0); ((Humanoid)p).m_visEquipment.m_leftHand = Utils.FindChild(((Character)p).m_visual.transform, "LeftHand", (IterativeSearchType)0); ((Humanoid)p).m_visEquipment.m_helmet = Utils.FindChild(((Character)p).m_visual.transform, "Head", (IterativeSearchType)0); } else if ((Object)(object)Utils.FindChild(((Character)p).m_visual.transform, "l_hand", (IterativeSearchType)0) != (Object)null) { ((Humanoid)p).m_visEquipment.m_rightHand = Utils.FindChild(((Character)p).m_visual.transform, "r_hand", (IterativeSearchType)0); ((Humanoid)p).m_visEquipment.m_leftHand = Utils.FindChild(((Character)p).m_visual.transform, "l_hand", (IterativeSearchType)0); ((Humanoid)p).m_visEquipment.m_helmet = Utils.FindChild(((Character)p).m_visual.transform, "head", (IterativeSearchType)0); } else if ((Object)(object)Utils.FindChild(((Character)p).m_visual.transform, "mixamorig:RightHand", (IterativeSearchType)0) != (Object)null) { ((Humanoid)p).m_visEquipment.m_rightHand = Utils.FindChild(((Character)p).m_visual.transform, "mixamorig:RightHand", (IterativeSearchType)0); ((Humanoid)p).m_visEquipment.m_leftHand = Utils.FindChild(((Character)p).m_visual.transform, "mixamorig:LeftHand", (IterativeSearchType)0); ((Humanoid)p).m_visEquipment.m_helmet = Utils.FindChild(((Character)p).m_visual.transform, "mixamorig:HeadTop_End", (IterativeSearchType)0); } ((Collider)((Character)p).m_collider).enabled = false; ((Component)p).GetComponent<FootStep>().m_feet = (Transform[])(object)new Transform[2] { Utils.FindChild(((Character)p).m_visual.transform, "LeftFoot", (IterativeSearchType)0), Utils.FindChild(((Character)p).m_visual.transform, "RightFoot", (IterativeSearchType)0) }; } private static void PlayerChangedModel(long sender, ZPackage pkg) { //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_0014: Unknown result type (might be due to invalid IL or missing references) ZDOID val = pkg.ReadZDOID(); string changedModel = pkg.ReadString(); GameObject val2 = ZNetScene.instance.FindInstance(val); if (Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)val2.GetComponent<Player>())) { Player component = val2.GetComponent<Player>(); ApplyModelOnPlayer(component, changedModel); } } private static T CopyComponent<T>(T original, GameObject destination) where T : Component { Type type = ((object)original).GetType(); Component val = destination.AddComponent(type); try { BindingFlags bindingAttr = BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; PropertyInfo[] properties = type.GetProperties(bindingAttr); PropertyInfo[] array = properties; foreach (PropertyInfo propertyInfo in array) { if (propertyInfo.CanWrite) { propertyInfo.SetValue(val, propertyInfo.GetValue(original, null), null); } } FieldInfo[] fields = type.GetFields(bindingAttr); FieldInfo[] array2 = fields; foreach (FieldInfo fieldInfo in array2) { fieldInfo.SetValue(val, fieldInfo.GetValue(original)); } } catch { } return (T)(object)((val is T) ? val : null); } public static RuntimeAnimatorController MakeAOC(Dictionary<string, string> replacement, RuntimeAnimatorController ORIGINAL) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown AnimatorOverrideController val = new AnimatorOverrideController(ORIGINAL); List<KeyValuePair<AnimationClip, AnimationClip>> list = new List<KeyValuePair<AnimationClip, AnimationClip>>(); AnimationClip[] animationClips = ((RuntimeAnimatorController)val).animationClips; foreach (AnimationClip val2 in animationClips) { string name = ((Object)val2).name; if (replacement.ContainsKey(name)) { AnimationClip value = Object.Instantiate<AnimationClip>(ExternalAnimations[replacement[name]]); list.Add(new KeyValuePair<AnimationClip, AnimationClip>(val2, value)); } else { list.Add(new KeyValuePair<AnimationClip, AnimationClip>(val2, val2)); } } val.ApplyOverrides((IList<KeyValuePair<AnimationClip, AnimationClip>>)list); return (RuntimeAnimatorController)(object)val; } }
files/plugins/shrooms.dll
Decompiled a week agousing System.Collections; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using HarmonyLib; using Jotunn; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using Jotunn.Utils; using UnityEngine; using UnityEngine.PostProcessing; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("socketparams")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("socketparams")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("3B95EEF7-4A97-4393-91A0-3626434F3631")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace tripping { [BepInPlugin("1010101110.shrooms", "shrooms", "1.3.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Mod : BaseUnityPlugin { public static readonly Harmony harmony = new Harmony(typeof(Mod).GetCustomAttributes(typeof(BepInPlugin), inherit: false).Cast<BepInPlugin>().First() .GUID); private void Awake() { harmony.PatchAll(); PrefabManager.OnVanillaPrefabsAvailable += AddShrooms; } private void OnDestroy() { harmony.UnpatchSelf(); } private void AddShrooms() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: 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_00bf: Expected O, but got Unknown //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Expected O, but got Unknown //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Expected O, but got Unknown //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Expected O, but got Unknown //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Expected O, but got Unknown //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Expected O, but got Unknown //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Expected O, but got Unknown //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Expected O, but got Unknown //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Expected O, but got Unknown //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Expected O, but got Unknown //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Expected O, but got Unknown //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Expected O, but got Unknown //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Expected O, but got Unknown //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Expected O, but got Unknown //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Expected O, but got Unknown //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Expected O, but got Unknown //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Expected O, but got Unknown //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Expected O, but got Unknown //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_0315: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_0332: Expected O, but got Unknown //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_0337: Expected O, but got Unknown //IL_034d: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_035a: Unknown result type (might be due to invalid IL or missing references) //IL_0366: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Unknown result type (might be due to invalid IL or missing references) //IL_0376: Unknown result type (might be due to invalid IL or missing references) //IL_037e: Unknown result type (might be due to invalid IL or missing references) //IL_038a: Unknown result type (might be due to invalid IL or missing references) //IL_039b: Expected O, but got Unknown //IL_0396: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Expected O, but got Unknown //IL_03b2: Unknown result type (might be due to invalid IL or missing references) //IL_03b7: Unknown result type (might be due to invalid IL or missing references) //IL_03c4: Expected O, but got Unknown //IL_03bf: Unknown result type (might be due to invalid IL or missing references) //IL_03c9: Expected O, but got Unknown //IL_03db: Unknown result type (might be due to invalid IL or missing references) //IL_03e5: Expected O, but got Unknown //IL_03f7: Unknown result type (might be due to invalid IL or missing references) //IL_03fd: Expected O, but got Unknown //IL_041a: Unknown result type (might be due to invalid IL or missing references) //IL_041f: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_0434: Expected O, but got Unknown //IL_0436: Unknown result type (might be due to invalid IL or missing references) //IL_043b: Unknown result type (might be due to invalid IL or missing references) //IL_0447: Unknown result type (might be due to invalid IL or missing references) //IL_0450: Expected O, but got Unknown //IL_0452: Unknown result type (might be due to invalid IL or missing references) //IL_0457: Unknown result type (might be due to invalid IL or missing references) //IL_0463: Unknown result type (might be due to invalid IL or missing references) //IL_046c: Expected O, but got Unknown //IL_046e: Unknown result type (might be due to invalid IL or missing references) //IL_0473: Unknown result type (might be due to invalid IL or missing references) //IL_047f: Unknown result type (might be due to invalid IL or missing references) //IL_0488: Expected O, but got Unknown //IL_048f: Unknown result type (might be due to invalid IL or missing references) //IL_0499: Expected O, but got Unknown AssetBundle val = AssetUtils.LoadAssetBundleFromResources("mushroom", typeof(Mod).Assembly); ItemManager.Instance.AddItem(new CustomItem(val.LoadAsset<GameObject>("MushroomBlack"), false, new ItemConfig { Enabled = false })); PrefabManager.Instance.AddPrefab(new CustomPrefab(val.LoadAsset<GameObject>("Pickable_Mushroom_black"), false)); ZoneManager.Instance.AddCustomVegetation(new CustomVegetation(val.LoadAsset<GameObject>("Pickable_Mushroom_black"), false, new VegetationConfig { Biome = (Biome)8, Max = 0.1f, BlockCheck = true, GroupSizeMin = 1, GroupSizeMax = 1, GroupRadius = 4f, MinAltitude = 1f })); ItemManager instance = ItemManager.Instance; GameObject obj = val.LoadAsset<GameObject>("MushroomPink"); ItemConfig val2 = new ItemConfig(); val2.Amount = 2; val2.CraftingStation = "piece_cauldron"; val2.Requirements = (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig { Item = "MushroomYellow", Amount = 2 }, new RequirementConfig { Item = "Raspberry", Amount = 4 }, new RequirementConfig { Item = "GreydwarfEye", Amount = 4 } }; instance.AddItem(new CustomItem(obj, false, val2)); PrefabManager.Instance.AddPrefab(new CustomPrefab(val.LoadAsset<GameObject>("Pickable_Mushroom_pink"), false)); ItemManager instance2 = ItemManager.Instance; GameObject obj2 = val.LoadAsset<GameObject>("MushroomBlood"); val2 = new ItemConfig(); val2.Amount = 2; val2.CraftingStation = "piece_cauldron"; val2.Requirements = (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig { Item = "MushroomBlack", Amount = 2 }, new RequirementConfig { Item = "Bloodbag", Amount = 4 } }; instance2.AddItem(new CustomItem(obj2, false, val2)); PrefabManager.Instance.AddPrefab(new CustomPrefab(val.LoadAsset<GameObject>("Pickable_Mushroom_blood"), false)); ZoneManager.Instance.AddCustomVegetation(new CustomVegetation(val.LoadAsset<GameObject>("Pickable_Mushroom_blood"), false, new VegetationConfig { Biome = (Biome)2, Max = 0.1f, BlockCheck = true, GroupSizeMin = 1, GroupSizeMax = 1, GroupRadius = 4f, MinAltitude = 0f, MaxAltitude = 0.5f })); ItemManager.Instance.AddItem(new CustomItem(val.LoadAsset<GameObject>("MushroomGreen"), false, new ItemConfig { Enabled = false })); PrefabManager.Instance.AddPrefab(new CustomPrefab(val.LoadAsset<GameObject>("Pickable_Mushroom_green"), false)); ZoneManager.Instance.AddCustomVegetation(new CustomVegetation(val.LoadAsset<GameObject>("Pickable_Mushroom_green"), false, new VegetationConfig { Biome = (Biome)2, Max = 0.1f, BlockCheck = true, GroupSizeMin = 1, GroupSizeMax = 1, GroupRadius = 4f, MinAltitude = 0.2f, MaxAltitude = 2f })); ZoneManager.Instance.AddCustomVegetation(new CustomVegetation(PrefabManager.Instance.GetPrefab("Pickable_Mushroom_blue"), false, new VegetationConfig { Biome = (Biome)4, Max = 0.1f, BlockCheck = true, GroupSizeMin = 1, GroupSizeMax = 1, GroupRadius = 4f, MinAltitude = 20f })); ItemManager.Instance.AddItem(new CustomItem(val.LoadAsset<GameObject>("MushroomPurple"), false, new ItemConfig { Enabled = false })); PrefabManager.Instance.AddPrefab(new CustomPrefab(val.LoadAsset<GameObject>("Pickable_Mushroom_purple"), false)); ItemManager instance3 = ItemManager.Instance; GameObject obj3 = val.LoadAsset<GameObject>("MushroomRainbow"); val2 = new ItemConfig(); val2.Amount = 2; val2.CraftingStation = "piece_cauldron"; val2.Requirements = (RequirementConfig[])(object)new RequirementConfig[4] { new RequirementConfig { Item = "MushroomBlack", Amount = 1 }, new RequirementConfig { Item = "MushroomGreen", Amount = 1 }, new RequirementConfig { Item = "MushroomBlue", Amount = 1 }, new RequirementConfig { Item = "MushroomPurple", Amount = 1 } }; instance3.AddItem(new CustomItem(obj3, false, val2)); PrefabManager.Instance.AddPrefab(val.LoadAsset<GameObject>("Pickable_Mushroom_rainbow")); } } } namespace tripping.Patches { public class TrippingPatches { [HarmonyPatch(typeof(Player), "FixedUpdate")] private class playerposty { private static void Postfix(ref Player __instance) { //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Expected O, but got Unknown //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0563: Unknown result type (might be due to invalid IL or missing references) //IL_0568: Unknown result type (might be due to invalid IL or missing references) //IL_04f0: Unknown result type (might be due to invalid IL or missing references) //IL_04ff: Unknown result type (might be due to invalid IL or missing references) //IL_050f: Unknown result type (might be due to invalid IL or missing references) //IL_0514: Unknown result type (might be due to invalid IL or missing references) //IL_03c7: Unknown result type (might be due to invalid IL or missing references) //IL_03d6: Unknown result type (might be due to invalid IL or missing references) //IL_03e0: Unknown result type (might be due to invalid IL or missing references) //IL_03e5: Unknown result type (might be due to invalid IL or missing references) //IL_03ea: Unknown result type (might be due to invalid IL or missing references) //IL_03ef: Unknown result type (might be due to invalid IL or missing references) //IL_03f4: Unknown result type (might be due to invalid IL or missing references) //IL_05f3: Unknown result type (might be due to invalid IL or missing references) //IL_05f8: Unknown result type (might be due to invalid IL or missing references) //IL_0683: Unknown result type (might be due to invalid IL or missing references) //IL_0688: Unknown result type (might be due to invalid IL or missing references) if (!((Character)__instance).m_nview.IsValid() || !((Character)__instance).m_nview.IsOwner() || __instance.GetPlayerID() != Player.m_localPlayer.GetPlayerID()) { return; } StatusEffect statusEffect = ((Character)__instance).m_seman.GetStatusEffect(StringExtensionMethods.GetStableHashCode("se_alcohol")); bool flag = false; bool flag2 = false; bool flag3 = false; bool flag4 = false; bool flag5 = false; bool flag6 = false; foreach (Food food in Player.m_localPlayer.m_foods) { if (food.m_name == "MushroomBlue") { flag = true; } if (food.m_name == "MushroomBlack") { flag2 = true; blacktimer += Time.deltaTime; if (blacktimer > 0.5f) { HitData val = new HitData(); val.m_point = ((Character)__instance).GetCenterPoint(); val.m_damage.m_spirit = 1f; ((Character)__instance).ApplyDamage(val, true, false, (DamageModifier)0); blacktimer = 0f; } } if (food.m_name == "MushroomBlood") { flag3 = true; } if (food.m_name == "MushroomRainbow") { flag4 = true; } if (food.m_name == "MushroomPurple") { flag5 = true; } if (food.m_name == "MushroomGreen") { flag6 = true; } } if (flag6 || (((Humanoid)Player.m_localPlayer).m_utilityItem != null && ((Humanoid)Player.m_localPlayer).m_utilityItem.m_shared.m_name.Contains("wishbone"))) { ((Character)Player.m_localPlayer).m_seman.AddStatusEffect(StringExtensionMethods.GetStableHashCode("Wishbone"), false, 0, 0f); } else { ((Character)Player.m_localPlayer).m_seman.RemoveStatusEffect(StringExtensionMethods.GetStableHashCode("Wishbone"), false); } if (flag5 && Time.frameCount % 200 == 0) { int num = Random.Range(1, 200); GameObject val2 = null; switch (num) { case 100: val2 = PrefabManager.Instance.GetPrefab("sfx_ghost_alert"); break; case 99: val2 = PrefabManager.Instance.GetPrefab("sfx_haldor_laugh"); break; case 98: val2 = PrefabManager.Instance.GetPrefab("sfx_land_water"); break; case 97: val2 = PrefabManager.Instance.GetPrefab("sfx_offering"); break; case 96: val2 = PrefabManager.Instance.GetPrefab("sfx_secretfound"); break; case 95: val2 = PrefabManager.Instance.GetPrefab("sfx_tree_fall"); break; case 94: val2 = PrefabManager.Instance.GetPrefab("sfx_wraith_idle"); break; case 93: val2 = PrefabManager.Instance.GetPrefab("sfx_coins_pile_destroyed"); break; case 92: val2 = PrefabManager.Instance.GetPrefab("sfx_eikthyr_idle"); break; case 91: val2 = PrefabManager.Instance.GetPrefab("sfx_gui_craftitem_cauldron"); break; case 90: val2 = PrefabManager.Instance.GetPrefab("sfx_lootspawn"); break; case 89: ((Humanoid)Player.m_localPlayer).UnequipAllItems(); break; } if (Object.op_Implicit((Object)(object)val2)) { ZLog.LogError((object)("purple sound " + ((Object)val2).name)); Object.Instantiate<GameObject>(val2, ((Component)Player.m_localPlayer).transform.position + ((Component)Player.m_localPlayer).transform.forward * 2f + Vector3.up, Quaternion.identity); } } PostProcessingBehaviour component = ((Component)GameCamera.instance).gameObject.GetComponent<PostProcessingBehaviour>(); if (!((Object)(object)component != (Object)null)) { return; } if (flag4) { ((PostProcessingModel)((PostProcessingComponent<VignetteModel>)(object)component.m_Vignette).model).enabled = true; ((PostProcessingComponent<VignetteModel>)(object)component.m_Vignette).model.m_Settings.intensity = Mathf.Min(2f, ((PostProcessingComponent<VignetteModel>)(object)component.m_Vignette).model.m_Settings.intensity + 0.01f); rainbowtimer += Time.deltaTime; if (rainbowtimer > rainbowchangeevery) { rainbowcurrent = (rainbowcurrent + 1) % rainbowcolors.Length; rainbownext = (rainbowcurrent + 1) % rainbowcolors.Length; rainbowtimer = 0f; } ((PostProcessingComponent<VignetteModel>)(object)component.m_Vignette).model.m_Settings.color = Color.Lerp(rainbowcolors[rainbowcurrent], rainbowcolors[rainbownext], rainbowtimer / rainbowchangeevery); } else if (flag3) { ((PostProcessingModel)((PostProcessingComponent<VignetteModel>)(object)component.m_Vignette).model).enabled = true; ((PostProcessingComponent<VignetteModel>)(object)component.m_Vignette).model.m_Settings.color = new Color(5f, 0f, 0f, 1f); ((PostProcessingComponent<VignetteModel>)(object)component.m_Vignette).model.m_Settings.intensity = Mathf.Min(1f, ((PostProcessingComponent<VignetteModel>)(object)component.m_Vignette).model.m_Settings.intensity + 0.01f); } else if (flag2) { ((PostProcessingModel)((PostProcessingComponent<VignetteModel>)(object)component.m_Vignette).model).enabled = true; ((PostProcessingComponent<VignetteModel>)(object)component.m_Vignette).model.m_Settings.color = new Color(0f, 0f, 0f, 1f); ((PostProcessingComponent<VignetteModel>)(object)component.m_Vignette).model.m_Settings.intensity = Mathf.Min(0.8f, ((PostProcessingComponent<VignetteModel>)(object)component.m_Vignette).model.m_Settings.intensity + 0.01f); } else if (flag) { ((PostProcessingModel)((PostProcessingComponent<VignetteModel>)(object)component.m_Vignette).model).enabled = true; ((PostProcessingComponent<VignetteModel>)(object)component.m_Vignette).model.m_Settings.color = new Color(0f, 0f, 2f, 1f); ((PostProcessingComponent<VignetteModel>)(object)component.m_Vignette).model.m_Settings.intensity = Mathf.Min(0.2f, ((PostProcessingComponent<VignetteModel>)(object)component.m_Vignette).model.m_Settings.intensity + 0.01f); } else if (((PostProcessingComponent<VignetteModel>)(object)component.m_Vignette).model.m_Settings.intensity > 0.05f) { ((PostProcessingComponent<VignetteModel>)(object)component.m_Vignette).model.m_Settings.intensity = Mathf.Max(0.05f, ((PostProcessingComponent<VignetteModel>)(object)component.m_Vignette).model.m_Settings.intensity - 0.001f); } else { ((PostProcessingModel)((PostProcessingComponent<VignetteModel>)(object)component.m_Vignette).model).enabled = false; } if (flag || flag2 || flag3 || flag4 || flag5) { ((PostProcessingComponent<ChromaticAberrationModel>)(object)component.m_ChromaticAberration).model.m_Settings.intensity = Mathf.Min(20f, ((PostProcessingComponent<ChromaticAberrationModel>)(object)component.m_ChromaticAberration).model.m_Settings.intensity + 0.5f); } else if ((Object)(object)statusEffect != (Object)null) { ((PostProcessingComponent<ChromaticAberrationModel>)(object)component.m_ChromaticAberration).model.m_Settings.intensity += 0.003f; } else if (((PostProcessingComponent<ChromaticAberrationModel>)(object)component.m_ChromaticAberration).model.m_Settings.intensity > 0.14f) { ((PostProcessingComponent<ChromaticAberrationModel>)(object)component.m_ChromaticAberration).model.m_Settings.intensity = Mathf.Max(0.14f, ((PostProcessingComponent<ChromaticAberrationModel>)(object)component.m_ChromaticAberration).model.m_Settings.intensity - 0.01f); } if (flag || flag4) { if (((PostProcessingComponent<ColorGradingModel>)(object)component.m_ColorGrading).model.m_Settings.basic.saturation != 2f) { ((PostProcessingComponent<ColorGradingModel>)(object)component.m_ColorGrading).model.m_Settings.basic.saturation = Mathf.Min(2f, ((PostProcessingComponent<ColorGradingModel>)(object)component.m_ColorGrading).model.m_Settings.basic.saturation + 0.05f); ((PostProcessingComponent<ColorGradingModel>)(object)component.m_ColorGrading).model.isDirty = true; } } else if (flag2 || flag6) { if (((PostProcessingComponent<ColorGradingModel>)(object)component.m_ColorGrading).model.m_Settings.basic.saturation != 0.2f) { ((PostProcessingComponent<ColorGradingModel>)(object)component.m_ColorGrading).model.m_Settings.basic.saturation = 0.2f; ((PostProcessingComponent<ColorGradingModel>)(object)component.m_ColorGrading).model.isDirty = true; } } else if (((PostProcessingComponent<ColorGradingModel>)(object)component.m_ColorGrading).model.m_Settings.basic.saturation != 1f) { if (((PostProcessingComponent<ColorGradingModel>)(object)component.m_ColorGrading).model.m_Settings.basic.saturation < 1f) { ((PostProcessingComponent<ColorGradingModel>)(object)component.m_ColorGrading).model.m_Settings.basic.saturation = Mathf.Min(1f, ((PostProcessingComponent<ColorGradingModel>)(object)component.m_ColorGrading).model.m_Settings.basic.saturation + 0.01f); } else { ((PostProcessingComponent<ColorGradingModel>)(object)component.m_ColorGrading).model.m_Settings.basic.saturation = Mathf.Max(1f, ((PostProcessingComponent<ColorGradingModel>)(object)component.m_ColorGrading).model.m_Settings.basic.saturation - 0.01f); } ((PostProcessingComponent<ColorGradingModel>)(object)component.m_ColorGrading).model.isDirty = true; } } } [HarmonyPatch(typeof(Pickable), "Awake")] private class pickableposty { private static void Postfix(ref Pickable __instance) { ((MonoBehaviour)__instance).StartCoroutine(CheckPinkMushroom(__instance)); } } [HarmonyPatch(typeof(Pickable), "SetPicked")] private class pickablepostpick { private static void Postfix(bool picked, ref Pickable __instance) { if (!picked) { return; } GameObject gameObject = ((Component)((Component)__instance).transform).gameObject; if ((Object)(object)gameObject != (Object)null) { Transform val = gameObject.transform.Find("pinkfloaters"); if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)((Component)val).gameObject)) { Object.Destroy((Object)(object)((Component)val).gameObject); } } } } private static Color[] rainbowcolors = (Color[])(object)new Color[8] { new Color(5f, 0f, 0f, 1f), new Color(5f, 2f, 0f, 1f), new Color(5f, 5f, 0f, 1f), new Color(0f, 5f, 0f, 1f), new Color(0f, 3f, 2f, 1f), new Color(0f, 0f, 5f, 1f), new Color(3f, 0f, 5f, 1f), new Color(4f, 0f, 2f, 1f) }; private static int rainbowcurrent = 0; private static int rainbownext = 1; private static float rainbowtimer = 0f; private static float rainbowchangeevery = 0.5f; private static float blacktimer = 0f; public static IEnumerator CheckPinkMushroom(Pickable __instance) { while (true) { if (__instance.m_nview.IsValid() && (Object)(object)Player.m_localPlayer != (Object)null && ((Character)Player.m_localPlayer).m_nview.IsValid()) { bool pinkshroom = false; foreach (Food food in Player.m_localPlayer.m_foods) { if (food.m_name == "MushroomPink") { pinkshroom = true; } } if (!__instance.m_picked && pinkshroom) { GameObject parento2 = ((Component)((Component)__instance).transform).gameObject; if ((Object)(object)parento2 != (Object)null) { bool found = false; Transform floaterstransform2 = parento2.transform.Find("pinkfloaters"); if (Object.op_Implicit((Object)(object)floaterstransform2) && Object.op_Implicit((Object)(object)((Component)floaterstransform2).gameObject)) { found = true; } if (!found) { GameObject pinkprefab = PrefabManager.Instance.GetPrefab("MushroomPink"); if (Object.op_Implicit((Object)(object)pinkprefab)) { Transform pinkfloaterstransform = pinkprefab.transform.Find("attach/floaters"); if (Object.op_Implicit((Object)(object)pinkfloaterstransform) && Object.op_Implicit((Object)(object)((Component)pinkfloaterstransform).gameObject)) { GameObject pinkfloaters = Object.Instantiate<GameObject>(((Component)pinkfloaterstransform).gameObject, parento2.transform); ((Object)pinkfloaters).name = "pinkfloaters"; pinkfloaters.transform.localScale = new Vector3(2f, 2f, 2f); } else { Logger.LogError((object)"failed to find MushroomPink floaters"); } } else { Logger.LogError((object)"failed to find MushroomPink"); } } } } else { GameObject parento = ((Component)((Component)__instance).transform).gameObject; if ((Object)(object)parento != (Object)null) { Transform floaterstransform = parento.transform.Find("pinkfloaters"); if (Object.op_Implicit((Object)(object)floaterstransform) && Object.op_Implicit((Object)(object)((Component)floaterstransform).gameObject)) { Object.Destroy((Object)(object)((Component)floaterstransform).gameObject); } } } } yield return (object)new WaitForSeconds(Random.Range(10f, 20f)); } } } }
files/plugins/ValheimRoleplay.dll
Decompiled a week 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.Net; 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.Cryptography; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using JetBrains.Annotations; using Jotunn; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using Jotunn.Utils; using Microsoft.CodeAnalysis; using ServerSync; using SimpleJson; using Splatform; using TMPro; using UnityEngine; using UnityEngine.Networking; using UnityEngine.PostProcessing; using UnityEngine.UI; using ValheimRoleplay; using ValheimRoleplay.Data; using ValheimRoleplay.Helpers; using ValheimRoleplay.Patches; 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: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("ValheimRoleplay")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyProduct("ValheimRoleplay")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("4358610B-F3F4-4843-B7AF-98B7BC60DCDE")] [assembly: AssemblyFileVersion("1.4.5")] [assembly: AssemblyCompany("Arielle")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.4.5.0")] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [<e8a3b390-96e1-48a9-9b08-091d0a31141b>Embedded] internal sealed class <e8a3b390-96e1-48a9-9b08-091d0a31141b>EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [<e8a3b390-96e1-48a9-9b08-091d0a31141b>Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class <5db7413e-51f4-4992-9c8a-f975eaad6b05>NullableAttribute : Attribute { public readonly byte[] NullableFlags; public <5db7413e-51f4-4992-9c8a-f975eaad6b05>NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public <5db7413e-51f4-4992-9c8a-f975eaad6b05>NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [<e8a3b390-96e1-48a9-9b08-091d0a31141b>Embedded] internal sealed class <23ce6907-0295-4e25-921d-3566505f5f9d>NullableContextAttribute : Attribute { public readonly byte Flag; public <23ce6907-0295-4e25-921d-3566505f5f9d>NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace MessageRouter { [<23ce6907-0295-4e25-921d-3566505f5f9d>NullableContext(1)] [<5db7413e-51f4-4992-9c8a-f975eaad6b05>Nullable(0)] public static class RoutedRPCDataExtensions { public static void DeserializeFrom(this RoutedRPCData routedRpcData, ref ZPackage sourcePackage) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) routedRpcData.m_msgID = sourcePackage.ReadLong(); routedRpcData.m_senderPeerID = sourcePackage.ReadLong(); routedRpcData.m_targetPeerID = sourcePackage.ReadLong(); routedRpcData.m_targetZDO = sourcePackage.ReadZDOID(); routedRpcData.m_methodHash = sourcePackage.ReadInt(); sourcePackage.ReadPackageTo(ref routedRpcData.m_parameters); } public static void Clear(this RoutedRPCData routedRpcData) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) routedRpcData.m_msgID = 0L; routedRpcData.m_senderPeerID = 0L; routedRpcData.m_targetPeerID = 0L; routedRpcData.m_targetZDO = default(ZDOID); routedRpcData.m_methodHash = 0; ZPackage parameters = routedRpcData.m_parameters; if (parameters != null) { parameters.Clear(); } } } public abstract class RpcMethodHandler { [<23ce6907-0295-4e25-921d-3566505f5f9d>NullableContext(1)] public abstract bool Process(RoutedRPCData routedRpcData); } public static class ZPackageExtensions { [<23ce6907-0295-4e25-921d-3566505f5f9d>NullableContext(1)] public static void ReadPackageTo(this ZPackage sourcePackage, ref ZPackage targetPackage) { int num = sourcePackage.m_reader.ReadInt32(); targetPackage.m_writer.Flush(); targetPackage.m_stream.SetLength(num); targetPackage.m_stream.Position = 0L; sourcePackage.m_reader.Read(targetPackage.m_stream.GetBuffer(), 0, num); } } [HarmonyPatch(typeof(ZRoutedRpc))] internal static class ZRoutedRpcPatch { [<23ce6907-0295-4e25-921d-3566505f5f9d>NullableContext(1)] [HarmonyPrefix] [HarmonyPatch("RPC_RoutedRPC")] private static bool RPC_RoutedRPCPrefix(ZRoutedRpc __instance, ZRpc rpc, ZPackage pkg) { if (__instance.m_server) { RoutedRpcManager.ProcessRoutedRPC(__instance, rpc, pkg); return false; } return true; } } [HarmonyPatch(typeof(ZNet))] internal static class ZNetPatch { [HarmonyPostfix] [HarmonyPatch("Start")] private static void StartPostfix() { RoutedRpcManager.SetupServerPeer(); } } [<23ce6907-0295-4e25-921d-3566505f5f9d>NullableContext(1)] [<5db7413e-51f4-4992-9c8a-f975eaad6b05>Nullable(0)] public static class RoutedRpcManager { public static readonly Dictionary<int, string> HashCodeToMethodNameCache = new Dictionary<int, string>(); private static readonly Dictionary<int, List<RpcMethodHandler>> _rpcMethodHandlers = new Dictionary<int, List<RpcMethodHandler>>(); private static readonly RoutedRPCData _routedRpcData = new RoutedRPCData(); private static long _serverPeerId = 0L; public static long ServerPeerId => _serverPeerId; public static void SetupServerPeer() { _serverPeerId = ZDOMan.s_instance.m_sessionID; } public static void ServerModerationLog(string player, string item, string action, string creator, string raw) { string input = SimpleJson.SerializeObject((object)new DbLog { p = player, i = item, a = action, c = creator, r = raw }); input = Regex.Replace(input, "[^\\u0009\\u000A\\u000D\\u0020-\\u007E]", ""); ServerPatches.RPC_ModerationLog(0L, input); } public static void AddHandler(string methodName, RpcMethodHandler handler) { int stableHashCode = StringExtensionMethods.GetStableHashCode(methodName); HashCodeToMethodNameCache[stableHashCode] = methodName; ServerModerationLog("server", "", "rpcmanager", "handler", $"Adding handler for {methodName} ({stableHashCode}): {handler.GetType().FullName}"); if (!_rpcMethodHandlers.TryGetValue(stableHashCode, out var value)) { value = new List<RpcMethodHandler>(); _rpcMethodHandlers[stableHashCode] = value; } value.Add(handler); } public static void ProcessRoutedRPC(ZRoutedRpc routedRpc, ZRpc rpc, ZPackage package) { _routedRpcData.DeserializeFrom(ref package); long targetPeerID = _routedRpcData.m_targetPeerID; long id = routedRpc.m_id; if (targetPeerID == id || targetPeerID == 0L) { routedRpc.HandleRoutedRPC(_routedRpcData); } if ((targetPeerID != id || targetPeerID == _serverPeerId) && ProcessHandlers(_routedRpcData)) { routedRpc.RouteRPC(_routedRpcData); } } public static bool ProcessHandlers(RoutedRPCData routedRpcData) { if (!_rpcMethodHandlers.TryGetValue(routedRpcData.m_methodHash, out var value)) { return true; } bool flag = true; foreach (RpcMethodHandler item in value) { flag &= item.Process(routedRpcData); } return flag; } public static string MethodHashToString(int methodHash) { if (HashCodeToMethodNameCache.TryGetValue(methodHash, out var value)) { return value; } return $"RPC_{methodHash}"; } } } namespace ValheimRoleplay { [Serializable] [<5db7413e-51f4-4992-9c8a-f975eaad6b05>Nullable(0)] [<23ce6907-0295-4e25-921d-3566505f5f9d>NullableContext(1)] public class DbLog { public string p { get; set; } public string i { get; set; } public string a { get; set; } public string c { get; set; } public string r { get; set; } } [Serializable] [<5db7413e-51f4-4992-9c8a-f975eaad6b05>Nullable(0)] [<23ce6907-0295-4e25-921d-3566505f5f9d>NullableContext(1)] public class DbPlayer { public string player { get; set; } } [Serializable] [<5db7413e-51f4-4992-9c8a-f975eaad6b05>Nullable(0)] [<23ce6907-0295-4e25-921d-3566505f5f9d>NullableContext(1)] public class DbWhitelist { public int pid { get; set; } public int cid { get; set; } public string steamid { get; set; } public string charactername { get; set; } public bool isnew { get; set; } public bool banned { get; set; } public bool permadeath { get; set; } } [Serializable] [<23ce6907-0295-4e25-921d-3566505f5f9d>NullableContext(1)] [<5db7413e-51f4-4992-9c8a-f975eaad6b05>Nullable(0)] public class DbWhitelistNew { public int pid { get; set; } public int cid { get; set; } public string steamid { get; set; } public string charName { get; set; } } [Serializable] [<5db7413e-51f4-4992-9c8a-f975eaad6b05>Nullable(0)] [<23ce6907-0295-4e25-921d-3566505f5f9d>NullableContext(1)] public class DbGroup { public int id { get; set; } public string charName { get; set; } public string groupName { get; set; } public bool deleted { get; set; } } [Serializable] [<5db7413e-51f4-4992-9c8a-f975eaad6b05>Nullable(0)] [<23ce6907-0295-4e25-921d-3566505f5f9d>NullableContext(1)] public class DbRecipe { public int id { get; set; } public string recipeName { get; set; } public string groups { get; set; } public bool enabled { get; set; } public bool deleted { get; set; } } [<5db7413e-51f4-4992-9c8a-f975eaad6b05>Nullable(0)] [<23ce6907-0295-4e25-921d-3566505f5f9d>NullableContext(1)] internal class Api { public static IEnumerator LogInsert(string json) { UnityWebRequest request = new UnityWebRequest("http://localhost:3333/db/log/insert", "POST"); try { byte[] bytes = Encoding.UTF8.GetBytes(json); request.uploadHandler = (UploadHandler)new UploadHandlerRaw(bytes); request.downloadHandler = (DownloadHandler)new DownloadHandlerBuffer(); request.SetRequestHeader("Content-Type", "application/json"); yield return request.SendWebRequest(); } finally { ((IDisposable)request)?.Dispose(); } } public static IEnumerator WhitelistAuth(string steamid, string charName, int pid, int cid) { string s = SimpleJson.SerializeObject((object)new DbWhitelistNew { steamid = steamid, charName = charName, cid = cid, pid = pid }); UnityWebRequest request = new UnityWebRequest("http://localhost:3333/db/whitelist/new", "POST"); try { byte[] bytes = Encoding.UTF8.GetBytes(s); request.uploadHandler = (UploadHandler)new UploadHandlerRaw(bytes); request.downloadHandler = (DownloadHandler)new DownloadHandlerBuffer(); request.SetRequestHeader("Content-Type", "application/json"); yield return request.SendWebRequest(); ZLog.Log((object)("api whitelist sent " + charName + " " + steamid)); } finally { ((IDisposable)request)?.Dispose(); } } public static IEnumerator WhitelistPermadeath(DbWhitelist deadplayer) { deadplayer.permadeath = true; string s = SimpleJson.SerializeObject((object)deadplayer); UnityWebRequest request = new UnityWebRequest("http://localhost:3333/db/whitelist/dead", "POST"); try { byte[] bytes = Encoding.UTF8.GetBytes(s); request.uploadHandler = (UploadHandler)new UploadHandlerRaw(bytes); request.downloadHandler = (DownloadHandler)new DownloadHandlerBuffer(); request.SetRequestHeader("Content-Type", "application/json"); yield return request.SendWebRequest(); ZLog.Log((object)("api permadeath sent " + deadplayer.charactername + " " + deadplayer.steamid)); } finally { ((IDisposable)request)?.Dispose(); } } public static IEnumerator ServerGetWhitelist() { UnityWebRequest request = UnityWebRequest.Get("http://localhost:3333/db/whitelist/"); yield return request.SendWebRequest(); if ((int)request.result == 1) { DbWhitelist[] array = SimpleJson.DeserializeObject<DbWhitelist[]>(Encoding.UTF8.GetString(request.downloadHandler.data)); if (array != null) { ServerPatches.whitelist.Clear(); DbWhitelist[] array2 = array; foreach (DbWhitelist item in array2) { ServerPatches.whitelist.Add(item); } } else { ZLog.LogError((object)"error whitelist json"); } } else { ZLog.LogError((object)"error in whitelist request"); } } public static IEnumerator ServerGetGroups() { UnityWebRequest request = UnityWebRequest.Get("http://localhost:3333/db/groups/"); yield return request.SendWebRequest(); if ((int)request.result == 1) { DbGroup[] array = SimpleJson.DeserializeObject<DbGroup[]>(Encoding.UTF8.GetString(request.downloadHandler.data)); if (array != null) { ServerPatches.groups.Clear(); DbGroup[] array2 = array; foreach (DbGroup dbGroup in array2) { if (!dbGroup.deleted) { ServerPatches.groups.Add(dbGroup); } } } else { ZLog.LogError((object)"error groups json"); } } else { ZLog.LogError((object)"error in groups request"); } } public static IEnumerator ServerGetRecipes() { UnityWebRequest request = UnityWebRequest.Get("http://localhost:3333/db/recipes"); yield return request.SendWebRequest(); if ((int)request.result == 1) { ServerPatches.recipesraw = Encoding.UTF8.GetString(request.downloadHandler.data); } else { ZLog.LogError((object)"error in recipes request"); } } } public static class ServingTrayHelper { [<23ce6907-0295-4e25-921d-3566505f5f9d>NullableContext(1)] public static void AddToServingTray(CustomItem item, string category = "VRP") { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Expected O, but got Unknown PieceConfig val = new PieceConfig(); val.Name = item.ItemDrop.GetHoverName(); val.Description = item.ItemDrop.m_itemData.m_shared.m_description; val.PieceTable = PieceTables.ServingTray; val.Category = category; val.Requirements = (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig { Item = ((Object)item.ItemDrop).name, Amount = 1 } }; PieceConfig val2 = val; PieceManager.Instance.AddPiece(new CustomPiece(item.ItemPrefab, false, val2)); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [<23ce6907-0295-4e25-921d-3566505f5f9d>NullableContext(1)] [<5db7413e-51f4-4992-9c8a-f975eaad6b05>Nullable(0)] [BepInPlugin("Arielle.ValheimRoleplay", "ValheimRoleplay", "1.4.5")] public class VRPMod : BaseUnityPlugin { [<23ce6907-0295-4e25-921d-3566505f5f9d>NullableContext(0)] public enum Toggle { On = 1, Off = 0 } [<23ce6907-0295-4e25-921d-3566505f5f9d>NullableContext(0)] private class ConfigurationManagerAttributes { [UsedImplicitly] public int? Order; [UsedImplicitly] public bool? Browsable; [<5db7413e-51f4-4992-9c8a-f975eaad6b05>Nullable(2)] [UsedImplicitly] public string Category; [<5db7413e-51f4-4992-9c8a-f975eaad6b05>Nullable(new byte[] { 2, 1 })] [UsedImplicitly] public Action<ConfigEntryBase> CustomDrawer; } internal const string ModName = "ValheimRoleplay"; internal const string ModVersion = "1.4.5"; internal const string Author = "Arielle"; private const string ModGUID = "Arielle.ValheimRoleplay"; private static string ConfigFileName = "Arielle.ValheimRoleplay.cfg"; private static string ConfigFileFullPath; public static ConfigEntry<string> _vrpLore; public static ConfigEntry<float> _drunkChance; public static ConfigEntry<Biome> gatedBiomes; public static ConfigEntry<bool> preventBuilding; public static ConfigEntry<bool> preventExploring; public static ConfigEntry<bool> preventInteraction; internal static string ConnectionError; private readonly Harmony _harmony = new Harmony("Arielle.ValheimRoleplay"); public static readonly ManualLogSource ValheimRoleplayLogger; private static readonly ConfigSync ConfigSync; private static ConfigEntry<Toggle> _serverConfigLocked; internal static ConfigEntry<Toggle> _debugMode; public static bool DebugMode() { return _debugMode.Value == Toggle.On; } public void Awake() { _serverConfigLocked = config("1 - General", "Lock Configuration", Toggle.On, "If on, the configuration is locked and can be changed by server admins only."); ConfigSync.AddLockingConfigEntry<Toggle>(_serverConfigLocked); _vrpLore = config("2 - VRP", "Season Lore", "Hello World", "Intro text for new players."); ConfigSync.AddConfigEntry<string>(_vrpLore); _debugMode = config("2 - VRP", "Debug Mode", Toggle.Off, "If on, will write extra logs. May cause performance issues."); ConfigSync.AddConfigEntry<Toggle>(_debugMode); _drunkChance = config("3 - Custom", "Drunk Chance", 0.25f, "Chance [0..1] to gain Drunk when consuming an alcoholic drink."); ConfigSync.AddConfigEntry<float>(_drunkChance); gatedBiomes = config<Biome>("4 - Progression", "Gated Biomes", (Biome)0, "Biome list."); ConfigSync.AddConfigEntry<Biome>(gatedBiomes); preventBuilding = config("4 - Progression", "No Build", value: true, "Prevent usage of hammers, hoe, cultivator."); ConfigSync.AddConfigEntry<Biome>(gatedBiomes); preventExploring = config("4 - Progression", "No Explore", value: true, "Prevent minimap from exploring."); ConfigSync.AddConfigEntry<Biome>(gatedBiomes); preventInteraction = config("4 - Progression", "No Interaction", value: true, "Prevent interaction with any interactable object."); ConfigSync.AddConfigEntry<Biome>(gatedBiomes); _harmony.PatchAll(); JotunnPatches.AddVariants(); SetupWatcher(); } private void OnDestroy() { ((BaseUnityPlugin)this).Config.Save(); Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } private 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 void ReadConfigValues(object sender, FileSystemEventArgs e) { if (!File.Exists(ConfigFileFullPath)) { return; } try { ValheimRoleplayLogger.LogDebug((object)"ReadConfigValues called"); ((BaseUnityPlugin)this).Config.Reload(); } catch { ValheimRoleplayLogger.LogError((object)("There was an issue loading your " + ConfigFileName)); ValheimRoleplayLogger.LogError((object)"Please check your config entries for spelling and format!"); } } private ConfigEntry<T> config<[<5db7413e-51f4-4992-9c8a-f975eaad6b05>Nullable(2)] T>(string group, string name, T value, ConfigDescription description, bool synchronizedSetting = true) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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 = ((BaseUnityPlugin)this).Config.Bind<T>(group, name, value, val); ConfigSync.AddConfigEntry<T>(val2).SynchronizedConfig = synchronizedSetting; return val2; } private ConfigEntry<T> config<[<5db7413e-51f4-4992-9c8a-f975eaad6b05>Nullable(2)] T>(string group, string name, T value, string description, bool synchronizedSetting = true) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown return config(group, name, value, new ConfigDescription(description, (AcceptableValueBase)null, Array.Empty<object>()), synchronizedSetting); } static VRPMod() { string configPath = Paths.ConfigPath; char directorySeparatorChar = Path.DirectorySeparatorChar; ConfigFileFullPath = configPath + directorySeparatorChar + ConfigFileName; ConnectionError = ""; ValheimRoleplayLogger = Logger.CreateLogSource("ValheimRoleplay"); ConfigSync = new ConfigSync("Arielle.ValheimRoleplay") { DisplayName = "ValheimRoleplay", CurrentVersion = "1.4.5", MinimumRequiredVersion = "1.4.5" }; _serverConfigLocked = null; _debugMode = null; } } public static class KeyboardExtensions { public static bool IsKeyDown(this KeyboardShortcut shortcut) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) if ((int)((KeyboardShortcut)(ref shortcut)).MainKey != 0 && Input.GetKeyDown(((KeyboardShortcut)(ref shortcut)).MainKey)) { return ((KeyboardShortcut)(ref shortcut)).Modifiers.All((Func<KeyCode, bool>)Input.GetKey); } return false; } public static bool IsKeyHeld(this KeyboardShortcut shortcut) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) if ((int)((KeyboardShortcut)(ref shortcut)).MainKey != 0 && Input.GetKey(((KeyboardShortcut)(ref shortcut)).MainKey)) { return ((KeyboardShortcut)(ref shortcut)).Modifiers.All((Func<KeyCode, bool>)Input.GetKey); } return false; } } [HarmonyPatch(typeof(ZNet), "OnNewConnection")] public static class RegisterAndCheckVersion { [<23ce6907-0295-4e25-921d-3566505f5f9d>NullableContext(1)] private static void Prefix(ZNetPeer peer, ref ZNet __instance) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown VRPMod.ValheimRoleplayLogger.LogDebug((object)"Registering version RPC handler"); peer.m_rpc.Register<ZPackage>("ValheimRoleplay_VersionCheck", (Action<ZRpc, ZPackage>)RpcHandlers.RPC_ValheimRoleplay_Version); VRPMod.ValheimRoleplayLogger.LogInfo((object)"Invoking version check"); ZPackage val = new ZPackage(); val.Write("1.4.5"); peer.m_rpc.Invoke("ValheimRoleplay_VersionCheck", new object[1] { val }); } } [<5db7413e-51f4-4992-9c8a-f975eaad6b05>Nullable(0)] [HarmonyPatch(typeof(ZNet), "RPC_PeerInfo")] [<23ce6907-0295-4e25-921d-3566505f5f9d>NullableContext(1)] public static class VerifyClient { private static bool Prefix(ZRpc rpc, ZPackage pkg, ref ZNet __instance) { if (!__instance.IsServer() || RpcHandlers.ValidatedPeers.Contains(rpc)) { return true; } VRPMod.ValheimRoleplayLogger.LogWarning((object)("Peer (" + rpc.m_socket.GetHostName() + ") never sent version or couldn't due to previous disconnect, disconnecting")); rpc.Invoke("Error", new object[1] { 3 }); return false; } private static void Postfix(ZNet __instance) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.instance.GetServerPeerID(), "ValheimRoleplayRequestAdminSync", new object[1] { (object)new ZPackage() }); } } [HarmonyPatch(typeof(FejdStartup), "ShowConnectError")] public class ShowConnectionError { [<23ce6907-0295-4e25-921d-3566505f5f9d>NullableContext(1)] private static void Postfix(FejdStartup __instance) { if (__instance.m_connectionFailedPanel.activeSelf) { __instance.m_connectionFailedError.fontSizeMax = 25f; __instance.m_connectionFailedError.fontSizeMin = 15f; TMP_Text connectionFailedError = __instance.m_connectionFailedError; connectionFailedError.text = connectionFailedError.text + "\n" + VRPMod.ConnectionError; } } } [HarmonyPatch(typeof(ZNet), "Disconnect")] public static class RemoveDisconnectedPeerFromVerified { [<23ce6907-0295-4e25-921d-3566505f5f9d>NullableContext(1)] private static void Prefix(ZNetPeer peer, ref ZNet __instance) { if (__instance.IsServer()) { VRPMod.ValheimRoleplayLogger.LogInfo((object)("Peer (" + peer.m_rpc.m_socket.GetHostName() + ") disconnected, removing from validated list")); RpcHandlers.ValidatedPeers.Remove(peer.m_rpc); } } } [<23ce6907-0295-4e25-921d-3566505f5f9d>NullableContext(1)] [<5db7413e-51f4-4992-9c8a-f975eaad6b05>Nullable(0)] public static class RpcHandlers { public static readonly List<ZRpc> ValidatedPeers = new List<ZRpc>(); public static void RPC_ValheimRoleplay_Version(ZRpc rpc, ZPackage pkg) { string text = pkg.ReadString(); VRPMod.ValheimRoleplayLogger.LogInfo((object)("Version check, local: 1.4.5, remote: " + text)); if (text != "1.4.5") { VRPMod.ConnectionError = "ValheimRoleplay Installed: 1.4.5\n Needed: " + text; if (ZNet.instance.IsServer()) { VRPMod.ValheimRoleplayLogger.LogWarning((object)("Peer (" + rpc.m_socket.GetHostName() + ") has incompatible version, disconnecting...")); rpc.Invoke("Error", new object[1] { 3 }); } } else if (!ZNet.instance.IsServer()) { VRPMod.ValheimRoleplayLogger.LogInfo((object)"Received same version from server!"); } else { VRPMod.ValheimRoleplayLogger.LogInfo((object)("Adding peer (" + rpc.m_socket.GetHostName() + ") to validated list")); ValidatedPeers.Add(rpc); } } public static string ComputeHashForMod() { using SHA256 sHA = SHA256.Create(); byte[] array = sHA.ComputeHash(File.ReadAllBytes(Assembly.GetExecutingAssembly().Location)); StringBuilder stringBuilder = new StringBuilder(); byte[] array2 = array; foreach (byte b in array2) { stringBuilder.Append(b.ToString("X2")); } return stringBuilder.ToString(); } } } namespace ValheimRoleplay.Helpers { [<23ce6907-0295-4e25-921d-3566505f5f9d>NullableContext(1)] [<5db7413e-51f4-4992-9c8a-f975eaad6b05>Nullable(0)] public static class PlantableHelper { [<5db7413e-51f4-4992-9c8a-f975eaad6b05>Nullable(0)] public class PlantablePickableConfig { public string PlantName; private string _pickableName; private string _prefabName; private string _displayName; private string _description; public RequirementConfig[] Requirements; public int Yield = 3; public float GrowTime = 3000f; public float MinScale = 1f; public float MaxScale = 1.5f; public bool NeedCultivatedGround = true; public Biome AllowedBiomes = (Biome)895; public string PickableName { get { if (string.IsNullOrEmpty(_pickableName)) { return "Pickable_" + PlantName; } return _pickableName; } set { _pickableName = value; } } public string PrefabName { get { if (string.IsNullOrEmpty(_prefabName)) { return "sapling_" + PlantName; } return _prefabName; } set { _prefabName = value; } } public string DisplayName { get { if (string.IsNullOrEmpty(_displayName)) { return PlantName; } return _displayName; } set { _displayName = value; } } public string Description { get { if (string.IsNullOrEmpty(_description)) { return "Plant " + DisplayName; } return _description; } set { _description = value; } } } public static CustomPiece MakePlantablePickable(PlantablePickableConfig cfg) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001b: 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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) try { CustomPiece val = new CustomPiece(cfg.PrefabName, "sapling_carrot", new PieceConfig { PieceTable = "_CultivatorPieceTable", Name = cfg.PlantName, Description = cfg.Description, Icon = PrefabManager.Instance.GetPrefab(cfg.PlantName).GetComponent<ItemDrop>().m_itemData.GetIcon(), Requirements = cfg.Requirements }); Transform val2 = val.PiecePrefab.transform.Find("Visual"); if ((Object)(object)val2 != (Object)null) { Object.DestroyImmediate((Object)(object)((Component)val2).gameObject); } GameObject val3 = Object.Instantiate<GameObject>(PrefabManager.Instance.GetPrefab(cfg.PickableName), val.PiecePrefab.transform); ((Object)val3).name = "Visual"; val3.transform.localPosition = Vector3.zero; val3.transform.localRotation = Quaternion.identity; val3.transform.localScale = Vector3.one * 0.6f; Component[] components = val3.GetComponents<Component>(); foreach (Component val4 in components) { if (!(val4 is Transform) && !(val4 is MeshFilter) && !(val4 is MeshRenderer)) { Object.DestroyImmediate((Object)(object)val4); } } val3.layer = LayerMask.NameToLayer("piece"); string text = "cultivated_" + cfg.PlantName; GameObject val5 = PrefabManager.Instance.CreateClonedPrefab(text, cfg.PickableName); if ((Object)(object)val5 != (Object)null) { Pickable component = val5.GetComponent<Pickable>(); if ((Object)(object)component != (Object)null) { component.m_amount = cfg.Yield; component.m_respawnTimeMinutes = 0f; component.m_hideWhenPicked = null; } PrefabManager.Instance.AddPrefab(val5); } Plant component2 = val.PiecePrefab.GetComponent<Plant>(); if ((Object)(object)component2 != (Object)null) { component2.m_name = cfg.PlantName; component2.m_minScale = cfg.MinScale; component2.m_maxScale = cfg.MaxScale; component2.m_needCultivatedGround = cfg.NeedCultivatedGround; component2.m_growTime = cfg.GrowTime; component2.m_grownPrefabs = null; component2.m_grownPrefabs = (GameObject[])(object)new GameObject[1] { val5 }; } PieceManager.Instance.AddPiece(val); } catch (Exception arg) { ZLog.LogError((object)$"[VRP] Error creating plantable '{cfg?.PlantName}': {arg}"); throw; } return null; } } public static class AssetBundleResolver { [<23ce6907-0295-4e25-921d-3566505f5f9d>NullableContext(1)] public static AssetBundle GetBundle(string key) { return (AssetBundle)(key switch { "bandage" => JotunnPatches.bandage, "ploam" => JotunnPatches.ploam, "mushbundle" => JotunnPatches.mushbundle, "bonefirebundle" => JotunnPatches.bonefirebundle, "vrpbundle" => JotunnPatches.vrpbundle, "valonbundle" => JotunnPatches.valonbundle, "phatbundle" => JotunnPatches.phatbundle, "loraxbundle" => JotunnPatches.loraxbundle, "bronzehelm" => JotunnPatches.bronzehelm, _ => null, }); } } [<23ce6907-0295-4e25-921d-3566505f5f9d>NullableContext(1)] [<5db7413e-51f4-4992-9c8a-f975eaad6b05>Nullable(0)] public static class RecipeHelper { public static void AddCoinExchange(string name, int coinAmount, params string[] trophies) { //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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Expected O, but got Unknown //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown RequirementConfig[] requirements = ((IEnumerable<string>)trophies).Select((Func<string, RequirementConfig>)([<23ce6907-0295-4e25-921d-3566505f5f9d>NullableContext(0)] (string t) => new RequirementConfig { Item = t, Amount = 1 })).ToArray(); CustomRecipe val = new CustomRecipe(new RecipeConfig { Name = name, Item = "Coins", Amount = coinAmount, Requirements = requirements, RequireOnlyOneIngredient = true }); ItemManager.Instance.AddRecipe(val); } public static void addMaterial(AssetBundle bundle, string prefabname) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown try { GameObject val = bundle.LoadAsset<GameObject>(prefabname); if (Object.op_Implicit((Object)(object)val)) { CustomItem val2 = new CustomItem(val, true); ItemManager.Instance.AddItem(val2); if (VRPMod.DebugMode()) { ZLog.Log((object)("vrp added material " + prefabname)); } } else { ZLog.LogWarning((object)("vrp did not find prefab " + prefabname)); } } catch (Exception ex) { Logger.LogError((object)("vrp failed to add item " + prefabname)); Logger.LogError((object)ex); } } public static void addvrpitem(string prefabname, ref AssetBundle ab, ItemConfig ic) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown try { GameObject val = ab.LoadAsset<GameObject>(prefabname); if (Object.op_Implicit((Object)(object)val)) { CustomItem val2 = new CustomItem(val, true, ic); ItemManager.Instance.AddItem(val2); if (VRPMod.DebugMode()) { ZLog.Log((object)("vrp added item " + prefabname)); } } else { ZLog.LogWarning((object)("vrp did not find prefab " + prefabname)); } } catch (Exception ex) { Logger.LogError((object)(prefabname + ex.Message)); } } } } namespace ValheimRoleplay.Data { [<5db7413e-51f4-4992-9c8a-f975eaad6b05>Nullable(0)] [<23ce6907-0295-4e25-921d-3566505f5f9d>NullableContext(1)] public static class PowerData { [Serializable] [<5db7413e-51f4-4992-9c8a-f975eaad6b05>Nullable(0)] public class BeltRecipe { public string SourceSe { get; set; } = ""; public string StartMessage { get; set; } = ""; public string BasePrefabName { get; set; } = ""; public string NewPrefabName { get; set; } = ""; public string Name { get; set; } = ""; public string Description { get; set; } = ""; public string CraftingStation { get; set; } = ""; public int MinStationLevel { get; set; } = 1; public Dictionary<string, int> Requirements { get; set; } = new Dictionary<string, int>(); } public static Dictionary<string, BeltRecipe> PowerBeltConfig = new Dictionary<string, BeltRecipe> { ["BeltModer"] = new BeltRecipe { SourceSe = "GP_Moder", StartMessage = "You feel the wind at your back", BasePrefabName = "BeltStrength", NewPrefabName = "BeltModer", Name = "Sailor Belt", Description = "belt of a seasoned sailor", CraftingStation = "piece_workbench", MinStationLevel = 1, Requirements = new Dictionary<string, int> { ["Coins"] = 2000 } }, ["BeltEikthyr"] = new BeltRecipe { SourceSe = "GP_Eikthyr", StartMessage = "Run bambi run!", BasePrefabName = "BeltStrength", NewPrefabName = "BeltEikthyr", Name = "Running Belt", Description = "belt of running", CraftingStation = "piece_workbench", MinStationLevel = 1, Requirements = new Dictionary<string, int> { ["Coins"] = 5000 } }, ["BeltTheElder"] = new BeltRecipe { SourceSe = "GP_TheElder", StartMessage = "You are a lumberjack and you're okay!", BasePrefabName = "BeltStrength", NewPrefabName = "BeltTheElder", Name = "Lumberjack Belt", Description = "belt of woodcutting", CraftingStation = "piece_workbench", MinStationLevel = 1, Requirements = new Dictionary<string, int> { ["Coins"] = 500 } }, ["BeltBonemass"] = new BeltRecipe { SourceSe = "GP_Bonemass", StartMessage = "Your hide is thick!", BasePrefabName = "BeltStrength", NewPrefabName = "BeltBonemass", Name = "Stoneskin Belt", Description = "belt of stoneskin", CraftingStation = "piece_workbench", MinStationLevel = 1, Requirements = new Dictionary<string, int> { ["Coins"] = 9999 } }, ["BeltWisp"] = new BeltRecipe { SourceSe = "Demister", StartMessage = "You can see through the darkness", BasePrefabName = "BeltStrength", NewPrefabName = "BeltWisp", Name = "Sweat Belt", Description = "Wisplight belt", CraftingStation = "piece_workbench", MinStationLevel = 1, Requirements = new Dictionary<string, int> { ["Coins"] = 9999 } }, ["BeltSweat"] = new BeltRecipe { SourceSe = "Encumbered", StartMessage = "You smell awful", BasePrefabName = "BeltStrength", NewPrefabName = "BeltSweat", Name = "Sweat Belt", Description = "You are so sweaty", CraftingStation = "piece_workbench", MinStationLevel = 1, Requirements = new Dictionary<string, int> { ["Coins"] = 50 } } }; } } namespace ValheimRoleplay.Patches { [<5db7413e-51f4-4992-9c8a-f975eaad6b05>Nullable(0)] [<23ce6907-0295-4e25-921d-3566505f5f9d>NullableContext(1)] public static class PlantData { public static readonly Dictionary<string, string> PlantAnywhere = new Dictionary<string, string> { { "sapling_flax", "Flax" }, { "sapling_barley", "Barley" }, { "sapling_jotunpuffs", "Jotunpuffs" }, { "sapling_magecap", "Magecap" } }; public static readonly List<PlantableHelper.PlantablePickableConfig> PickablePlantConfigs = new List<PlantableHelper.PlantablePickableConfig> { new PlantableHelper.PlantablePickableConfig { PlantName = "Mushroom", PickableName = "Pickable_Mushroom", PrefabName = "sapling_mushroom_r", DisplayName = "Mushroom", Description = "Grow mushrooms with this quick trick!", Requirements = (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig { Item = "Mushroom", Amount = 2 }, new RequirementConfig { Item = "BoneFragments", Amount = 1 } } }, new PlantableHelper.PlantablePickableConfig { PlantName = "MushroomYellow", PickableName = "Pickable_Mushroom_yellow", PrefabName = "sapling_mushroom_y", DisplayName = "Yellow Mushroom", Description = "Grow yellow mushrooms", Requirements = (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig { Item = "Mushroom", Amount = 2 }, new RequirementConfig { Item = "BoneFragments", Amount = 1 } } }, new PlantableHelper.PlantablePickableConfig { PlantName = "MushroomBlue", PickableName = "Pickable_Mushroom_blue", PrefabName = "sapling_mushroom_blue", DisplayName = "Blue Mushroom", Description = "Grow blue mushrooms", Requirements = (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig { Item = "MushroomBlue", Amount = 2 }, new RequirementConfig { Item = "BoneFragments", Amount = 1 } } }, new PlantableHelper.PlantablePickableConfig { PlantName = "MushroomPink", PickableName = "Pickable_Mushroom_pink", PrefabName = "sapling_mushroom_pink", DisplayName = "Pink Mushroom", Description = "Grow Pink mushrooms", Requirements = (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig { Item = "MushroomPink", Amount = 2 }, new RequirementConfig { Item = "BoneFragments", Amount = 1 } } }, new PlantableHelper.PlantablePickableConfig { PlantName = "MushroomGreen", PickableName = "Pickable_Mushroom_green", PrefabName = "sapling_mushroom_green", DisplayName = "Green Mushroom", Description = "Grow green mushrooms", Requirements = (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig { Item = "MushroomGreen", Amount = 2 }, new RequirementConfig { Item = "BoneFragments", Amount = 1 } } }, new PlantableHelper.PlantablePickableConfig { PlantName = "MushroomPurple", PickableName = "Pickable_Mushroom_purple", PrefabName = "sapling_mushroom_purple", DisplayName = "Purple Mushroom", Description = "Grow purple mushrooms", Requirements = (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig { Item = "MushroomPurple", Amount = 2 }, new RequirementConfig { Item = "BoneFragments", Amount = 1 } } }, new PlantableHelper.PlantablePickableConfig { PlantName = "MushroomBlack", PickableName = "Pickable_Mushroom_black", PrefabName = "sapling_mushroom_black", DisplayName = "Black Mushroom", Description = "Grow black mushrooms", Requirements = (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig { Item = "MushroomBlue", Amount = 2 }, new RequirementConfig { Item = "BoneFragments", Amount = 1 } } }, new PlantableHelper.PlantablePickableConfig { PlantName = "Thistle", PickableName = "Pickable_Thistle", PrefabName = "sapling_thistle", DisplayName = "Thistle", Description = "Grow thistle with this quick trick!", Requirements = (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig { Item = "Thistle", Amount = 2 }, new RequirementConfig { Item = "BoneFragments", Amount = 1 } } }, new PlantableHelper.PlantablePickableConfig { PlantName = "StoneRock", PickableName = "Pickable_StoneRock", PrefabName = "sapling_stonerock", DisplayName = "Rock", Description = "Everyone enjoys a happy rock garden!", Requirements = (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig { Item = "Stone", Amount = 20 } }, Yield = 1 }, new PlantableHelper.PlantablePickableConfig { PlantName = "Dandelion", PickableName = "Pickable_Dandelion", PrefabName = "sapling_dandelion", DisplayName = "Dandelion", Description = "Grow dandelion", Requirements = (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig { Item = "Dandelion", Amount = 2 }, new RequirementConfig { Item = "BoneFragments", Amount = 1 } } }, new PlantableHelper.PlantablePickableConfig { PlantName = "Mums", PickableName = "Pickable_mums", PrefabName = "sapling_mums", DisplayName = "Mums", Description = "Grow mums", Requirements = (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig { Item = "Mums", Amount = 2 }, new RequirementConfig { Item = "BoneFragments", Amount = 1 } } }, new PlantableHelper.PlantablePickableConfig { PlantName = "Edelweiss", PickableName = "Pickable_edelweiss", PrefabName = "sapling_edelweiss", DisplayName = "Edelweiss", Description = "Grow Edelweiss", Requirements = (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig { Item = "Edelweiss", Amount = 2 }, new RequirementConfig { Item = "BoneFragments", Amount = 1 } } }, new PlantableHelper.PlantablePickableConfig { PlantName = "Scabiosa", PickableName = "Pickable_scabiosa", PrefabName = "sapling_scabiosa", DisplayName = "Scabiosa", Description = "Grow Scabiosa", Requirements = (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig { Item = "Scabiosa", Amount = 2 }, new RequirementConfig { Item = "BoneFragments", Amount = 1 } } }, new PlantableHelper.PlantablePickableConfig { PlantName = "Fiddleheadfern", PickableName = "Pickable_Fiddlehead", PrefabName = "sapling_fiddlehead", DisplayName = "Fiddlehead", Description = "Grow fiddlehead with this quick trick!", Requirements = (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig { Item = "Fiddleheadfern", Amount = 2 }, new RequirementConfig { Item = "BoneFragments", Amount = 1 } } } }; } [<5db7413e-51f4-4992-9c8a-f975eaad6b05>Nullable(0)] [<23ce6907-0295-4e25-921d-3566505f5f9d>NullableContext(1)] public static class RecipeData { [<5db7413e-51f4-4992-9c8a-f975eaad6b05>Nullable(0)] public class SimpleRecipe { public string Item { get; set; } public int Amount { get; set; } public string CraftingStation { get; set; } = string.Empty; public Dictionary<string, int> Requirements { get; set; } } [<5db7413e-51f4-4992-9c8a-f975eaad6b05>Nullable(0)] public class ComplexRecipe { public string Item { get; set; } public int Amount { get; set; } = 1; public string CraftingStation { get; set; } = string.Empty; public int StationLevel { get; set; } = 1; [<5db7413e-51f4-4992-9c8a-f975eaad6b05>Nullable(new byte[] { 1, 1, 0 })] [field: <5db7413e-51f4-4992-9c8a-f975eaad6b05>Nullable(new byte[] { 1, 1, 0 })] public Dictionary<string, (int baseAmount, int perLevel)> Requirements { [return: <5db7413e-51f4-4992-9c8a-f975eaad6b05>Nullable(new byte[] { 1, 1, 0 })] get; [param: <5db7413e-51f4-4992-9c8a-f975eaad6b05>Nullable(new byte[] { 1, 1, 0 })] set; } public string BundleKey { get; set; } } public static readonly Dictionary<int, string> TrophyConversion = new Dictionary<int, string> { { 2, "TrophyBoar,TrophyNeck" }, { 5, "TrophyDeer,TrophyGreydwarf,TrophySkeleton" }, { 10, "TrophyHare,TrophyDvergr,TrophyEikthyr,TrophyGreydwarfBrute,TrophyGreydwarfShaman,TrophySkeletonPoison,TrophyBlob,TrophyDraugr,TrophySurtling,TrophyLeech,TrophyWolf" }, { 20, "TrophyForestTroll,TrophyFrostTroll,TrophyTheElder,TrophySkeletonHildir,TrophyDraugrElite,TrophySerpent,TrophyHatchling,TrophyUlv,TrophyFenring,TrophyLox" }, { 30, "TrophyWraith,TrophyBonemass,TrophyCultist,TrophyGoblin" }, { 40, "TrophyCultist_Hildir,TrophySGolem,TrophyDragonQueen,TrophyGrowth,TrophyGoblinShaman,TrophyDeathsquito,TrophyGoblinBrute,TrophySeeker,TrophyAsksvin" }, { 50, "TrophyGoblinBruteBrosBrute,TrophyGoblinBruteBrosShaman,TrophyGoblinKing,TrophyTick,TrophySeekerBrute,TrophyGjall,TrophyCharredArcher,TrophyCharredMage,TrophyCharredMelee" }, { 60, "TrophySeekerQueen,TrophyMorgen,TrophyFallenValkyrie,TrophyFader" } }; public static readonly Dictionary<string, SimpleRecipe> MerchantRecipes = new Dictionary<string, SimpleRecipe> { ["vrp_merchantb0"] = new SimpleRecipe { Item = "Coins", Amount = 50, Requirements = new Dictionary<string, int> { ["AmberPearl"] = 5 } }, ["vrp_merchantb1"] = new SimpleRecipe { Item = "Coins", Amount = 100, Requirements = new Dictionary<string, int> { ["Ruby"] = 5 } }, ["vrp_merchantb3"] = new SimpleRecipe { Item = "Coins", Amount = 25, Requirements = new Dictionary<string, int> { ["Amber"] = 5 } }, ["vrp_merchantb4"] = new SimpleRecipe { Item = "Coins", Amount = 50, Requirements = new Dictionary<string, int> { ["SilverNecklace"] = 1 } }, ["vrp_merchantbb0"] = new SimpleRecipe { Item = "AmberPearl", Amount = 5, Requirements = new Dictionary<string, int> { ["Coins"] = 50 } }, ["vrp_merchantbb1"] = new SimpleRecipe { Item = "Ruby", Amount = 5, Requirements = new Dictionary<string, int> { ["Coins"] = 100 } }, ["vrp_merchantbb3"] = new SimpleRecipe { Item = "Amber", Amount = 5, Requirements = new Dictionary<string, int> { ["Coins"] = 25 } }, ["vrp_merchant9"] = new SimpleRecipe { Item = "FishingBait", Amount = 20, Requirements = new Dictionary<string, int> { ["Coins"] = 10 } }, ["vrp_merchant10"] = new SimpleRecipe { Item = "FishingRod", Amount = 1, Requirements = new Dictionary<string, int> { ["Coins"] = 350 } }, ["vrp_merchant11"] = new SimpleRecipe { Item = "HelmetYule", Amount = 1, Requirements = new Dictionary<string, int> { ["Coins"] = 100 } }, ["vrp_merchant12"] = new SimpleRecipe { Item = "BeltStrength", Amount = 1, Requirements = new Dictionary<string, int> { ["Coins"] = 950 } }, ["vrp_merchant13"] = new SimpleRecipe { Item = "HelmetDverger", Amount = 1, Requirements = new Dictionary<string, int> { ["Coins"] = 950 } }, ["vrp_merchant14"] = new SimpleRecipe { Item = "Thunderstone", Amount = 1, Requirements = new Dictionary<string, int> { ["Coins"] = 100 } }, ["vrp_merchant15"] = new SimpleRecipe { Item = "YmirRemains", Amount = 1, Requirements = new Dictionary<string, int> { ["Coins"] = 300 } }, ["vrp_merchant17"] = new SimpleRecipe { Item = "Floam", Amount = 10, Requirements = new Dictionary<string, int> { ["Coins"] = 20 } }, ["vrp_merchant170"] = new SimpleRecipe { Item = "Gloam", Amount = 1, Requirements = new Dictionary<string, int> { ["Coins"] = 100 } }, ["vrp_merchant171"] = new SimpleRecipe { Item = "Guck", Amount = 1, Requirements = new Dictionary<string, int> { ["Coins"] = 20 } }, ["vrp_merchant18"] = new SimpleRecipe { Item = "Crystal", Amount = 1, Requirements = new Dictionary<string, int> { ["Coins"] = 25 } }, ["vrp_merchant19"] = new SimpleRecipe { Item = "Tar", Amount = 1, Requirements = new Dictionary<string, int> { ["Coins"] = 25 } } }; public static readonly Dictionary<string, SimpleRecipe> MakeItCraftableRecipes = new Dictionary<string, SimpleRecipe> { ["vrp_barbkit"] = new SimpleRecipe { Item = "BarberKit", Amount = 1, CraftingStation = "piece_workbench", Requirements = new Dictionary<string, int> { ["Tin"] = 5, ["Amber"] = 10, ["DeerHide"] = 5, ["Feathers"] = 50 } }, ["vrp_ironpit"] = new SimpleRecipe { Item = "Ironpit", Amount = 1, CraftingStation = "forge", Requirements = new Dictionary<string, int> { ["Iron"] = 10 } }, ["vrp_firework"] = new SimpleRecipe { Item = "FireworksRocket_White", Amount = 1, CraftingStation = "piece_workbench", Requirements = new Dictionary<string, int> { ["Coins"] = 25 } }, ["vrp_sparkler"] = new SimpleRecipe { Item = "Sparkler", Amount = 1, CraftingStation = "piece_workbench", Requirements = new Dictionary<string, int> { ["Coins"] = 25 } }, ["vrp_hat5"] = new SimpleRecipe { Item = "HelmetHat5", Amount = 1, CraftingStation = "piece_workbench", Requirements = new Dictionary<string, int> { ["DeerHide"] = 6, ["Raspberry"] = 2 } }, ["vrp_hat10"] = new SimpleRecipe { Item = "HelmetHat10", Amount = 1, CraftingStation = "piece_workbench", Requirements = new Dictionary<string, int> { ["DeerHide"] = 6, ["Mums"] = 2 } }, ["vrp_hat1"] = new SimpleRecipe { Item = "HelmetHat1", Amount = 1, CraftingStation = "piece_workbench", Requirements = new Dictionary<string, int> { ["DeerHide"] = 6, ["Blueberries"] = 2 } }, ["vrp_hat6"] = new SimpleRecipe { Item = "HelmetHat6", Amount = 1, CraftingStation = "piece_workbench", Requirements = new Dictionary<string, int> { ["DeerHide"] = 6, ["Dandelion"] = 2 } }, ["vrp_hat2"] = new SimpleRecipe { Item = "HelmetHat2", Amount = 1, CraftingStation = "piece_workbench", Requirements = new Dictionary<string, int> { ["DeerHide"] = 6, ["Pukeberries"] = 2 } }, ["vrp_hat7"] = new SimpleRecipe { Item = "HelmetHat7", Amount = 1, CraftingStation = "piece_workbench", Requirements = new Dictionary<string, int> { ["DeerHide"] = 6, ["Bloodbag"] = 2 } }, ["vrp_hat3"] = new SimpleRecipe { Item = "HelmetHat3", Amount = 1, CraftingStation = "piece_workbench", Requirements = new Dictionary<string, int> { ["DeerHide"] = 6, ["WolfPelt"] = 1 } }, ["vrp_hat8"] = new SimpleRecipe { Item = "HelmetHat8", Amount = 1, CraftingStation = "piece_workbench", Requirements = new Dictionary<string, int> { ["DeerHide"] = 6, ["WolfPelt"] = 1 } }, ["vrp_hat4"] = new SimpleRecipe { Item = "HelmetHat4", Amount = 1, CraftingStation = "piece_workbench", Requirements = new Dictionary<string, int> { ["DeerHide"] = 6, ["BlackMetalScrap"] = 1 } }, ["vrp_hat9"] = new SimpleRecipe { Item = "HelmetHat9", Amount = 1, CraftingStation = "piece_workbench", Requirements = new Dictionary<string, int> { ["DeerHide"] = 6, ["Bilebag"] = 1 } }, ["vrp_tunic1"] = new SimpleRecipe { Item = "ArmorTunic1", Amount = 1, CraftingStation = "piece_workbench", Requirements = new Dictionary<string, int> { ["DeerHide"] = 8, ["Blueberries"] = 5 } }, ["vrp_tunic10"] = new SimpleRecipe { Item = "ArmorTunic10", Amount = 1, CraftingStation = "piece_workbench", Requirements = new Dictionary<string, int> { ["DeerHide"] = 8, ["LeatherScraps"] = 5 } }, ["vrp_tunic4"] = new SimpleRecipe { Item = "ArmorTunic4", Amount = 1, CraftingStation = "piece_workbench", Requirements = new Dictionary<string, int> { ["DeerHide"] = 8, ["Raspberry"] = 5 } }, ["vrp_tunic7"] = new SimpleRecipe { Item = "ArmorTunic7", Amount = 1, CraftingStation = "piece_workbench", Requirements = new Dictionary<string, int> { ["DeerHide"] = 8, ["Dandelion"] = 5 } }, ["vrp_tunic2"] = new SimpleRecipe { Item = "ArmorTunic2", Amount = 1, CraftingStation = "piece_workbench", Requirements = new Dictionary<string, int> { ["DeerHide"] = 8, ["Blueberries"] = 5, ["Chitin"] = 5 } }, ["vrp_tunic5"] = new SimpleRecipe { Item = "ArmorTunic5", Amount = 1, CraftingStation = "piece_workbench", Requirements = new Dictionary<string, int> { ["DeerHide"] = 8, ["Raspberry"] = 5, ["Chitin"] = 5 } }, ["vrp_tunic8"] = new SimpleRecipe { Item = "ArmorTunic8", Amount = 1, CraftingStation = "piece_workbench", Requirements = new Dictionary<string, int> { ["DeerHide"] = 8, ["Dandelion"] = 5, ["Chitin"] = 5 } }, ["vrp_tunic3"] = new SimpleRecipe { Item = "ArmorTunic3", Amount = 1, CraftingStation = "piece_workbench", Requirements = new Dictionary<string, int> { ["DeerHide"] = 8, ["Blueberries"] = 5, ["Silver"] = 2 } }, ["vrp_tunic6"] = new SimpleRecipe { Item = "ArmorTunic6", Amount = 1, CraftingStation = "piece_workbench", Requirements = new Dictionary<string, int> { ["DeerHide"] = 8, ["Raspberry"] = 5, ["Silver"] = 2 } }, ["vrp_tunic9"] = new SimpleRecipe { Item = "ArmorTunic9", Amount = 1, CraftingStation = "piece_workbench", Requirements = new Dictionary<string, int> { ["DeerHide"] = 8, ["Dandelion"] = 5, ["Silver"] = 2 } }, ["vrp_dress1"] = new SimpleRecipe { Item = "ArmorDress1", Amount = 1, CraftingStation = "piece_workbench", Requirements = new Dictionary<string, int> { ["DeerHide"] = 8, ["Blueberries"] = 5 } }, ["vrp_dress10"] = new SimpleRecipe { Item = "ArmorDress10", Amount = 1, CraftingStation = "piece_workbench", Requirements = new Dictionary<string, int> { ["DeerHide"] = 8, ["LeatherScraps"] = 5 } }, ["vrp_dress4"] = new SimpleRecipe { Item = "ArmorDress4", Amount = 1, CraftingStation = "piece_workbench", Requirements = new Dictionary<string, int> { ["DeerHide"] = 8, ["Raspberry"] = 5 } }, ["vrp_dress7"] = new SimpleRecipe { Item = "ArmorDress7", Amount = 1, CraftingStation = "piece_workbench", Requirements = new Dictionary<string, int> { ["DeerHide"] = 8, ["Dandelion"] = 5 } }, ["vrp_dress2"] = new SimpleRecipe { Item = "ArmorDress2", Amount = 1, CraftingStation = "piece_workbench", Requirements = new Dictionary<string, int> { ["DeerHide"] = 8, ["Blueberries"] = 5, ["Chitin"] = 5 } }, ["vrp_dress5"] = new SimpleRecipe { Item = "ArmorDress5", Amount = 1, CraftingStation = "piece_workbench", Requirements = new Dictionary<string, int> { ["DeerHide"] = 8, ["Raspberry"] = 5, ["Chitin"] = 5 } }, ["vrp_dress8"] = new SimpleRecipe { Item = "ArmorDress8", Amount = 1, CraftingStation = "piece_workbench", Requirements = new Dictionary<string, int> { ["DeerHide"] = 8, ["Dandelion"] = 5, ["Chitin"] = 5 } }, ["vrp_dress3"] = new SimpleRecipe { Item = "ArmorDress3", Amount = 1, CraftingStation = "piece_workbench", Requirements = new Dictionary<string, int> { ["DeerHide"] = 8, ["Blueberries"] = 5, ["Silver"] = 2 } }, ["vrp_dress6"] = new SimpleRecipe { Item = "ArmorDress6", Amount = 1, CraftingStation = "piece_workbench", Requirements = new Dictionary<string, int> { ["DeerHide"] = 8, ["Raspberry"] = 5, ["Silver"] = 2 } }, ["vrp_dress9"] = new SimpleRecipe { Item = "ArmorDress9", Amount = 1, CraftingStation = "piece_workbench", Requirements = new Dictionary<string, int> { ["DeerHide"] = 8, ["Dandelion"] = 5, ["Silver"] = 2 } }, ["vrp_strawhat"] = new SimpleRecipe { Item = "HelmetStrawHat", Amount = 1, CraftingStation = "piece_workbench", Requirements = new Dictionary<string, int> { ["LeatherScraps"] = 2, ["CarrotSeeds"] = 5 } }, ["vrp_strawtunic"] = new SimpleRecipe { Item = "ArmorHarvester1", Amount = 1, CraftingStation = "piece_workbench", Requirements = new Dictionary<string, int> { ["LeatherScraps"] = 2, ["CarrotSeeds"] = 5 } }, ["vrp_strawdress"] = new SimpleRecipe { Item = "ArmorHarvester2", Amount = 1, CraftingStation = "piece_workbench", Requirements = new Dictionary<string, int> { ["LeatherScraps"] = 2, ["CarrotSeeds"] = 5 } }, ["vrp_curedsquirrelhamstring"] = new SimpleRecipe { Item = "CuredSquirrelHamstring", Amount = 1, CraftingStation = "piece_cauldron", Requirements = new Dictionary<string, int> { ["RawMeat"] = 3, ["Dandelion"] = 1 } }, ["vrp_feaster"] = new SimpleRecipe { Item = "Feaster", Amount = 1, CraftingStation = "piece_workbench", Requirements = new Dictionary<string, int> { ["Wood"] = 10, ["Resin"] = 5 } }, ["vrp_barrelrings"] = new SimpleRecipe { Item = "BarrelRings", Amount = 3, CraftingStation = "", Requirements = new Dictionary<string, int> { ["Coins"] = 150 } }, ["vrp_candlewick"] = new SimpleRecipe { Item = "CandleWick", Amount = 1, CraftingStation = "", Requirements = new Dictionary<string, int> { ["Honey"] = 2, ["Resin"] = 5 } }, ["vrp_powdereddragonegg"] = new SimpleRecipe { Item = "PowderedDragonEgg", Amount = 5, CraftingStation = "piece_preptable", Requirements = new Dictionary<string, int> { ["DragonEgg"] = 1, ["Obsidian"] = 10 } }, ["vrp_pungentpebbles"] = new SimpleRecipe { Item = "PungentPebbles", Amount = 5, CraftingStation = "piece_cauldron", Requirements = new Dictionary<string, int> { ["GreydwarfEye"] = 5, ["Pukeberries"] = 3 } }, ["vrp_scythehandle"] = new SimpleRecipe { Item = "ScytheHandle", Amount = 1, CraftingStation = "piece_workbench", Requirements = new Dictionary<string, int> { ["LeatherScraps"] = 5, ["ElderBark"] = 10 } }, ["vrp_fragrantbundle"] = new SimpleRecipe { Item = "FragrantBundle", Amount = 5, CraftingStation = "piece_preptable", Requirements = new Dictionary<string, int> { ["Mums"] = 3, ["Dandelion"] = 3, ["Cloudberry"] = 3 } }, ["vrp_freshseaweed"] = new SimpleRecipe { Item = "FreshSeaweed", Amount = 5, CraftingStation = "piece_cauldron", Requirements = new Dictionary<string, int> { ["Thistle"] = 5, ["BoneFragments"] = 3 } }, ["vrp_mushroombzerker"] = new SimpleRecipe { Item = "MushroomBzerker", Amount = 5, CraftingStation = "piece_cauldron", Requirements = new Dictionary<string, int> { ["MushroomBlue"] = 5, ["MushroomBlood"] = 5 } }, ["vrp_spicemistlands"] = new SimpleRecipe { Item = "SpiceMistlands", Amount = 5, CraftingStation = "piece_preptable", Requirements = new Dictionary<string, int> { ["Dandelion"] = 10, ["MushroomMagecap"] = 5 } }, ["vrp_spicemountains"] = new SimpleRecipe { Item = "SpiceMountains", Amount = 5, CraftingStation = "piece_preptable", Requirements = new Dictionary<string, int> { ["FreezeGland"] = 3, ["Edelweiss"] = 5 } }, ["vrp_spiceoceans"] = new SimpleRecipe { Item = "SpiceOceans", Amount = 5, CraftingStation = "piece_preptable", Requirements = new Dictionary<string, int> { ["SerpentScale"] = 5, ["Thistle"] = 5 } }, ["vrp_spiceplains"] = new SimpleRecipe { Item = "SpicePlains", Amount = 5, CraftingStation = "piece_preptable", Requirements = new Dictionary<string, int> { ["Cloudberry"] = 10, ["Scabiosa"] = 5 } }, ["vrp_vinegreenseeds"] = new SimpleRecipe { Item = "VineGreenSeeds", Amount = 10, CraftingStation = "", Requirements = new Dictionary<string, int> { ["Coins"] = 100 } }, ["vrp_spiceashlands"] = new SimpleRecipe { Item = "SpiceAshlands", Amount = 5, CraftingStation = "piece_preptable", Requirements = new Dictionary<string, int> { ["MushroomSmokePuff"] = 10, ["Barley"] = 5 } }, ["vrp_spiceforests"] = new SimpleRecipe { Item = "SpiceForests", Amount = 5, CraftingStation = "piece_preptable", Requirements = new Dictionary<string, int> { ["MushroomYellow"] = 10, ["Dandelion"] = 10 } }, ["vrp_chains"] = new SimpleRecipe { Item = "Chain", Amount = 1, CraftingStation = "forge", Requirements = new Dictionary<string, int> { ["Iron"] = 5 } }, ["vrp_charcoalresin"] = new SimpleRecipe { Item = "CharcoalResin", Amount = 1, CraftingStation = "", Requirements = new Dictionary<string, int> { ["Coal"] = 3, ["Resin"] = 3 } }, ["vrp_potshard"] = new SimpleRecipe { Item = "Pot_Shard_Green", Amount = 1, CraftingStation = "piece_workbench", Requirements = new Dictionary<string, int> { ["Flint"] = 5, ["Stone"] = 5, ["Floam"] = 5 } } }; public static readonly Dictionary<string, ComplexRecipe> VRP_Armor = new Dictionary<string, ComplexRecipe> { ["LeatherChestRed"] = new ComplexRecipe { Item = "LeatherChestRed", Amount = 1, CraftingStation = "piece_workbench", StationLevel = 1, BundleKey = "vrpbundle", Requirements = new Dictionary<string, (int, int)> { ["DeerHide"] = (6, 10), ["BoneFragments"] = (0, 10) } }, ["LeatherChestGreen"] = new ComplexRecipe { Item = "LeatherChestGreen", Amount = 1, CraftingStation = "piece_workbench", StationLevel = 1, BundleKey = "vrpbundle", Requirements = new Dictionary<string, (int, int)> { ["DeerHide"] = (6, 10), ["BoneFragments"] = (0, 10) } }, ["LeatherChestBlue"] = new ComplexRecipe { Item = "LeatherChestBlue", Amount = 1, CraftingStation = "piece_workbench", StationLevel = 1, BundleKey = "vrpbundle", Requirements = new Dictionary<string, (int, int)> { ["DeerHide"] = (6, 10), ["BoneFragments"] = (0, 10) } }, ["LeatherTrousersRed"] = new ComplexRecipe { Item = "LeatherTrousersRed", Amount = 1, CraftingStation = "piece_workbench", StationLevel = 1, BundleKey = "vrpbundle", Requirements = new Dictionary<string, (int, int)> { ["DeerHide"] = (6, 10), ["BoneFragments"] = (0, 10) } }, ["LeatherTrousersGreen"] = new ComplexRecipe { Item = "LeatherTrousersGreen", Amount = 1, CraftingStation = "piece_workbench", StationLevel = 1, BundleKey = "vrpbundle", Requirements = new Dictionary<string, (int, int)> { ["DeerHide"] = (6, 10), ["BoneFragments"] = (0, 10) } }, ["LeatherTrousersBlue"] = new ComplexRecipe { Item = "LeatherTrousersBlue", Amount = 1, CraftingStation = "piece_workbench", StationLevel = 1, BundleKey = "vrpbundle", Requirements = new Dictionary<string, (int, int)> { ["DeerHide"] = (6, 10), ["BoneFragments"] = (0, 10) } }, ["LeatherHelmRed"] = new ComplexRecipe { Item = "LeatherHelmRed", Amount = 1, CraftingStation = "piece_workbench", StationLevel = 1, BundleKey = "vrpbundle", Requirements = new Dictionary<string, (int, int)> { ["DeerHide"] = (6, 10), ["BoneFragments"] = (0, 10) } }, ["LeatherHelmBlue"] = new ComplexRecipe { Item = "LeatherHelmBlue", Amount = 1, CraftingStation = "piece_workbench", StationLevel = 1, BundleKey = "vrpbundle", Requirements = new Dictionary<string, (int, int)> { ["DeerHide"] = (6, 10), ["BoneFragments"] = (0, 10) } }, ["LeatherHelmGreen"] = new ComplexRecipe { Item = "LeatherHelmGreen", Amount = 1, CraftingStation = "piece_workbench", StationLevel = 1, BundleKey = "vrpbundle", Requirements = new Dictionary<string, (int, int)> { ["DeerHide"] = (6, 10), ["BoneFragments"] = (0, 10) } }, ["TrollChestBlack"] = new ComplexRecipe { Item = "TrollChestBlack", Amount = 1, CraftingStation = "piece_workbench", StationLevel = 2, BundleKey = "vrpbundle", Requirements = new Dictionary<string, (int, int)> { ["TrollHide"] = (5, 5), ["BoneFragments"] = (2, 5) } }, ["TrollChestBrown"] = new ComplexRecipe { Item = "TrollChestBrown", Amount = 1, CraftingStation = "piece_workbench", StationLevel = 2, BundleKey = "vrpbundle", Requirements = new Dictionary<string, (int, int)> { ["TrollHide"] = (5, 5), ["BoneFragments"] = (2, 5) } }, ["TrollChestWhite"] = new ComplexRecipe { Item = "TrollChestWhite", Amount = 1, CraftingStation = "piece_workbench", StationLevel = 2, BundleKey = "vrpbundle", Requirements = new Dictionary<string, (int, int)> { ["TrollHide"] = (5, 5), ["BoneFragments"] = (2, 5) } }, ["TrollHoodBlack"] = new ComplexRecipe { Item = "TrollHoodBlack", Amount = 1, CraftingStation = "piece_workbench", StationLevel = 2, BundleKey = "vrpbundle", Requirements = new Dictionary<string, (int, int)> { ["TrollHide"] = (5, 5), ["BoneFragments"] = (2, 5) } }, ["TrollHoodBrown"] = new ComplexRecipe { Item = "TrollHoodBrown", Amount = 1, CraftingStation = "piece_workbench", StationLevel = 2, BundleKey = "vrpbundle", Requirements = new Dictionary<string, (int, int)> { ["TrollHide"] = (5, 5), ["BoneFragments"] = (2, 5) } }, ["TrollHoodWhite"] = new ComplexRecipe { Item = "TrollHoodWhite", Amount = 1, CraftingStation = "piece_workbench", StationLevel = 2, BundleKey = "vrpbundle", Requirements = new Dictionary<string, (int, int)> { ["TrollHide"] = (5, 5), ["BoneFragments"] = (2, 5) } }, ["TrollLegsBlack"] = new ComplexRecipe { Item = "TrollLegsBlack", Amount = 1, CraftingStation = "piece_workbench", StationLevel = 2, BundleKey = "vrpbundle", Requirements = new Dictionary<string, (int, int)> { ["TrollHide"] = (5, 5), ["BoneFragments"] = (2, 5) } }, ["TrollLegsBrown"] = new ComplexRecipe { Item = "TrollLegsBrown", Amount = 1, CraftingStation = "piece_workbench", StationLevel = 2, BundleKey = "vrpbundle", Requirements = new Dictionary<string, (int, int)> { ["TrollHide"] = (5, 5), ["BoneFragments"] = (2, 5) } }, ["TrollLegsWhite"] = new ComplexRecipe { Item = "TrollLegsWhite", Amount = 1, CraftingStation = "piece_workbench", StationLevel = 2, BundleKey = "vrpbundle", Requirements = new Dictionary<string, (int, int)> { ["TrollHide"] = (5, 5), ["BoneFragments"] = (2, 5) } }, ["BronzeHelmRed"] = new ComplexRecipe { Item = "BronzeHelmRed", Amount = 1, CraftingStation = "forge", StationLevel = 1, BundleKey = "bronzehelm", Requirements = new Dictionary<string, (int, int)> { ["Bronze"] = (5, 2), ["DeerHide"] = (2, 2), ["LeatherScraps"] = (2, 2), ["Crystal"] = (1, 0) } }, ["BronzeHelmGreen"] = new ComplexRecipe { Item = "BronzeHelmGreen", Amount = 1, CraftingStation = "forge", StationLevel = 1, BundleKey = "bronzehelm", Requirements = new Dictionary<string, (int, int)> { ["Bronze"] = (5, 2), ["DeerHide"] = (2, 2), ["LeatherScraps"] = (2, 2), ["Crystal"] = (1, 0) } }, ["BronzeHelmBlue"] = new ComplexRecipe { Item = "BronzeHelmBlue", Amount = 1, CraftingStation = "forge", StationLevel = 1, BundleKey = "bronzehelm", Requirements = new Dictionary<string, (int, int)> { ["Bronze"] = (5, 2), ["DeerHide"] = (2, 2), ["LeatherScraps"] = (2, 2), ["Crystal"] = (1, 0) } }, ["BWspiritChest"] = new ComplexRecipe { Item = "BWspiritChest", Amount = 1, CraftingStation = "piece_workbench", StationLevel = 99, BundleKey = "vrpbundle", Requirements = new Dictionary<string, (int, int)> { ["SledgeCheat"] = (1, 0) } }, ["BWspiritLegs"] = new ComplexRecipe { Item = "BWspiritLegs", Amount = 1, CraftingStation = "piece_workbench", StationLevel = 99, BundleKey = "vrpbundle", Requirements = new Dictionary<string, (int, int)> { ["SledgeCheat"] = (1, 0) } }, ["BWspiritHood"] = new ComplexRecipe { Item = "BWspiritHood", Amount = 1, CraftingStation = "piece_workbench", StationLevel = 99, BundleKey = "vrpbundle", Requirements = new Dictionary<string, (int, int)> { ["SledgeCheat"] = (1, 0) } }, ["GoldSpiritChest"] = new ComplexRecipe { Item = "GoldSpiritChest", Amount = 1, CraftingStation = "piece_workbench", StationLevel = 99, BundleKey = "vrpbundle", Requirements = new Dictionary<string, (int, int)> { ["SledgeCheat"] = (1, 0) } }, ["GoldSpiritLegs"] = new ComplexRecipe { Item = "GoldSpiritLegs", Amount = 1, CraftingStation = "piece_workbench", StationLevel = 99, BundleKey = "vrpbundle", Requirements = new Dictionary<string, (int, int)> { ["SledgeCheat"] = (1, 0) } }, ["GoldSpiritHelm"] = new ComplexRecipe { Item = "GoldSpiritHelm", Amount = 1, CraftingStation = "piece_workbench", StationLevel = 99, BundleKey = "vrpbundle", Requirements = new Dictionary<string, (int, int)> { ["SledgeCheat"] = (1, 0) } }, ["RedSpiritChest"] = new ComplexRecipe { Item = "RedSpiritChest", Amount = 1, CraftingStation = "piece_workbench", StationLevel = 99, BundleKey = "vrpbundle", Requirements = new Dictionary<string, (int, int)> { ["SledgeCheat"] = (1, 0) } }, ["RedSpiritLegs"] = new ComplexRecipe { Item = "RedSpiritLegs", Amount = 1, CraftingStation = "piece_workbench", StationLevel = 99, BundleKey = "vrpbundle", Requirements = new Dictionary<string, (int, int)> { ["SledgeCheat"] = (1, 0) } }, ["RedSpiritHelm"] = new ComplexRecipe { Item = "RedSpiritHelm", Amount = 1, CraftingStation = "piece_workbench", StationLevel = 99, BundleKey = "vrpbundle", Requirements = new Dictionary<string, (int, int)> { ["SledgeCheat"] = (1, 0) } }, ["WarSpiritChest"] = new ComplexRecipe { Item = "WarSpiritChest", Amount = 1, CraftingStation = "piece_workbench", StationLevel = 99, BundleKey = "vrpbundle", Requirements = new Dictionary<string, (int, int)> { ["SledgeCheat"] = (1, 0) } }, ["WarSpiritHelm"] = new ComplexRecipe { Item = "WarSpiritHelm", Amount = 1, CraftingStation = "piece_workbench", StationLevel = 99, BundleKey = "vrpbundle", Requirements = new Dictionary<string, (int, int)> { ["SledgeCheat"] = (1, 0) } }, ["WarSpiritLegs"] = new ComplexRecipe { Item = "WarSpiritLegs", Amount = 1, CraftingStation = "piece_workbench", StationLevel = 99, BundleKey = "vrpbundle", Requirements = new Dictionary<string, (int, int)> { ["SledgeCheat"] = (1, 0) } }, ["OrangeSpiritChest"] = new ComplexRecipe { Item = "OrangeSpiritChest", Amount = 1, CraftingStation = "piece_workbench", StationLevel = 99, BundleKey = "loraxbundle", Requirements = new Dictionary<string, (int, int)> { ["SledgeCheat"] = (1, 0) } }, ["OrangeSpiritHelm"] = new ComplexRecipe { Item = "OrangeSpiritHelm", Amount = 1, CraftingStation = "piece_workbench", StationLevel = 99, BundleKey = "loraxbundle", Requirements = new Dictionary<string, (int, int)> { ["SledgeCheat"] = (1, 0) } }, ["PartyHatRed"] = new ComplexRecipe { Item = "PartyHatRed", Amount = 1, CraftingStation = "piece_workbench", StationLevel = 99, BundleKey = "phatbundle", Requirements = new Dictionary<string, (int, int)> { ["SledgeCheat"] = (1, 0) } }, ["PartyHatGreen"] = new ComplexRecipe { Item = "PartyHatGreen", Amount = 1, CraftingStation = "piece_workbench", StationLevel = 99, BundleKey = "phatbundle", Requirements = new Dictionary<string, (int, int)> { ["SledgeCheat"] = (1, 0) } }, ["PartyHatBlue"] = new ComplexRecipe { Item = "PartyHatBlue", Amount = 1, CraftingStation = "piece_workbench", StationLevel = 99, BundleKey = "phatbundle", Requirements = new Dictionary<string, (int, int)> { ["SledgeCheat"] = (1, 0) } }, ["PartyHatYellow"] = new ComplexRecipe { Item = "PartyHatYellow", Amount = 1, CraftingStation = "piece_workbench", StationLevel = 99, BundleKey = "phatbundle", Requirements = new Dictionary<string, (int, int)> { ["SledgeCheat"] = (1, 0) } }, ["PartyHatPurple"] = new ComplexRecipe { Item = "PartyHatPurple", Amount = 1, CraftingStation = "piece_workbench", StationLevel = 99, BundleKey = "phatbundle", Requirements = new Dictionary<string, (int, int)> { ["SledgeCheat"] = (1, 0) } } }; public static readonly Dictionary<string, ComplexRecipe> VRP_Misc = new Dictionary<string, ComplexRecipe> { ["CultivatorIron"] = new ComplexRecipe { Item = "CultivatorIron", Amount = 1, CraftingStation = "forge", StationLevel = 2, BundleKey = "bandage", Requirements = new Dictionary<string, (int, int)> { ["Iron"] = (10, 2), ["Guck"] = (1, 1) } }, ["Handcuffs"] = new ComplexRecipe { Item = "Handcuffs", Amount = 1, CraftingStation = "piece_workbench", StationLevel = 1, BundleKey = "bandage", Requirements = new Dictionary<string, (int, int)> { ["DeerHide"] = (1, 0), ["Gloam"] = (1, 0) } }, ["Bandage"] = new ComplexRecipe { Item = "Bandage", Amount = 1, CraftingStation = "piece_workbench", StationLevel = 1, BundleKey = "bandage", Requirements = new Dictionary<string, (int, int)> { ["DeerHide"] = (1, 0), ["Gloam"] = (1, 0) } }, ["BandageShiny"] = new ComplexRecipe { Item = "BandageShiny", Amount = 1, CraftingStation = "piece_workbench", StationLevel = 1, BundleKey = "bandage", Requirements = new Dictionary<string, (int, int)> { ["DeerHide"] = (1, 0), ["Gloam"] = (1, 0) } }, ["Eyepatch"] = new ComplexRecipe { Item = "Eyepatch", Amount = 1, CraftingStation = "piece_workbench", StationLevel = 1, BundleKey = "bandage", Requirements = new Dictionary<string, (int, int)> { ["DeerHide"] = (1, 0), ["Floam"] = (1, 0) } } }; } [<5db7413e-51f4-4992-9c8a-f975eaad6b05>Nullable(0)] [<23ce6907-0295-4e25-921d-3566505f5f9d>NullableContext(1)] public static class BalanceData { [<5db7413e-51f4-4992-9c8a-f975eaad6b05>Nullable(new byte[] { 1, 1, 0 })] public static readonly Dictionary<string, (float weight, int? maxStack)> ItemWeights = new Dictionary<string, (float, int?)> { { "item_wood", (3f, null) }, { "item_finewood", (3f, null) }, { "item_roundlog", (3f, null) }, { "item_stone", (10f, 50) }, { "item_blackmarble", (10f, 50) }, { "item_grausten", (10f, 50) }, { "item_coins", (0f, 99999) } }; public static readonly Dictionary<string, FoodStats> FoodValues; public static readonly Dictionary<string, WeaponStats> WeaponValues; public static readonly Dictionary<string, ProjectileStats> ProjectileValues; public static readonly Dictionary<string, ItemOverride> ItemOverrides; public static readonly Dictionary<string, WeaponOverride> WeaponOverrides; public static readonly HashSet<string> ArmorSetsToRemove; static BalanceData() { Dictionary<string, FoodStats> obj = new Dictionary<string, FoodStats> { { "item_blueberries", new FoodStats(5f, 10f) }, { "item_raspberries", new FoodStats(5f, 10f) }, { "item_cloudberries", new FoodStats(5f, 10f) }, { "Floam", new FoodStats(10f, 15f, 10f, 300f) }, { "Gloam", new FoodStats(10f, 25f, 25f, 3600f) } }; float? food = 25f; float? stamina = 15f; float? regen = 1f; obj.Add("item_asksvin_meat_cooked", new FoodStats(food, stamina, null, null, regen)); float? food2 = 25f; float? stamina2 = 15f; regen = 1f; obj.Add("item_bonemawmeat_cooked", new FoodStats(food2, stamina2, null, null, regen)); float? food3 = 25f; float? stamina3 = 15f; regen = 1f; obj.Add("item_bug_meat_cooked", new FoodStats(food3, stamina3, null, null, regen)); float? food4 = 25f; float? stamina4 = 15f; regen = 1f; obj.Add("item_chicken_meat_cooked", new FoodStats(food4, stamina4, null, null, regen)); float? food5 = 25f; float? stamina5 = 15f; regen = 1f; obj.Add("item_deer_meat_cooked", new FoodStats(food5, stamina5, null, null, regen)); float? food6 = 25f; float? stamina6 = 15f; regen = 1f; obj.Add("item_egg_cooked", new FoodStats(food6, stamina6, null, null, regen)); float? food7 = 25f; float? stamina7 = 15f; regen = 1f; obj.Add("item_hare_meat_cooked", new FoodStats(food7, stamina7, null, null, regen)); float? food8 = 25f; float? stamina8 = 15f; regen = 1f; obj.Add("item_loxmeat_cooked", new FoodStats(food8, stamina8, null, null, regen)); float? food9 = 25f; float? stamina9 = 15f; regen = 1f; obj.Add("item_boar_meat_cooked", new FoodStats(food9, stamina9, null, null, regen)); float? food10 = 25f; float? stamina10 = 15f; regen = 1f; obj.Add("item_volture_meat_cooked", new FoodStats(food10, stamina10, null, null, regen)); float? food11 = 25f; float? stamina11 = 15f; regen = 1f; obj.Add("item_wolf_meat_cooked", new FoodStats(food11, stamina11, null, null, regen)); float? food12 = 25f; float? stamina12 = 15f; regen = 1f; obj.Add("item_necktailgrilled", new FoodStats(food12, stamina12, null, null, regen)); float? food13 = 25f; float? stamina13 = 15f; regen = 1f; obj.Add("item_serpentmeatcooked", new FoodStats(food13, stamina13, null, null, regen)); FoodValues = obj; WeaponValues = new Dictionary<string, WeaponStats> { { "item_sword", new WeaponStats { SecondaryAttackStamina = 40f, SecondaryDamageMultiplier = 2.2f } }, { "GREATSWORD", new WeaponStats { SecondaryDamageMultiplier = 2.2f } }, { "item_knife", new WeaponStats { BackstabBonus = 4f, LastChainMultiplier = 2f, SecondaryAttackStamina = 30f, SecondaryDamageMultiplier = 3f } }, { "item_atgeir", new WeaponStats { PrimaryAttackStamina = 8f, SecondaryAttackStamina = 30f, ForceMultiplier = 12f } }, { "item_spear_", new WeaponStats { AttackHeight = 1f, AttackRange = 2.2f, SecondaryAttackStamina = 50f, SecondaryConsumeItem = false, SecondaryDestroyProjectile = true } } }; ProjectileValues = new Dictionary<string, ProjectileStats> { { "item_spear_", new ProjectileStats { RespawnItemOnHit = false } } }; ItemOverrides = new Dictionary<string, ItemOverride>(StringComparer.InvariantCultureIgnoreCase) { { "item_chest_root", new ItemOverride { RemoveSetBonus = true, EitrRegenModifier = 0.1f } }, { "item_legs_root", new ItemOverride { RemoveSetBonus = true, EitrRegenModifier = 0.1f } }, { "item_helmet_root", new ItemOverride { RemoveSetBonus = true, EitrRegenModifier = 0.1f } }, { "BanditHelm", new ItemOverride { Armor = 1f, MaxQuality = 1 } }, { "Valon", new ItemOverride { Armor = 1f, MaxQuality = 1 } }, { "item_helmet_padded", new ItemOverride { Armor = 24f } }, { "item_chest_pcuirass", new ItemOverride { Armor = 24f } }, { "item_legs_pgreaves", new ItemOverride { Armor = 24f } }, { "item_helmet_drake", new ItemOverride { Armor = 24f } }, { "item_chest_wolf", new ItemOverride { Armor = 24f } }, { "item_legs_wolf", new ItemOverride { Armor = 24f } }, { "item_helmet_fenris", new ItemOverride { Armor = 14f } }, { "item_chest_fenris", new ItemOverride { Armor = 14f } }, { "item_legs_fenris", new ItemOverride { Armor = 14f } }, { "HelmetBlueJay_coe", new ItemOverride { Armor = 1f, RemoveSetBonus = true } }, { "vapok_mod_item_backpack_swamp", new ItemOverride { Armor = 0f, ArmorPerLevel = 0f } }, { "vapok_mod_item_backpack_meadows", new ItemOverride { Armor = 0f, ArmorPerLevel = 0f } }, { "vapok_mod_item_backpack_mountains", new ItemOverride { Armor = 0f, ArmorPerLevel = 0f } }, { "vapok_mod_item_backpack_plains", new ItemOverride { Armor = 0f, ArmorPerLevel = 0f } }, { "vapok_mod_item_backpack_mistlands", new ItemOverride { Armor = 0f, ArmorPerLevel = 0f } }, { "vapok_mod_item_backpack_blackforest", new ItemOverride { Armor = 0f, ArmorPerLevel = 0f } } }; WeaponOverrides = new Dictionary<string, WeaponOverride>(StringComparer.InvariantCultureIgnoreCase) { { "item_axe_blackmetal", new WeaponOverride { Slash = 80f } }, { "item_sledge_iron", new WeaponOverride { Blunt = 70f } }, { "item_mace_needle", new WeaponOverride { Blunt = 60f, Pierce = 15f } }, { "item_sword_blackmetal", new WeaponOverride { Slash = 75f } }, { "item_atgeir_blackmetal", new WeaponOverride { Pierce = 85f } }, { "item_atgeir_himminafl", new WeaponOverride { Pierce = 125f, Lightning = 40f } }, { "item_knife_blackmetal", new WeaponOverride { Slash = 25f, Pierce = 25f, Lightning = 12f } }, { "item_bow_draugrfang", new WeaponOverride { Pierce = 52f } }, { "item_arrow_silver", new WeaponOverride { Pierce = 52f, Spirit = 26f } }, { "item_arrow_obsidian", new WeaponOverride { Pierce = 52f, Blunt = 26f } }, { "item_arrow_needle", new WeaponOverride { Pierce = 62f, Poison = 62f } }, { "item_arrow_carapace", new WeaponOverride { Pierce = 62f, Frost = 62f } }, { "item_arrow_charred", new WeaponOverride { Pierce = 62f, Fire = 62f, Lightning = 62f } } }; ArmorSetsToRemove = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase) { "Horseaker", "horseset_t1", "horseset_t2", "Lightweight", "King of the Necks", "Chieftain", "Trollfighter", "Knighthood", "Undead", "Whitefang's Blessing", "Enchanted Stone", "Shieldmaiden", "Sven's Aim", "Bjorn's Might", "Loxgol", "Barbarian", "Moonlight", "Gjall-hunter", "Frostbite", "Druidic", "Runic", "Jötunn Born", "Blademaster", "Ascended", "Demonic", "Yagluth's Chosen", "Sainthood", "Unspoken Fear", "Dragon Blood", "Frenzied", "Deep North", "Dragon Queen's Blessing", "Gift of Thetis", "Pureheart", "Wings", "Ragnarok" }; } } public struct FoodStats { public float? Food; public float? Stamina; public float? Eitr; public float? BurnTime; public float? Regen; public FoodStats(float? food = null, float? stamina = null, float? eitr = null, float? burnTime = null, float? regen = null) { Food = food; Stamina = stamina; Eitr = eitr; BurnTime = burnTime; Regen = regen; } } public struct WeaponStats { public float? BackstabBonus; public float? LastChainMultiplier; public float? PrimaryAttackStamina; public float? SecondaryAttackStamina; public float? SecondaryDamageMultiplier; public float? ForceMultiplier; public float? AttackRange; public float? AttackHeight; public bool? SecondaryConsumeItem; public bool? SecondaryDestroyProjectile; } public struct ProjectileStats { public bool? RespawnItemOnHit; } public struct ItemOverride { public bool RemoveSetBonus; public float? EitrRegenModifier; public float? Armor; public float? ArmorPerLevel; public int? MaxQuality; } public struct WeaponOverride { public float? Slash { get; set; } public float? SlashPerLevel { get; set; } public float? Chop { get; set; } public float? ChopPerLevel { get; set; } public float? Pierce { get; set; } public float? PiercePerLevel { get; set; } public float? Blunt { get; set; } public float? BluntPerLevel { get; set; } public float? BlockArmor { get; set; } public float? BlockForce { get; set; } public float? ParryBonus { get; set; } public float? Backstab { get; set; } public float? MovementSpeedPenalty { get; set; } public float? PrimaryUseStamina { get; set; } public float? SecondaryUseStamina { get; set; } public float? Lightning { get; set; } public float? Frost { get; set; } public float? Poison { get; set; } public float? Fire { get; set; } public float? Spirit { get; set; } } public static class StringExtensions { [<23ce6907-0295-4e25-921d-3566505f5f9d>NullableContext(1)] public static bool ContainsIgnoreCase(this string source, string toCheck) { if (source == null) { return false; } return source.IndexOf(toCheck, StringComparison.InvariantCultureIgnoreCase) >= 0; } } [<5db7413e-51f4-4992-9c8a-f975eaad6b05>Nullable(0)] [<23ce6907-0295-4e25-921d-3566505f5f9d>NullableContext(1)] internal class BalancePatches { public static void ApplyBalanceTweaks() { ItemAdjustments(); } private static void Run(string phase, ItemDrop id, Action action) { try { action(); } catch (Exception ex) { string text = id?.m_itemData?.m_shared?.m_name ?? ((id != null) ? ((Object)id).name : null) ?? "<null item>"; ZLog.LogError((object)("[" + phase + "] failed on '" + text + "'")); if (VRPMod.DebugMode()) { ZLog.LogError((object)ex.ToString()); } } } private static void ItemAdjustments() { ZLog.Log((object)$"Balancing the scales... for {(ObjectDB.instance?.m_items?.Count).GetValueOrDefault()} items"); try { if ((Object)(object)ObjectDB.instance == (Object)null || ObjectDB.instance.m_items == null) { ZLog.LogError((object)"ObjectDB or m_items is null; aborting ItemAdjustments."); return; } for (int i = 0; i < ObjectDB.instance.m_items.Count; i++) { GameObject val = ObjectDB.instance.m_items[i]; ItemDrop id = (Object.op_Implicit((Object)(object)val) ? val.GetComponent<ItemDrop>() : null); Run("AdjustWeights", id, delegate { AdjustWeights(id); }); Run("AdjustFood", id, delegate { AdjustFood(id); }); Run("AdjustWeapons", id, delegate { AdjustWeapons(id); }); Run("AdjustArmor", id, delegate { AdjustArmor(id); }); Run("AdjustDurability", id, delegate { AdjustDurability(id); }); Run("RemoveSetBonuses", id, delegate { RemoveSetBonuses(id); }); } } catch (Exception ex) { ZLog.LogError((object)"error adjusting items (top-level)"); if (VRPMod.DebugMode()) { ZLog.LogError((object)ex.ToString()); } } finally { PrefabManager.OnVanillaPrefabsAvailable -= ItemAdjustments; } } private static void AdjustWeights(ItemDrop id) { if ((Object)(object)id == (Object)null || id.m_itemData?.m_shared == null) { return; } string text = id.m_itemData.m_shared.m_name.Replace("$", ""); foreach (KeyValuePair<string, (float, int?)> itemWeight in BalanceData.ItemWeights) { if (text.Contains(itemWeight.Key)) { id.m_itemData.m_shared.m_weight = itemWeight.Value.Item1; if (itemWeight.Value.Item2.HasValue) { id.m_itemData.m_shared.m_maxStackSize = itemWeight.Value.Item2.Value; } if (VRPMod.DebugMode()) { ZLog.Log((object)$"{itemWeight.Key} adjusted {itemWeight.Value.Item1}"); } } } } private static void AdjustFood(ItemDrop id) { //IL_0116: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)id == (Object)null || id.m_itemData?.m_shared == null) { return; } string name = id.m_itemData.m_shared.m_name; foreach (KeyValuePair<string, FoodStats> foodValue in BalanceData.FoodValues) { if (name.Contains(foodValue.Key)) { FoodStats value = foodValue.Value; SharedData shared = id.m_itemData.m_shared; if (value.Food.HasValue) { shared.m_food = value.Food.Value; } if (value.Stamina.HasValue) { shared.m_foodStamina = value.Stamina.Value; } if (value.Eitr.HasValue) { shared.m_foodEitr = value.Eitr.Value; } if (value.BurnTime.HasValue) { shared.m_foodBurnTime = value.BurnTime.Value; } if (value.Regen.HasValue) { shared.m_foodRegen = value.Regen.Value; } shared.m_itemType = (ItemType)2; if (VRPMod.DebugMode()) { ZLog.Log((object)$"Adjusted food: {name} -> food:{value.Food}, stam:{value.Stamina}, eitr:{value.Eitr}, burn:{value.BurnTime}, regen:{value.Regen}"); } } } } private static void AdjustWeapons(ItemDrop id) { //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_0315: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0537: Unknown result type (might be due to invalid IL or missing references) //IL_0539: Unknown result type (might be due to invalid IL or missing references) //IL_0540: Unknown result type (might be due to invalid IL or missing references) //IL_0542: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)id == (Object)null || id.m_itemData?.m_shared == null) { return; } string name = id.m_itemData.m_shared.m_name; string source = name.Replace("$", ""); foreach (KeyValuePair<string, WeaponStats> weaponValue in BalanceData.WeaponValues) { if (name.Contains(weaponValue.Key)) { SharedData shared = id.m_itemData.m_shared; WeaponStats value = weaponValue.Value; if (value.BackstabBonus.HasValue) { shared.m_backstabBonus = value.BackstabBonus.Value; } if (value.LastChainMultiplier.HasValue) { shared.m_attack.m_lastChainDamageMultiplier = value.LastChainMultiplier.Value; } if (value.PrimaryAttackStamina.HasValue) { shared.m_attack.m_attackStamina = value.PrimaryAttackStamina.Value; } if (value.SecondaryAttackStamina.HasValue) { shared.m_secondaryAttack.m_attackStamina = value.SecondaryAttackStamina.Value; } if (value.SecondaryDamageMultiplier.HasValue) { shared.m_secondaryAttack.m_damageMultiplier = value.SecondaryDamageMultiplier.Value; } if (value.ForceMultiplier.HasValue) { shared.m_secondaryAttack.m_forceMultiplier = value.ForceMultiplier.Value; } if (value.AttackRange.HasValue) { shared.m_attack.m_attackRange = value.AttackRange.Value; } if (value.AttackHeight.HasValue) { shared.m_attack.m_attackHeight = value.AttackHeight.Value; } if (value.SecondaryConsumeItem.HasValue) { shared.m_secondaryAttack.m_consumeItem = value.SecondaryConsumeItem.Value; } if (value.SecondaryDestroyProjectile.HasValue) { shared.m_secondaryAttack.m_destroyPreviousProjectile = value.SecondaryDestroyProjectile.Value; } if (VRPMod.DebugMode()) { ZLog.Log((object)("Weapon adjusted: " + name)); } } } foreach (KeyValuePair<string, ProjectileStats> projectileValue in BalanceData.ProjectileValues) { if (name.Contains(projectileValue.Key)) { GameObject attackProjectile = id.m_itemData.m_shared.m_secondaryAttack.m_attackProjectile; Projectile val = ((attackProjectile != null) ? attackProjectile.GetComponent<Projectile>() : null); if ((Object)(object)val != (Object)null && projectileValue.Value.RespawnItemOnHit.HasValue) { val.m_respawnItemOnHit = projectileValue.Value.RespawnItemOnHit.Value; } } } foreach (KeyValuePair<string, WeaponOverride> weaponOverride in BalanceData.WeaponOverrides) { if (!source.ContainsIgnoreCase(weaponOverride.Key)) { continue; } try { SharedData shared2 = id.m_itemData.m_shared; WeaponOverride value2 = weaponOverride.Value; DamageTypes damages = shared2.m_damages; DamageTypes damagesPerLevel = shared2.m_damagesPerLevel; if (value2.Slash.HasValue) { damages.m_slash = value2.Slash.Value; } if (value2.Pierce.HasValue) { damages.m_pierce = value2.Pierce.Value; } if (value2.Blunt.HasValue) { damages.m_blunt = value2.Blunt.Value; } if (value2.Chop.HasValue) { damages.m_chop = value2.Chop.Value; } if (value2.Fire.HasValue) { damages.m_fire = value2.Fire.Value; } if (value2.Frost.HasValue) { damages.m_frost = value2.Frost.Value; } if (value2.Lightning.HasValue) { damages.m_lightning = value2.Lightning.Value; } if (value2.Poison.HasValue) { damages.m_poison = value2.Poison.Value; } if (value2.Spirit.HasValue) { damages.m_spirit = value2.Spirit.Value; } if (value2.SlashPerLevel.HasValue) { damagesPerLevel.m_slash = value2.SlashPerLevel.Value; } if (value2.PiercePerLevel.HasValue) { damagesPerLevel.m_pierce = value2.PiercePerLevel.Value; } if (value2.BluntPerLevel.HasValue) { damagesPerLevel.m_blunt = value2.BluntPerLevel.Value; } if (value2.ChopPerLevel.HasValue) { damagesPerLevel.m_chop = value2.ChopPerLevel.Value; } shared2.m_damages = damages; shared2.m_damagesPerLevel = damagesPerLevel; if (value2.BlockArmor.HasValue) { shared2.m_blockPower = value2.BlockArmor.Value; } if (value2.BlockForce.HasValue) { shared2.m_deflectionForce = value2.BlockForce.Value; } if (value2.ParryBonus.HasValue) { shared2.m_timedBlockBonus = value2.ParryBonus.Value; } if (value2.Backstab.HasValue) { shared2.m_backstabBonus = value2.Backstab.Value; } if (value2.MovementSpeedPenalty.HasValue) { float value3 = value2.MovementSpeedPenalty.Value; shared2.m_movementModifier = ((value3 <= 0f) ? value3 : (0f - Mathf.Abs(value3))); } if (value2.PrimaryUseStamina.HasValue && shared2.m_attack != null) { shared2.m_attack.m_attackStamina = value2.PrimaryUseStamina.Value; } if (value2.SecondaryUseStamina.HasValue && shared2.m_secondaryAttack != null) { shared2.m_secondaryAttack.m_attackStamina = value2.SecondaryUseStamina.Value; } if (VRPMod.De