Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Quickstep v1.0.15
Quickstep.dll
Decompiled a day agousing System; using System.Collections; 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 BepInEx.Bootstrap; using BepInEx.Configuration; using ConditionalConfigSync; using HarmonyLib; using JetBrains.Annotations; using Microsoft.CodeAnalysis; 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("Quickstep")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Quickstep")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("718a91cd-6b8a-4090-abc4-4d5609111f13")] [assembly: AssemblyFileVersion("1.0.15")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.15.0")] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace Quickstep { internal class CustomConfigs { internal class ConfigurationManagerAttributes { [UsedImplicitly] public Action<ConfigEntryBase>? CustomDrawer; } internal static object? configManager; internal static Type? configManagerStyles; internal static GUIStyle GetStyle(GUIStyle other) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown if (configManagerStyles == null) { return other; } FieldInfo fieldInfo = AccessTools.Field(configManagerStyles, "fontSize"); if (fieldInfo == null) { return other; } return new GUIStyle(other) { fontSize = (int)fieldInfo.GetValue(configManagerStyles) }; } internal static void Awake() { Assembly assembly = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault((Assembly a) => a.GetName().Name == "ConfigurationManager"); Type type = assembly?.GetType("ConfigurationManager.ConfigurationManager"); configManager = ((type == null) ? null : Chainloader.ManagerObject.GetComponent(type)); configManagerStyles = assembly?.GetType("ConfigurationManager.ConfigurationManagerStyles"); } internal static Action<ConfigEntryBase> DrawSeparatedStrings(string splitString) { return delegate(ConfigEntryBase cfg) { //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_0125: Expected O, but got Unknown //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Expected O, but got Unknown bool valueOrDefault = cfg.Description.Tags.Select((object a) => (a.GetType().Name == "ConfigurationManagerAttributes") ? ((bool?)a.GetType().GetField("ReadOnly")?.GetValue(a)) : ((bool?)null)).FirstOrDefault((bool? v) => v.HasValue) == true; bool flag = false; GUILayout.BeginVertical(Array.Empty<GUILayoutOption>()); List<string> list = new List<string>(); List<string> list2 = ((string)cfg.BoxedValue).Split(new string[1] { splitString }, StringSplitOptions.None).ToList(); for (int num = 0; num < list2.Count; num++) { GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); string text = list2[num]; string text2 = GUILayout.TextField(text, GetStyle(GUI.skin.textArea), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); if (text2 != text && !valueOrDefault) { flag = true; } if (GUILayout.Button("x", new GUIStyle(GetStyle(GUI.skin.button)) { fixedWidth = 21f }, Array.Empty<GUILayoutOption>()) && !valueOrDefault) { flag = true; } else { list.Add(text2); } if (GUILayout.Button("+", new GUIStyle(GetStyle(GUI.skin.button)) { fixedWidth = 21f }, Array.Empty<GUILayoutOption>()) && !valueOrDefault) { flag = true; list.Add(""); } GUILayout.EndHorizontal(); } GUILayout.EndVertical(); if (flag) { cfg.BoxedValue = string.Join(splitString, list); } }; } internal static Action<ConfigEntryBase> DrawOrderedFixedStrings(string splitString) { return delegate(ConfigEntryBase cfg) { //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Expected O, but got Unknown //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Expected O, but got Unknown bool valueOrDefault = cfg.Description.Tags.Select((object a) => (a.GetType().Name == "ConfigurationManagerAttributes") ? ((bool?)a.GetType().GetField("ReadOnly")?.GetValue(a)) : ((bool?)null)).FirstOrDefault((bool? v) => v.HasValue) == true; bool flag = false; GUILayout.BeginVertical(Array.Empty<GUILayoutOption>()); string[] array = ((string)cfg.BoxedValue).Split(new string[1] { splitString }, StringSplitOptions.None).ToArray(); for (int num = 0; num < array.Length; num++) { GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); string text = array[num]; GUILayout.Label(text, GetStyle(GUI.skin.textArea), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); if (GUILayout.Button("ʌ", new GUIStyle(GetStyle(GUI.skin.button)) { fixedWidth = 21f }, Array.Empty<GUILayoutOption>()) && !valueOrDefault && (flag = num > 0)) { ref string reference = ref array[num]; ref string reference2 = ref array[num - 1]; string text2 = array[num - 1]; string text3 = array[num]; reference = text2; reference2 = text3; } if (GUILayout.Button("v", new GUIStyle(GetStyle(GUI.skin.button)) { fixedWidth = 21f }, Array.Empty<GUILayoutOption>()) && !valueOrDefault && (flag = num < array.Length - 1)) { ref string reference = ref array[num]; ref string reference3 = ref array[num + 1]; string text3 = array[num + 1]; string text2 = array[num]; reference = text3; reference3 = text2; } GUILayout.EndHorizontal(); } GUILayout.EndVertical(); if (flag) { cfg.BoxedValue = string.Join(splitString, array); } }; } } [BepInPlugin("shudnal.Quickstep", "Quickstep", "1.0.15")] [BepInDependency("_shudnal.ConditionalConfigSync", "1.0.5")] public class Quickstep : BaseUnityPlugin { [HarmonyPatch(typeof(Player), "UpdateDodge")] public static class Player_UpdateDodge_Quickstep { private static bool Prefix(Player __instance, float dt) { if (!modEnabled.Value) { return true; } return CheckQuickstep(__instance, dt); } } [HarmonyPatch(typeof(Player), "OnSneaking")] public static class Player_OnSneaking_PreventSneakXP { private static void Prefix(ref float dt) { if (modEnabled.Value && isDashed) { dt = 0f; } } } [HarmonyPatch(typeof(ZoneSystem), "Start")] public static class ZoneSystem_Start_UpdateCustomPrefabList { private static void Prefix() { if (modEnabled.Value) { UpdateCustomPrefabs(); UpdateRestrictions(); } } } [HarmonyPatch(typeof(Humanoid), "SetupVisEquipment")] public static class Humanoid_SetupVisEquipment_UpdateEquipmentStatus { private static void Finalizer(Humanoid __instance) { if ((Object)(object)__instance == (Object)(object)Player.m_localPlayer) { isEquippedItemsRestrictionsUpdated = false; } } } public const string pluginID = "shudnal.Quickstep"; public const string pluginName = "Quickstep"; public const string pluginVersion = "1.0.15"; private readonly Harmony harmony = new Harmony("shudnal.Quickstep"); internal static readonly ConfigSync configSync = new ConfigSync("shudnal.Quickstep") { DisplayName = "Quickstep", CurrentVersion = "1.0.15", MinimumRequiredVersion = "1.0.15" }; private static ConfigEntry<bool> modEnabled; private static ConfigEntry<bool> configLocked; private static ConfigEntry<bool> loggingEnabled; private static ConfigEntry<float> dashForce; private static ConfigEntry<float> dashTime; private static ConfigEntry<float> dashInvincibilityTime; private static ConfigEntry<float> dashCooldownTime; private static ConfigEntry<float> dashStaminaMultiplier; private static ConfigEntry<bool> dodgeOnDoubleClick; private static ConfigEntry<bool> preventQuickStepWithBucklers; private static ConfigEntry<bool> preventQuickStepWithTowerShields; private static ConfigEntry<string> preventQuickStepWithEquippedItem; private static ConfigEntry<string> preventQuickStepWithStatusEffect; private static ConfigEntry<string> preventQuickStepWithoutStatusEffect; private static ConfigEntry<bool> allowBareFists; private static ConfigEntry<bool> allowSwords; private static ConfigEntry<bool> allowKnives; private static ConfigEntry<bool> allowClubs; private static ConfigEntry<bool> allowPolearms; private static ConfigEntry<bool> allowSpears; private static ConfigEntry<bool> allowAxes; private static ConfigEntry<bool> allowBows; private static ConfigEntry<bool> allowElementalMagic; private static ConfigEntry<bool> allowBloodMagic; private static ConfigEntry<bool> allowUnarmed; private static ConfigEntry<bool> allowPickaxes; private static ConfigEntry<bool> allowCrossbows; private static ConfigEntry<bool> allowCustomPrefabs; private static ConfigEntry<float> dashForceBareFists; private static ConfigEntry<float> dashTimeBareFists; private static ConfigEntry<float> dashForceSwords; private static ConfigEntry<float> dashTimeSwords; private static ConfigEntry<float> dashForceKnives; private static ConfigEntry<float> dashTimeKnives; private static ConfigEntry<float> dashForceClubs; private static ConfigEntry<float> dashTimeClubs; private static ConfigEntry<float> dashForcePolearms; private static ConfigEntry<float> dashTimePolearms; private static ConfigEntry<float> dashForceSpears; private static ConfigEntry<float> dashTimeSpears; private static ConfigEntry<float> dashForceAxes; private static ConfigEntry<float> dashTimeAxes; private static ConfigEntry<float> dashForceBows; private static ConfigEntry<float> dashTimeBows; private static ConfigEntry<float> dashForceElementalMagic; private static ConfigEntry<float> dashTimeElementalMagic; private static ConfigEntry<float> dashForceBloodMagic; private static ConfigEntry<float> dashTimeBloodMagic; private static ConfigEntry<float> dashForceUnarmed; private static ConfigEntry<float> dashTimeUnarmed; private static ConfigEntry<float> dashForcePickaxes; private static ConfigEntry<float> dashTimePickaxes; private static ConfigEntry<float> dashForceCrossbows; private static ConfigEntry<float> dashTimeCrossbows; private static ConfigEntry<float> dashForceCustomPrefabs; private static ConfigEntry<float> dashTimeCustomPrefabs; private static ConfigEntry<string> prefabListUseBareFistsConfig; private static ConfigEntry<string> prefabListUseSwordsConfig; private static ConfigEntry<string> prefabListUseKnivesConfig; private static ConfigEntry<string> prefabListUseClubsConfig; private static ConfigEntry<string> prefabListUsePolearmsConfig; private static ConfigEntry<string> prefabListUseSpearsConfig; private static ConfigEntry<string> prefabListUseAxesConfig; private static ConfigEntry<string> prefabListUseBowsConfig; private static ConfigEntry<string> prefabListUseElementalMagicConfig; private static ConfigEntry<string> prefabListUseBloodMagicConfig; private static ConfigEntry<string> prefabListUseUnarmedConfig; private static ConfigEntry<string> prefabListUsePickaxesConfig; private static ConfigEntry<string> prefabListUseCrossbowsConfig; private static ConfigEntry<string> prefabListUseCustomPrefabsConfig; internal static Quickstep instance; private static readonly Dictionary<string, Tuple<ConfigEntry<float>, ConfigEntry<float>>> customPrefabs = new Dictionary<string, Tuple<ConfigEntry<float>, ConfigEntry<float>>>(); private static readonly List<string> itemsToPrevent = new List<string>(); private static readonly List<int> seToPrevent = new List<int>(); private static readonly List<int> seToHave = new List<int>(); private static bool isDashed; private static bool skipToDodge; private static readonly WaitForFixedUpdate waitForFixedUpdate = new WaitForFixedUpdate(); private static readonly WaitForSeconds waitFor001Sec = new WaitForSeconds(0.01f); private static bool isEquippedItemsRestrictionsUpdated; private static bool quickstepPreventedByItemEquipped; private void Awake() { harmony.PatchAll(); instance = this; ConfigInit(); ((ConditionalConfigSync)configSync).AddLockingConfigEntry<bool>(configLocked); Game.isModded = true; } private void OnDestroy() { ((BaseUnityPlugin)this).Config.Save(); Harmony obj = harmony; if (obj != null) { obj.UnpatchSelf(); } } public static void LogInfo(object data) { if (loggingEnabled.Value) { ((BaseUnityPlugin)instance).Logger.LogInfo(data); } } private void ConfigInit() { modEnabled = config("General", "Enabled", defaultValue: true, "Enable the mod"); configLocked = config("General", "Lock Configuration", defaultValue: true, "Configuration is locked and can be changed by server admins only."); loggingEnabled = config("General", "Logging enabled", defaultValue: false, "Enable logging for debug events. [Not Synced with Server]", synchronizedSetting: false); dashForce = config("Quickstep", "Dash force", 50f, "Quickstep force factor."); dashTime = config("Quickstep", "Dash time", 0.25f, "Quickstep time."); dashInvincibilityTime = config("Quickstep", "Invincibility time with shield", 0.15f, "Quickstep invincibility time when you're equipping a shield. If you're not equipping a shield quickstep grant invincibility for all its duration."); dashCooldownTime = config("Quickstep", "Quickstep cooldown", 0.5f, "Time in seconds you can not dash again."); dashStaminaMultiplier = config("Quickstep", "Stamina usage multiplier", 0.6f, "Multiplier of how much less stamina you will use on quickstep than dodge stamina usage."); dodgeOnDoubleClick = config("Quickstep", "Dodge on double click", defaultValue: true, "Double click dodge button to perform regular dodge."); preventQuickStepWithBucklers = config("Restrictions", "Prevent quickstep with equipped buckler", defaultValue: false, "Prevent quickstep when small shield is in left hand"); preventQuickStepWithTowerShields = config("Restrictions", "Prevent quickstep with equipped tower shield", defaultValue: true, "Prevent quickstep when tower shield is in left hand"); preventQuickStepWithEquippedItem = config("Restrictions", "Prevent quickstep with items equipped", "", GetDescriptionSeparatedStrings("Comma-separated list of item prefabs (not just weapons) when you have any of it equipped quickstep will not perform")); preventQuickStepWithStatusEffect = config("Restrictions", "Prevent quickstep with active status effect", "", GetDescriptionSeparatedStrings("Comma-separated list of status effect prefab name or localized name when you have any of status effects quickstep will not perform")); preventQuickStepWithoutStatusEffect = config("Restrictions", "Prevent quickstep without active status effect", "", GetDescriptionSeparatedStrings("Comma-separated list of status effect prefab name or localized name when you do NOT have any of status effects quickstep will not perform")); preventQuickStepWithEquippedItem.SettingChanged += delegate { UpdateRestrictions(); }; preventQuickStepWithStatusEffect.SettingChanged += delegate { UpdateRestrictions(); }; preventQuickStepWithoutStatusEffect.SettingChanged += delegate { UpdateRestrictions(); }; allowBareFists = config("Weapons", "Allow quickstep with bare fists", defaultValue: false, "Perform quickstep instead of dodging while not using any weapon"); allowSwords = config("Weapons", "Allow quickstep with Swords", defaultValue: false, "Perform quickstep instead of dodging while using Swords"); allowKnives = config("Weapons", "Allow quickstep with Knives", defaultValue: true, "Perform quickstep instead of dodging while using Knives"); allowClubs = config("Weapons", "Allow quickstep with Clubs", defaultValue: false, "Perform quickstep instead of dodging while using Clubs"); allowPolearms = config("Weapons", "Allow quickstep with Polearms", defaultValue: false, "Perform quickstep instead of dodging while using Polearms"); allowSpears = config("Weapons", "Allow quickstep with Spears", defaultValue: false, "Perform quickstep instead of dodging while using Spears"); allowAxes = config("Weapons", "Allow quickstep with Axes", defaultValue: false, "Perform quickstep instead of dodging while using Axes"); allowBows = config("Weapons", "Allow quickstep with Bows", defaultValue: false, "Perform quickstep instead of dodging while using Bows"); allowElementalMagic = config("Weapons", "Allow quickstep with ElementalMagic", defaultValue: false, "Perform quickstep instead of dodging while using ElementalMagic staff"); allowBloodMagic = config("Weapons", "Allow quickstep with BloodMagic", defaultValue: false, "Perform quickstep instead of dodging while using BloodMagic staff"); allowUnarmed = config("Weapons", "Allow quickstep with Unarmed", defaultValue: true, "Perform quickstep instead of dodging while using Unarmed"); allowPickaxes = config("Weapons", "Allow quickstep with Pickaxes", defaultValue: false, "Perform quickstep instead of dodging while using Pickaxes"); allowCrossbows = config("Weapons", "Allow quickstep with Crossbows", defaultValue: false, "Perform quickstep instead of dodging while using Crossbows"); allowCustomPrefabs = config("Weapons", "Allow quickstep with custom weapon list", defaultValue: false, "Perform quickstep instead of dodging while using weapon from list"); dashForceBareFists = config("Weapons - Details", "Dash force with bare fists", 0f, "Dash force while not using any weapon. Set 0 to use default value."); dashTimeBareFists = config("Weapons - Details", "Dash time with bare fists", 0f, "Dash time while not using any weapon. Set 0 to use default value."); dashForceSwords = config("Weapons - Details", "Dash force with Swords", 0f, "Dash force while using Swords. Set 0 to use default value."); dashTimeSwords = config("Weapons - Details", "Dash time with Swords", 0f, "Dash time while using Swords. Set 0 to use default value."); dashForceKnives = config("Weapons - Details", "Dash force with Knives", 0f, "Dash force while using Knives. Set 0 to use default value."); dashTimeKnives = config("Weapons - Details", "Dash time with Knives", 0f, "Dash time while using Knives. Set 0 to use default value."); dashForceClubs = config("Weapons - Details", "Dash force with Clubs", 0f, "Dash force while using Clubs. Set 0 to use default value."); dashTimeClubs = config("Weapons - Details", "Dash time with Clubs", 0f, "Dash time while using Clubs. Set 0 to use default value."); dashForcePolearms = config("Weapons - Details", "Dash force with Polearms", 0f, "Dash force while using Polearms. Set 0 to use default value."); dashTimePolearms = config("Weapons - Details", "Dash time with Polearms", 0f, "Dash time while using Polearms. Set 0 to use default value."); dashForceSpears = config("Weapons - Details", "Dash force with Spears", 0f, "Dash force while using Spears. Set 0 to use default value."); dashTimeSpears = config("Weapons - Details", "Dash time with Spears", 0f, "Dash time while using Spears. Set 0 to use default value."); dashForceAxes = config("Weapons - Details", "Dash force with Axes", 0f, "Dash force while using Axes. Set 0 to use default value."); dashTimeAxes = config("Weapons - Details", "Dash time with Axes", 0f, "Dash time while using Axes. Set 0 to use default value."); dashForceBows = config("Weapons - Details", "Dash force with Bows", 0f, "Dash force while using Bows. Set 0 to use default value."); dashTimeBows = config("Weapons - Details", "Dash time with Bows", 0f, "Dash time while using Bows. Set 0 to use default value."); dashForceElementalMagic = config("Weapons - Details", "Dash force with ElementalMagic", 0f, "Dash force while using ElementalMagic staff. Set 0 to use default value."); dashTimeElementalMagic = config("Weapons - Details", "Dash time with ElementalMagic", 0f, "Dash time while using ElementalMagic staff. Set 0 to use default value."); dashForceBloodMagic = config("Weapons - Details", "Dash force with BloodMagic", 0f, "Dash force while using BloodMagic staff. Set 0 to use default value."); dashTimeBloodMagic = config("Weapons - Details", "Dash time with BloodMagic", 0f, "Dash time while using BloodMagic staff. Set 0 to use default value."); dashForceUnarmed = config("Weapons - Details", "Dash force with Unarmed", 0f, "Dash force while using Unarmed. Set 0 to use default value."); dashTimeUnarmed = config("Weapons - Details", "Dash time with Unarmed", 0f, "Dash time while using Unarmed. Set 0 to use default value."); dashForcePickaxes = config("Weapons - Details", "Dash force with Pickaxes", 0f, "Dash force while using Pickaxes. Set 0 to use default value."); dashTimePickaxes = config("Weapons - Details", "Dash time with Pickaxes", 0f, "Dash time while using Pickaxes. Set 0 to use default value."); dashForceCrossbows = config("Weapons - Details", "Dash force with Crossbows", 0f, "Dash force while using Crossbows. Set 0 to use default value."); dashTimeCrossbows = config("Weapons - Details", "Dash time with Crossbows", 0f, "Dash time while using Crossbows. Set 0 to use default value."); dashForceCustomPrefabs = config("Weapons - Details", "Dash force with Custom prefabs", 0f, "Dash force while using prefabs from custom list. Set 0 to use default value."); dashTimeCustomPrefabs = config("Weapons - Details", "Dash time with Custom prefabs", 0f, "Dash time while using prefabs from custom list. Set 0 to use default value."); prefabListUseBareFistsConfig = config("Weapons - Prefabs", "Prefab list to use Bare fists config", "", GetDescriptionSeparatedStrings("Comma-separated list of prefabs to use dash force and time from BareFists config")); prefabListUseSwordsConfig = config("Weapons - Prefabs", "Prefab list to use Swords config", "", GetDescriptionSeparatedStrings("Comma-separated list of prefabs to use dash force and time from Swords config")); prefabListUseKnivesConfig = config("Weapons - Prefabs", "Prefab list to use Knives config", "", GetDescriptionSeparatedStrings("Comma-separated list of prefabs to use dash force and time from Knives config")); prefabListUseClubsConfig = config("Weapons - Prefabs", "Prefab list to use Clubs config", "", GetDescriptionSeparatedStrings("Comma-separated list of prefabs to use dash force and time from Clubs config")); prefabListUsePolearmsConfig = config("Weapons - Prefabs", "Prefab list to use Polearms config", "", GetDescriptionSeparatedStrings("Comma-separated list of prefabs to use dash force and time from Polearms config")); prefabListUseSpearsConfig = config("Weapons - Prefabs", "Prefab list to use Spears config", "", GetDescriptionSeparatedStrings("Comma-separated list of prefabs to use dash force and time from Spears config")); prefabListUseAxesConfig = config("Weapons - Prefabs", "Prefab list to use Axes config", "", GetDescriptionSeparatedStrings("Comma-separated list of prefabs to use dash force and time from Axes config")); prefabListUseBowsConfig = config("Weapons - Prefabs", "Prefab list to use Bows config", "", GetDescriptionSeparatedStrings("Comma-separated list of prefabs to use dash force and time from Bows config")); prefabListUseElementalMagicConfig = config("Weapons - Prefabs", "Prefab list to use ElementalMagic config", "", GetDescriptionSeparatedStrings("Comma-separated list of prefabs to use dash force and time from ElementalMagic config")); prefabListUseBloodMagicConfig = config("Weapons - Prefabs", "Prefab list to use BloodMagic config", "", GetDescriptionSeparatedStrings("Comma-separated list of prefabs to use dash force and time from BloodMagic config")); prefabListUseUnarmedConfig = config("Weapons - Prefabs", "Prefab list to use Unarmed config", "", GetDescriptionSeparatedStrings("Comma-separated list of prefabs to use dash force and time from Unarmed config")); prefabListUsePickaxesConfig = config("Weapons - Prefabs", "Prefab list to use Pickaxes config", "", GetDescriptionSeparatedStrings("Comma-separated list of prefabs to use dash force and time from Pickaxes config")); prefabListUseCrossbowsConfig = config("Weapons - Prefabs", "Prefab list to use Crossbows config", "", GetDescriptionSeparatedStrings("Comma-separated list of prefabs to use dash force and time from Crossbows config")); prefabListUseCustomPrefabsConfig = config("Weapons - Prefabs", "Prefab list to use Custom prefabs config", "", GetDescriptionSeparatedStrings("Comma-separated list of prefabs to use dash force and time from CustomPrefabs config")); prefabListUseBareFistsConfig.SettingChanged += delegate { UpdateCustomPrefabs(); }; prefabListUseSwordsConfig.SettingChanged += delegate { UpdateCustomPrefabs(); }; prefabListUseKnivesConfig.SettingChanged += delegate { UpdateCustomPrefabs(); }; prefabListUseClubsConfig.SettingChanged += delegate { UpdateCustomPrefabs(); }; prefabListUsePolearmsConfig.SettingChanged += delegate { UpdateCustomPrefabs(); }; prefabListUseSpearsConfig.SettingChanged += delegate { UpdateCustomPrefabs(); }; prefabListUseAxesConfig.SettingChanged += delegate { UpdateCustomPrefabs(); }; prefabListUseBowsConfig.SettingChanged += delegate { UpdateCustomPrefabs(); }; prefabListUseElementalMagicConfig.SettingChanged += delegate { UpdateCustomPrefabs(); }; prefabListUseBloodMagicConfig.SettingChanged += delegate { UpdateCustomPrefabs(); }; prefabListUseUnarmedConfig.SettingChanged += delegate { UpdateCustomPrefabs(); }; prefabListUsePickaxesConfig.SettingChanged += delegate { UpdateCustomPrefabs(); }; prefabListUseCrossbowsConfig.SettingChanged += delegate { UpdateCustomPrefabs(); }; prefabListUseCustomPrefabsConfig.SettingChanged += delegate { UpdateCustomPrefabs(); }; } private ConfigEntry<T> config<T>(string group, string name, T defaultValue, ConfigDescription description, bool synchronizedSetting = true) { ConfigEntry<T> val = ((BaseUnityPlugin)this).Config.Bind<T>(group, name, defaultValue, description); ((ConditionalConfigSync)configSync).AddConfigEntry<T>(val, (ConfigSyncMode)1, synchronizedSetting); return val; } private ConfigEntry<T> config<T>(string group, string name, T defaultValue, 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, defaultValue, new ConfigDescription(description, (AcceptableValueBase)null, Array.Empty<object>()), synchronizedSetting); } private ConfigDescription GetDescriptionSeparatedStrings(string description) { //IL_003f: 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_0045: Expected O, but got Unknown return Chainloader.PluginInfos.ContainsKey("_shudnal.ConfigurationManager") ? new ConfigDescription(description, (AcceptableValueBase)null, Array.Empty<object>()) : new ConfigDescription(description, (AcceptableValueBase)null, new object[1] { new CustomConfigs.ConfigurationManagerAttributes { CustomDrawer = CustomConfigs.DrawSeparatedStrings(",") } }); } private static void UpdateCustomPrefabs() { customPrefabs.Clear(); AddToCustomConfigs(prefabListUseBareFistsConfig, dashForceBareFists, dashTimeBareFists); AddToCustomConfigs(prefabListUseSwordsConfig, dashForceSwords, dashTimeSwords); AddToCustomConfigs(prefabListUseKnivesConfig, dashForceKnives, dashTimeKnives); AddToCustomConfigs(prefabListUseClubsConfig, dashForceClubs, dashTimeClubs); AddToCustomConfigs(prefabListUsePolearmsConfig, dashForcePolearms, dashTimePolearms); AddToCustomConfigs(prefabListUseSpearsConfig, dashForceSpears, dashTimeSpears); AddToCustomConfigs(prefabListUseAxesConfig, dashForceAxes, dashTimeAxes); AddToCustomConfigs(prefabListUseBowsConfig, dashForceBows, dashTimeBows); AddToCustomConfigs(prefabListUseElementalMagicConfig, dashForceElementalMagic, dashTimeElementalMagic); AddToCustomConfigs(prefabListUseBloodMagicConfig, dashForceBloodMagic, dashTimeBloodMagic); AddToCustomConfigs(prefabListUseUnarmedConfig, dashForceUnarmed, dashTimeUnarmed); AddToCustomConfigs(prefabListUsePickaxesConfig, dashForcePickaxes, dashTimePickaxes); AddToCustomConfigs(prefabListUseCrossbowsConfig, dashForceCrossbows, dashTimeCrossbows); AddToCustomConfigs(prefabListUseCustomPrefabsConfig, dashForceCustomPrefabs, dashTimeCustomPrefabs); static void AddToCustomConfigs(ConfigEntry<string> customConfigs, ConfigEntry<float> dashForce, ConfigEntry<float> dashTime) { string[] array = customConfigs.Value.Split(new string[1] { "," }, StringSplitOptions.RemoveEmptyEntries); foreach (string key in array) { customPrefabs.Add(key, Tuple.Create<ConfigEntry<float>, ConfigEntry<float>>(dashForce, dashTime)); } } } private static void UpdateRestrictions() { itemsToPrevent.Clear(); CollectionExtensions.Do<string>(from a in preventQuickStepWithEquippedItem.Value.Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries) select a.Trim().ToLower(), (Action<string>)itemsToPrevent.Add); isEquippedItemsRestrictionsUpdated = false; seToPrevent.Clear(); string[] array = preventQuickStepWithStatusEffect.Value.Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries); foreach (string seName in array) { seToPrevent.Add(StringExtensionMethods.GetStableHashCode(seName)); if (Object.op_Implicit((Object)(object)ObjectDB.instance)) { CollectionExtensions.Do<StatusEffect>(ObjectDB.instance.m_StatusEffects.Where((StatusEffect se) => string.Equals(((Object)se).name, seName, StringComparison.OrdinalIgnoreCase) || string.Equals(se.m_name, seName, StringComparison.OrdinalIgnoreCase)), (Action<StatusEffect>)delegate(StatusEffect se) { seToPrevent.Add(se.m_nameHash); }); } } seToHave.Clear(); string[] array2 = preventQuickStepWithoutStatusEffect.Value.Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries); foreach (string seName2 in array2) { seToHave.Add(StringExtensionMethods.GetStableHashCode(seName2)); if (Object.op_Implicit((Object)(object)ObjectDB.instance)) { CollectionExtensions.Do<StatusEffect>(ObjectDB.instance.m_StatusEffects.Where((StatusEffect se) => string.Equals(((Object)se).name, seName2, StringComparison.OrdinalIgnoreCase) || string.Equals(se.m_name, seName2, StringComparison.OrdinalIgnoreCase)), (Action<StatusEffect>)delegate(StatusEffect se) { seToHave.Add(se.m_nameHash); }); } } } public static IEnumerator Dash(Player player, Vector3 dodgeDir, bool reducedIFrames, float dashForceWeapon, float dashTimeWeapon, Vector3 currentVel) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) isDashed = true; bool isCrouching = ((Character)player).IsCrouching(); bool isBlocking = ((Character)player).IsBlocking(); float dodgeStaminaUsage = player.m_dodgeStaminaUsage; ((Humanoid)player).ClearActionQueue(); player.m_inDodge = true; player.m_dodgeInvincible = true; player.m_dodgeInvincibleCached = true; ((Character)player).m_nview.GetZDO().Set(ZDOVars.s_dodgeinv, player.m_dodgeInvincible); float speed = ((Character)player).m_zanim.m_animator.speed; if (!isCrouching) { ((Character)player).m_zanim.SetSpeed(speed * 3f); } if (isBlocking) { ((Humanoid)player).m_internalBlockingState = false; ((Character)player).m_nview.GetZDO().Set(ZDOVars.s_isBlockingHash, false); ((Character)player).m_zanim.SetBool(Humanoid.s_blocking, false); if (!SkipToDodge()) { yield return waitForFixedUpdate; } } if (!SkipToDodge()) { ((Character)player).SetCrouch(!isCrouching); ((Character)player).m_zanim.SetBool(Player.s_crouching, !isCrouching); yield return waitForFixedUpdate; } if (!SkipToDodge()) { ((Character)player).m_zanim.SetBool("equipping", false); yield return waitForFixedUpdate; } ((Character)player).m_zanim.SetSpeed(speed * 1.5f); float dashTimeCurrent = ((dashTimeWeapon == 0f) ? dashTime.Value : dashTimeWeapon); float m_time = Time.time + dashTimeCurrent; Vector3 vector = dodgeDir * ((dashForceWeapon == 0f) ? dashForce.Value : dashForceWeapon); vector.y = 0f; while (Time.time < m_time && !SkipToDodge()) { ((Character)player).m_body.AddForce(vector, (ForceMode)1); bool invincibility = !reducedIFrames || m_time - Time.time >= dashTimeCurrent - Mathf.Clamp(dashInvincibilityTime.Value, 0f, dashTimeCurrent); if ((player.m_dodgeInvincible || player.m_dodgeInvincibleCached) && !invincibility) { player.m_dodgeInvincible = invincibility; player.m_dodgeInvincibleCached = invincibility; ((Character)player).m_nview.GetZDO().Set(ZDOVars.s_dodgeinv, player.m_dodgeInvincible); } yield return waitFor001Sec; } ((Character)player).m_body.linearVelocity = Vector3.Lerp(((Character)player).m_body.linearVelocity, currentVel, 0.5f) * 0.3f; if (player.m_dodgeInvincible) { player.m_dodgeInvincible = false; player.m_dodgeInvincibleCached = false; ((Character)player).m_nview.GetZDO().Set(ZDOVars.s_dodgeinv, player.m_dodgeInvincible); } player.m_inDodge = false; player.m_beenHitWhileDodging = false; ((Character)player).SetCrouch(isCrouching); ((Character)player).m_zanim.SetBool(Player.s_crouching, isCrouching); if (!skipToDodge) { yield return waitForFixedUpdate; } ((Character)player).m_zanim.SetSpeed(speed); yield return (object)new WaitForSeconds(dashCooldownTime.Value); if (skipToDodge) { yield return (object)new WaitWhile((Func<bool>)(() => ((Character)player).InDodge())); } isDashed = false; skipToDodge = false; player.m_dodgeStaminaUsage = dodgeStaminaUsage; bool SkipToDodge() { if (skipToDodge = dodgeOnDoubleClick.Value && player.m_queuedDodgeTimer > 0f) { player.m_dodgeStaminaUsage = 0f; } return skipToDodge; } } public static bool CheckQuickstep(Player player, float dt) { if (skipToDodge) { return true; } if (!isEquippedItemsRestrictionsUpdated && (Object)(object)Player.m_localPlayer == (Object)(object)player) { isEquippedItemsRestrictionsUpdated = true; quickstepPreventedByItemEquipped = ((Humanoid)player).GetInventory().GetEquippedItems().Any(delegate(ItemData item) { int result; if (!itemsToPrevent.Contains(item.m_shared.m_name.ToLower())) { List<string> list = itemsToPrevent; GameObject dropPrefab = item.m_dropPrefab; result = (list.Contains((dropPrefab != null) ? ((Object)dropPrefab).name.ToLower() : null) ? 1 : 0); } else { result = 1; } return (byte)result != 0; }); } if (!AllowQuickstep(player, out var dashForceWeapon, out var dashTimeWeapon)) { return true; } UpdateQuickstep(player, dt, dashForceWeapon, dashTimeWeapon); return false; } public static bool AllowQuickstep(Player player, out float dashForceWeapon, out float dashTimeWeapon) { //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Invalid comparison between Unknown and I4 //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_024a: 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_024d: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Expected I4, but got Unknown //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Invalid comparison between Unknown and I4 dashForceWeapon = 0f; dashTimeWeapon = 0f; if ((Object)(object)player == (Object)null) { return false; } if ((Object)(object)player == (Object)(object)Player.m_localPlayer) { if (quickstepPreventedByItemEquipped) { return false; } if (preventQuickStepWithBucklers.Value || preventQuickStepWithTowerShields.Value) { SharedData val = ((Humanoid)player).GetCurrentBlocker()?.m_shared; if (val != null && (int)val.m_itemType == 5 && ((preventQuickStepWithBucklers.Value && val.m_timedBlockBonus != 0f) || (preventQuickStepWithTowerShields.Value && val.m_timedBlockBonus == 0f))) { return false; } } if (((IEnumerable<int>)seToPrevent).Any((Func<int, bool>)((Character)player).GetSEMan().HaveStatusEffect)) { return false; } if (seToHave.Count > 0 && !((IEnumerable<int>)seToHave).Any((Func<int, bool>)((Character)player).GetSEMan().HaveStatusEffect)) { return false; } } ItemData val2 = ((Humanoid)player).GetRightItem() ?? ((Humanoid)player).GetLeftItem(); if (val2 != null) { if ((Object)(object)val2.m_dropPrefab != (Object)null && customPrefabs.TryGetValue(((Object)val2.m_dropPrefab).name, out var value)) { dashForceWeapon = value.Item1.Value; dashTimeWeapon = value.Item2.Value; return allowCustomPrefabs.Value; } if (customPrefabs.TryGetValue(val2.m_shared.m_name, out var value2)) { dashForceWeapon = value2.Item1.Value; dashTimeWeapon = value2.Item2.Value; return allowCustomPrefabs.Value; } } if (val2 == null || (int)val2.m_shared.m_itemType == 5) { dashForceWeapon = dashForceBareFists.Value; dashTimeWeapon = dashTimeBareFists.Value; return allowBareFists.Value; } SkillType skillType = val2.m_shared.m_skillType; SkillType val3 = skillType; SkillType val4 = val3; switch (val4 - 1) { case 0: dashForceWeapon = dashForceSwords.Value; dashTimeWeapon = dashTimeSwords.Value; return allowSwords.Value; case 1: dashForceWeapon = dashForceKnives.Value; dashTimeWeapon = dashTimeKnives.Value; return allowKnives.Value; case 2: dashForceWeapon = dashForceClubs.Value; dashTimeWeapon = dashTimeClubs.Value; return allowClubs.Value; case 3: dashForceWeapon = dashForcePolearms.Value; dashTimeWeapon = dashTimePolearms.Value; return allowPolearms.Value; case 4: dashForceWeapon = dashForceSpears.Value; dashTimeWeapon = dashTimeSpears.Value; return allowSpears.Value; case 6: dashForceWeapon = dashForceAxes.Value; dashTimeWeapon = dashTimeAxes.Value; return allowAxes.Value; case 7: dashForceWeapon = dashForceBows.Value; dashTimeWeapon = dashTimeBows.Value; return allowBows.Value; case 8: dashForceWeapon = dashForceElementalMagic.Value; dashTimeWeapon = dashTimeElementalMagic.Value; return allowElementalMagic.Value; case 9: dashForceWeapon = dashForceBloodMagic.Value; dashTimeWeapon = dashTimeBloodMagic.Value; return allowBloodMagic.Value; case 10: dashForceWeapon = dashForceUnarmed.Value; dashTimeWeapon = dashTimeUnarmed.Value; return allowUnarmed.Value; case 11: dashForceWeapon = dashForcePickaxes.Value; dashTimeWeapon = dashTimePickaxes.Value; return allowPickaxes.Value; case 13: dashForceWeapon = dashForceCrossbows.Value; dashTimeWeapon = dashTimeCrossbows.Value; return allowCrossbows.Value; default: return false; } } public static void UpdateQuickstep(Player player, float dt, float dashForceWeapon, float dashTimeWeapon) { player.m_queuedDodgeTimer -= dt; if (player.m_queuedDodgeTimer > 0f && ((Character)player).IsOnGround() && !((Character)player).IsDead() && !((Character)player).InAttack() && !((Character)player).IsEncumbered() && !((Character)player).InDodge() && !((Character)player).IsStaggering() && !isDashed && !((Character)player).InEmote() && !((Character)player).IsAttached()) { float dodgeStaminaUse = player.GetDodgeStaminaUse(); dodgeStaminaUse *= dashStaminaMultiplier.Value; if (((Character)player).HaveStamina(dodgeStaminaUse)) { PerformQuickstep(player, dodgeStaminaUse, dashForceWeapon, dashTimeWeapon); } else { Hud.instance.StaminaBarEmptyFlash(); } } } public static void PerformQuickstep(Player player, float staminaUse, float dashForceWeapon, float dashTimeWeapon) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Invalid comparison between Unknown and I4 //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) player.m_queuedDodgeTimer = 0f; ItemData leftItem = ((Humanoid)player).GetLeftItem(); bool reducedIFrames = leftItem != null && (int)(leftItem.m_shared?.m_itemType).GetValueOrDefault() == 5; if (!((Character)player).IsCrouching()) { ((Character)player).m_zanim.SetBool("equipping", true); } ((Character)player).AddNoise(3f); ((Character)player).UseStamina(staminaUse); ((Character)player).UpdateBodyFriction(); player.m_dodgeEffects.Create(((Component)player).transform.position, Quaternion.identity, ((Component)player).transform, 1f, -1, default(ZDOID)); ((MonoBehaviour)player).StartCoroutine(Dash(player, player.m_queuedDodgeDir, reducedIFrames, dashForceWeapon, dashTimeWeapon, ((Character)player).m_currentVel)); } } }