using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using Dolso;
using Dolso.RiskofOptions;
using EntityStates;
using EntityStates.Chef;
using HG;
using HG.GeneralSerializer;
using HG.Reflection;
using ItemStatistics;
using ItemStatistics.Components;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using MonoMod.RuntimeDetour;
using R2API;
using R2API.ContentManagement;
using R2API.ScriptableObjects;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using RoR2.Projectile;
using RoR2.Skills;
using TMPro;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.ResourceManagement.AsyncOperations;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Cleaverang")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Cleaverang")]
[assembly: AssemblyTitle("Cleaverang")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Dolso
{
internal static class log
{
private static ManualLogSource logger;
internal static void start(ManualLogSource logSource)
{
logger = logSource;
}
internal static void start(string name)
{
logger = Logger.CreateLogSource(name);
}
internal static void debug(object data)
{
logger.LogDebug(data);
}
internal static void info(object data)
{
logger.LogInfo(data);
}
internal static void message(object data)
{
logger.LogMessage(data);
}
internal static void warning(object data)
{
logger.LogWarning(data);
}
internal static void error(object data)
{
logger.LogError(data);
}
internal static void fatal(object data)
{
logger.LogFatal(data);
}
internal static void LogError(this ILCursor c, object data)
{
logger.LogError((object)string.Format($"ILCursor failure, skipping: {data}\n{c}"));
}
internal static void LogErrorCaller(this ILCursor c, object data, [CallerMemberName] string callerName = "")
{
logger.LogError((object)string.Format($"ILCursor failure in {callerName}, skipping: {data}\n{c}"));
}
}
internal static class HookManager
{
internal delegate bool ConfigEnabled<T>(ConfigEntry<T> configEntry);
internal const BindingFlags allFlags = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;
private static ILHookConfig ilHookConfig = new ILHookConfig
{
ManualApply = true
};
private static HookConfig onHookConfig = new HookConfig
{
ManualApply = true
};
private static readonly ConfigEnabled<bool> boolConfigEnabled = (ConfigEntry<bool> configEntry) => configEntry.Value;
internal static void Hook(Type typeFrom, string methodFrom, Manipulator ilHook)
{
HookInternal(GetMethod(typeFrom, methodFrom), ilHook);
}
internal static void Hook(MethodBase methodFrom, Manipulator ilHook)
{
HookInternal(methodFrom, ilHook);
}
internal static void Hook(Delegate from, Manipulator ilHook)
{
HookInternal(from.Method, ilHook);
}
internal static void Hook<T>(Expression<Action<T>> from, Manipulator ilHook)
{
HookInternal(((MethodCallExpression)from.Body).Method, ilHook);
}
internal static void Hook(Type typeFrom, string methodFrom, Delegate onHook)
{
HookInternal(GetMethod(typeFrom, methodFrom), onHook.Method, onHook.Target);
}
internal static void Hook(MethodBase methodFrom, MethodInfo onHook)
{
HookInternal(methodFrom, onHook, null);
}
internal static void Hook(MethodBase methodFrom, Delegate onHook)
{
HookInternal(methodFrom, onHook.Method, onHook.Target);
}
internal static void Hook(Delegate from, Delegate onHook)
{
HookInternal(from.Method, onHook.Method, onHook.Target);
}
internal static void Hook<T>(Expression<Action<T>> from, Delegate onHook)
{
HookInternal(((MethodCallExpression)from.Body).Method, onHook.Method, onHook.Target);
}
internal static void Hook(Type typeFrom, string methodFrom, Delegate onHook, object instance)
{
HookInternal(GetMethod(typeFrom, methodFrom), onHook.Method, instance);
}
internal static void Hook(MethodBase methodFrom, MethodInfo onHook, object target)
{
HookInternal(methodFrom, onHook, target);
}
private static void HookInternal(MethodBase methodFrom, Manipulator ilHook)
{
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
if (methodFrom == null)
{
log.error("null MethodFrom for hook: " + ((Delegate)(object)ilHook).Method.Name);
return;
}
try
{
new ILHook(methodFrom, ilHook, ref ilHookConfig).Apply();
}
catch (Exception ex)
{
log.error($"Failed to apply ILHook: {methodFrom.DeclaringType}.{methodFrom.Name} - {((Delegate)(object)ilHook).Method.Name}\n{ex}");
}
}
private static void HookInternal(MethodBase methodFrom, MethodInfo onHook, object target)
{
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
if (methodFrom == null)
{
log.error("null methodFrom for hook: " + onHook.Name);
return;
}
try
{
new Hook(methodFrom, onHook, target, ref onHookConfig).Apply();
}
catch (Exception ex)
{
log.error($"Failed to apply onHook: {methodFrom.DeclaringType}.{methodFrom.Name} - {onHook.Name}\n{ex}");
}
}
internal static void HookConfig<T>(this ConfigEntry<T> configEntry, ConfigEnabled<T> enabled, Type typeFrom, string methodFrom, Manipulator ilHook)
{
configEntry.AddHookConfig(enabled, GetMethod(typeFrom, methodFrom), ilHook);
}
internal static void HookConfig<T>(this ConfigEntry<T> configEntry, ConfigEnabled<T> enabled, MethodBase methodFrom, Manipulator ilHook)
{
configEntry.AddHookConfig(enabled, methodFrom, ilHook);
}
internal static void HookConfig<T>(this ConfigEntry<T> configEntry, ConfigEnabled<T> enabled, Type typeFrom, string methodFrom, Delegate onHook)
{
configEntry.AddHookConfig(enabled, GetMethod(typeFrom, methodFrom), onHook.Method, onHook.Target);
}
internal static void HookConfig<T>(this ConfigEntry<T> configEntry, ConfigEnabled<T> enabled, MethodBase methodFrom, Delegate onHook)
{
configEntry.AddHookConfig(enabled, methodFrom, onHook.Method, onHook.Target);
}
internal static void HookConfig(this ConfigEntry<bool> configEntry, Type typeFrom, string methodFrom, Manipulator ilHook)
{
configEntry.AddHookConfig(boolConfigEnabled, GetMethod(typeFrom, methodFrom), ilHook);
}
internal static void HookConfig(this ConfigEntry<bool> configEntry, MethodBase methodFrom, Manipulator ilHook)
{
configEntry.AddHookConfig(boolConfigEnabled, methodFrom, ilHook);
}
internal static void HookConfig(this ConfigEntry<bool> configEntry, Type typeFrom, string methodFrom, Delegate onHook)
{
configEntry.AddHookConfig(boolConfigEnabled, GetMethod(typeFrom, methodFrom), onHook.Method, onHook.Target);
}
internal static void HookConfig(this ConfigEntry<bool> configEntry, MethodBase methodFrom, Delegate onHook)
{
configEntry.AddHookConfig(boolConfigEnabled, methodFrom, onHook.Method, onHook.Target);
}
private static void AddHookConfig<T>(this ConfigEntry<T> configEntry, ConfigEnabled<T> enabled, MethodBase methodFrom, Manipulator ilHook)
{
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Expected O, but got Unknown
if (methodFrom == null)
{
log.error("null MethodFrom for hook: " + ((Delegate)(object)ilHook).Method.Name);
return;
}
try
{
configEntry.AddHookConfig(enabled, (IDetour)new ILHook(methodFrom, ilHook, ref ilHookConfig));
}
catch (Exception ex)
{
log.error($"Failed to ilHook {methodFrom.DeclaringType}.{methodFrom.Name} - {((Delegate)(object)ilHook).Method.Name}\n{ex}");
}
}
private static void AddHookConfig<T>(this ConfigEntry<T> configEntry, ConfigEnabled<T> enabled, MethodBase methodFrom, MethodInfo onHook, object target)
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Expected O, but got Unknown
if (methodFrom == null)
{
log.error("null MethodFrom for hook: " + onHook.Name);
return;
}
try
{
configEntry.AddHookConfig(enabled, (IDetour)new Hook(methodFrom, onHook, target, ref onHookConfig));
}
catch (Exception ex)
{
log.error($"Failed to onHook {methodFrom.DeclaringType}.{methodFrom.Name} - {onHook.Name}\n{ex}");
}
}
private static void AddHookConfig<T>(this ConfigEntry<T> configEntry, ConfigEnabled<T> enabled, IDetour detour)
{
configEntry.SettingChanged += delegate(object sender, EventArgs args)
{
UpdateHook(detour, enabled(sender as ConfigEntry<T>));
};
if (enabled(configEntry))
{
detour.Apply();
}
}
private static void UpdateHook(IDetour hook, bool enabled)
{
if (enabled)
{
if (!hook.IsApplied)
{
hook.Apply();
}
}
else if (hook.IsApplied)
{
hook.Undo();
}
}
internal static void PriorityFirst()
{
ilHookConfig.Before = new string[1] { "*" };
onHookConfig.Before = new string[1] { "*" };
}
internal static void PriorityLast()
{
ilHookConfig.After = new string[1] { "*" };
onHookConfig.After = new string[1] { "*" };
}
internal static void PriorityNormal()
{
ilHookConfig.Before = null;
onHookConfig.Before = null;
ilHookConfig.After = null;
onHookConfig.After = null;
}
internal static IDetour ManualDetour(Type typeFrom, string methodFrom, Delegate onHook)
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Expected O, but got Unknown
try
{
return (IDetour)new Hook((MethodBase)GetMethod(typeFrom, methodFrom), onHook, ref onHookConfig);
}
catch (Exception ex)
{
log.error($"Failed to make onHook {typeFrom}.{methodFrom} - {onHook.Method.Name}\n{ex}");
}
return null;
}
internal static MethodInfo GetMethod(Type typeFrom, string methodFrom)
{
if (typeFrom == null || methodFrom == null)
{
return null;
}
IEnumerable<MethodInfo> source = from predicate in typeFrom.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)
where predicate.Name == methodFrom
select predicate;
if (source.Count() == 1)
{
return source.First();
}
if (source.Count() == 0)
{
log.error($"Failed to find method: {typeFrom}.{methodFrom}");
}
if (source.Count() > 1)
{
log.error($"{source.Count()} ambiguous matches found for: {typeFrom}.{methodFrom}");
}
return null;
}
}
internal static class Utilities
{
private static GameObject _prefabParent;
internal static GameObject CreatePrefab(GameObject gameObject)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Expected O, but got Unknown
if (!Object.op_Implicit((Object)(object)_prefabParent))
{
_prefabParent = new GameObject("DolsoPrefabs");
Object.DontDestroyOnLoad((Object)(object)_prefabParent);
((Object)_prefabParent).hideFlags = (HideFlags)61;
_prefabParent.SetActive(false);
}
return Object.Instantiate<GameObject>(gameObject, _prefabParent.transform);
}
internal static GameObject CreatePrefab(GameObject gameObject, string name)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Expected O, but got Unknown
if (!Object.op_Implicit((Object)(object)_prefabParent))
{
_prefabParent = new GameObject("DolsoPrefabs");
Object.DontDestroyOnLoad((Object)(object)_prefabParent);
((Object)_prefabParent).hideFlags = (HideFlags)61;
_prefabParent.SetActive(false);
}
GameObject val = Object.Instantiate<GameObject>(gameObject, _prefabParent.transform);
((Object)val).name = name;
return val;
}
internal static MethodInfo MakeGenericMethod<T>(this Type type, string methodName, params Type[] parameters)
{
return type.GetMethod(methodName, parameters).MakeGenericMethod(typeof(T));
}
internal static MethodInfo MakeGenericGetComponentG<T>() where T : Component
{
return typeof(GameObject).GetMethod("GetComponent", Type.EmptyTypes).MakeGenericMethod(typeof(T));
}
internal static MethodInfo MakeGenericGetComponentC<T>() where T : Component
{
return typeof(Component).GetMethod("GetComponent", Type.EmptyTypes).MakeGenericMethod(typeof(T));
}
internal static AssetBundle LoadAssetBundle(string bundlePathName)
{
AssetBundle result = null;
try
{
result = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), bundlePathName));
}
catch (Exception ex)
{
log.error("Failed to load assetbundle\n" + ex);
}
return result;
}
internal static Obj GetAddressable<Obj>(string addressable) where Obj : Object
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
return Addressables.LoadAssetAsync<Obj>((object)addressable).WaitForCompletion();
}
internal static GameObject GetAddressable(string addressable)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
return Addressables.LoadAssetAsync<GameObject>((object)addressable).WaitForCompletion();
}
internal static void GetAddressable<Obj>(string addressable, Action<Obj> callback) where Obj : Object
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
AsyncOperationHandle<Obj> val = Addressables.LoadAssetAsync<Obj>((object)addressable);
val.Completed += delegate(AsyncOperationHandle<Obj> a)
{
callback(a.Result);
};
}
internal static void GetAddressable(string addressable, Action<GameObject> callback)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
AsyncOperationHandle<GameObject> val = Addressables.LoadAssetAsync<GameObject>((object)addressable);
val.Completed += delegate(AsyncOperationHandle<GameObject> a)
{
callback(a.Result);
};
}
internal static void AddressableAddComp<Comp>(string addressable) where Comp : Component
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
AsyncOperationHandle<GameObject> val = Addressables.LoadAssetAsync<GameObject>((object)addressable);
val.Completed += delegate(AsyncOperationHandle<GameObject> a)
{
a.Result.AddComponent<Comp>();
};
}
internal static void AddressableAddComp<Comp>(string addressable, Action<Comp> callback) where Comp : Component
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
AsyncOperationHandle<GameObject> val = Addressables.LoadAssetAsync<GameObject>((object)addressable);
val.Completed += delegate(AsyncOperationHandle<GameObject> a)
{
callback(a.Result.AddComponent<Comp>());
};
}
internal static void AddressableAddCompSingle<Comp>(string addressable) where Comp : Component
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
AsyncOperationHandle<GameObject> val = Addressables.LoadAssetAsync<GameObject>((object)addressable);
val.Completed += delegate(AsyncOperationHandle<GameObject> a)
{
if (!Object.op_Implicit((Object)(object)a.Result.GetComponent<Comp>()))
{
a.Result.AddComponent<Comp>();
}
};
}
internal static void SetStateConfigIndex(this EntityStateConfiguration stateConfig, string fieldName, string newValue)
{
ref SerializedField[] serializedFields = ref stateConfig.serializedFieldsCollection.serializedFields;
for (int i = 0; i < serializedFields.Length; i++)
{
if (serializedFields[i].fieldName == fieldName)
{
serializedFields[i].fieldValue.stringValue = newValue;
return;
}
}
log.error("failed to find " + fieldName + " for " + ((Object)stateConfig).name);
}
internal static void SetStateConfigIndex(this EntityStateConfiguration stateConfig, string fieldName, Object newValue)
{
ref SerializedField[] serializedFields = ref stateConfig.serializedFieldsCollection.serializedFields;
for (int i = 0; i < serializedFields.Length; i++)
{
if (serializedFields[i].fieldName == fieldName)
{
serializedFields[i].fieldValue.objectValue = newValue;
return;
}
}
log.error("failed to find " + fieldName + " for " + ((Object)stateConfig).name);
}
internal static bool IsKeyDown(this ConfigEntry<KeyboardShortcut> key)
{
//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_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
KeyboardShortcut value = key.Value;
if (!Input.GetKey(((KeyboardShortcut)(ref value)).MainKey))
{
return false;
}
value = key.Value;
foreach (KeyCode modifier in ((KeyboardShortcut)(ref value)).Modifiers)
{
if (!Input.GetKey(modifier))
{
return false;
}
}
return true;
}
internal static bool IsKeyJustPressed(this ConfigEntry<KeyboardShortcut> key)
{
//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_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
KeyboardShortcut value = key.Value;
if (!Input.GetKeyDown(((KeyboardShortcut)(ref value)).MainKey))
{
return false;
}
value = key.Value;
foreach (KeyCode modifier in ((KeyboardShortcut)(ref value)).Modifiers)
{
if (!Input.GetKey(modifier))
{
return false;
}
}
return true;
}
internal static bool ContainsString(string source, string value)
{
return CultureInfo.InvariantCulture.CompareInfo.IndexOf(source, value, CompareOptions.IgnoreCase | CompareOptions.IgnoreSymbols) >= 0;
}
}
}
namespace Dolso.RiskofOptions
{
internal static class RiskofOptions
{
internal const string rooGuid = "com.rune580.riskofoptions";
internal static bool enabled => Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions");
internal static void SetSprite(Sprite sprite)
{
ModSettingsManager.SetModIcon(sprite);
}
internal static void SetSpriteDefaultIcon()
{
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Expected O, but got Unknown
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
DirectoryInfo directoryInfo = new DirectoryInfo(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));
string path = ((!(directoryInfo.Name == "plugins")) ? directoryInfo.FullName : directoryInfo.Parent.FullName);
try
{
Texture2D val = new Texture2D(256, 256);
if (ImageConversion.LoadImage(val, File.ReadAllBytes(Path.Combine(path, "icon.png"))))
{
ModSettingsManager.SetModIcon(Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f)));
}
else
{
log.error("Failed to load icon.png");
}
}
catch (Exception ex)
{
log.error("Failed to load icon.png\n" + ex);
}
}
internal static void AddBool(ConfigEntry<bool> entry)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(entry, new CheckBoxConfig
{
description = ((ConfigEntryBase)(object)entry).DescWithDefault()
}));
}
internal static void AddBool(ConfigEntry<bool> entry, string categoryName, string name)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Expected O, but got Unknown
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Expected O, but got Unknown
ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(entry, new CheckBoxConfig
{
category = categoryName,
name = name,
description = ((ConfigEntryBase)(object)entry).DescWithDefault()
}));
}
internal static void AddBool(ConfigEntry<bool> entry, string categoryName)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Expected O, but got Unknown
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Expected O, but got Unknown
ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(entry, new CheckBoxConfig
{
category = categoryName,
description = ((ConfigEntryBase)(object)entry).DescWithDefault()
}));
}
internal static void AddEnum<T>(ConfigEntry<T> entry) where T : Enum
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
ModSettingsManager.AddOption((BaseOption)new ChoiceOption((ConfigEntryBase)(object)entry, new ChoiceConfig
{
description = ((ConfigEntryBase)(object)entry).DescWithDefault()
}));
}
internal static void AddColor(ConfigEntry<Color> entry)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
ModSettingsManager.AddOption((BaseOption)new ColorOption(entry, new ColorOptionConfig
{
description = ((ConfigEntryBase)(object)entry).DescWithDefault()
}));
}
internal static void AddKey(ConfigEntry<KeyboardShortcut> entry)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
ModSettingsManager.AddOption((BaseOption)new KeyBindOption(entry, new KeyBindConfig
{
description = ((ConfigEntryBase)(object)entry).DescWithDefault()
}));
}
internal static void AddFloat(ConfigEntry<float> entry, float min, float max, string format = "{0:f2}")
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Expected O, but got Unknown
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Expected O, but got Unknown
ModSettingsManager.AddOption((BaseOption)new SliderOption(entry, new SliderConfig
{
min = min,
max = max,
formatString = format,
description = ((ConfigEntryBase)(object)entry).DescWithDefault(format)
}));
}
internal static void AddFloat(ConfigEntry<float> entry, string categoryName, float min, float max, string format = "{0:f2}")
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Expected O, but got Unknown
ModSettingsManager.AddOption((BaseOption)new SliderOption(entry, new SliderConfig
{
min = min,
max = max,
formatString = format,
category = categoryName,
description = ((ConfigEntryBase)(object)entry).DescWithDefault(format)
}));
}
internal static void AddFloatField(ConfigEntry<float> entry, float min = float.MinValue, float max = float.MaxValue, string format = "{0:f2}")
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Expected O, but got Unknown
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Expected O, but got Unknown
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Expected O, but got Unknown
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Expected O, but got Unknown
FloatFieldConfig val = new FloatFieldConfig();
((NumericFieldConfig<float>)val).Min = min;
((NumericFieldConfig<float>)val).Max = max;
((BaseOptionConfig)val).description = ((ConfigEntryBase)(object)entry).DescWithDefault(format);
ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(entry, val));
}
internal static void AddInt(ConfigEntry<int> entry, int min = int.MinValue, int max = int.MaxValue)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Expected O, but got Unknown
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Expected O, but got Unknown
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected O, but got Unknown
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Expected O, but got Unknown
IntFieldConfig val = new IntFieldConfig();
((NumericFieldConfig<int>)val).Min = min;
((NumericFieldConfig<int>)val).Max = max;
((BaseOptionConfig)val).description = ((ConfigEntryBase)(object)entry).DescWithDefault();
ModSettingsManager.AddOption((BaseOption)new IntFieldOption(entry, val));
}
internal static void AddIntSlider(ConfigEntry<int> entry, int min, int max)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Expected O, but got Unknown
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Expected O, but got Unknown
ModSettingsManager.AddOption((BaseOption)new IntSliderOption(entry, new IntSliderConfig
{
min = min,
max = max,
description = ((ConfigEntryBase)(object)entry).DescWithDefault()
}));
}
internal static void AddIntSlider(ConfigEntry<int> entry, string categoryName, int min, int max)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Expected O, but got Unknown
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Expected O, but got Unknown
ModSettingsManager.AddOption((BaseOption)new IntSliderOption(entry, new IntSliderConfig
{
min = min,
max = max,
category = categoryName,
description = ((ConfigEntryBase)(object)entry).DescWithDefault()
}));
}
internal static void AddString(ConfigEntry<string> entry)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Expected O, but got Unknown
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Expected O, but got Unknown
ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(entry, new InputFieldConfig
{
submitOn = (SubmitEnum)6,
lineType = (LineType)0,
description = ((ConfigEntryBase)(object)entry).DescWithDefault()
}));
}
internal static void AddOption(ConfigEntry<bool> entry)
{
AddBool(entry);
}
internal static void AddOption(ConfigEntry<bool> entry, string categoryName, string name)
{
AddBool(entry, categoryName, name);
}
internal static void AddOption(ConfigEntry<bool> entry, string categoryName)
{
AddBool(entry, categoryName);
}
internal static void AddOption<T>(ConfigEntry<T> entry) where T : Enum
{
AddEnum<T>(entry);
}
internal static void AddOption(ConfigEntry<Color> entry)
{
AddColor(entry);
}
internal static void AddOption(ConfigEntry<KeyboardShortcut> entry)
{
AddKey(entry);
}
internal static void AddOption(ConfigEntry<int> entry)
{
AddInt(entry);
}
internal static void AddOption(ConfigEntry<string> entry)
{
AddString(entry);
}
private static string DescWithDefault(this ConfigEntryBase entry)
{
return $"{entry.Description.Description}\n[Default: {entry.DefaultValue}]";
}
private static string DescWithDefault(this ConfigEntryBase entry, string format)
{
return string.Format("{1}\n[Default: " + format + "]", entry.DefaultValue, entry.Description.Description);
}
}
}
namespace Cleaverang
{
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("dolso.Cleaverang", "Cleaverang", "1.0.1")]
public class CleaverangPlugin : BaseUnityPlugin
{
public const string modguid = "dolso.Cleaverang";
internal const string version = "1.0.1";
internal const string itemStatisticsGuid = "dolso.ItemStatistics";
internal static GameObject cleaverangPrefab;
internal static GameObject cleaverangBoostedPrefab;
internal static AssetBundle assetBundle;
internal static SkillDef cSkill;
internal static SkillDef cSkillBoosted;
internal static int cleaverangIndex;
internal static int cleaverangBoostedIndex;
private static R2APISerializableContentPack contentPack;
private void Awake()
{
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
log.start(((BaseUnityPlugin)this).Logger);
assetBundle = Utilities.LoadAssetBundle("cleaverang");
Config.DoConfig(((BaseUnityPlugin)this).Config);
contentPack = ScriptableObject.CreateInstance<R2APISerializableContentPack>();
((Object)contentPack).name = "dolso.Cleaverang";
R2APIContentManager.BepInModNameToSerializableContentPack.Add("dolso.Cleaverang", new ManagedSerializableContentPack(contentPack, true, Assembly.GetExecutingAssembly()));
Utilities.GetAddressable("RoR2/Base/Saw/Sawmerang.prefab", SetupProjs);
SetupSkillDefs();
ConfigEvents();
Hooks.DoHooks();
RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(OnLoad));
}
private static void SetupProjs(GameObject saw)
{
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Expected O, but got Unknown
cleaverangPrefab = MakeCleaverangPrefab(saw, "DolsoCleaverang");
cleaverangBoostedPrefab = MakeCleaverangPrefab(saw, "DolsoCleaverangBoosted");
cleaverangBoostedPrefab.GetComponent<BoomerangProjectile>().canHitWorld = false;
ProjectileController component = cleaverangBoostedPrefab.GetComponent<ProjectileController>();
component.ghostPrefab = PrefabAPI.InstantiateClone(component.ghostPrefab, "DolsoCleaverangBoostedGhost", false);
MeshRenderer componentInChildren = component.ghostPrefab.GetComponentInChildren<MeshRenderer>();
((Renderer)componentInChildren).material = new Material(((Renderer)componentInChildren).material);
((Object)((Renderer)componentInChildren).material).name = "matSawmerangRed";
((Renderer)componentInChildren).material.mainTexture = assetBundle.LoadAsset<Texture>("texSawmerangRedDiffuse.png");
if (Chainloader.PluginInfos.ContainsKey("dolso.ItemStatistics"))
{
AddISProcComponent();
}
}
private static GameObject MakeCleaverangPrefab(GameObject addressable, string name)
{
GameObject val = PrefabAPI.InstantiateClone(addressable, name);
val.GetComponent<ProjectileOverlapAttack>().damageCoefficient = 3f;
val.GetComponent<ProjectileDotZone>().overlapProcCoefficient = Config.procCoef.Value;
val.GetComponent<ProjectileController>().allowPrediction = false;
val.GetComponent<BoomerangProjectile>().EnableNetworkClientCatchup = false;
ProjectileInflictTimedBuff debuff = val.AddComponent<ProjectileInflictTimedBuff>();
debuff.duration = 100f;
Utilities.GetAddressable<BuffDef>("RoR2/DLC2/Chef/Buffs/bdCookingChopped.asset", (Action<BuffDef>)delegate(BuffDef a)
{
debuff.buffDef = a;
});
ArrayUtils.ArrayAppend<GameObject>(ref contentPack.projectilePrefabs, ref val);
return val;
}
private static void AddISProcComponent()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
cleaverangPrefab.AddComponent<ProcComponent>().index = Index.op_Implicit((SkillSlot)0);
cleaverangBoostedPrefab.AddComponent<ProcComponent>().index = Index.op_Implicit((SkillSlot)3);
}
private static void SetupSkillDefs()
{
cSkill = LoadSkillDef("CleaverangSkill");
cSkillBoosted = LoadSkillDef("CleaverangBoostedSkill");
Utilities.GetAddressable<GameObject>("RoR2/DLC2/Chef/ChefBody.prefab", (Action<GameObject>)delegate(GameObject a)
{
//IL_0017: 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_0041: Expected O, but got Unknown
ref Variant[] variants = ref a.GetComponent<SkillLocator>().primary.skillFamily.variants;
Variant val = new Variant
{
skillDef = cSkill
};
((Variant)(ref val)).viewableNode = new Node(cSkill.skillNameToken, false, (Node)null);
ArrayUtils.ArrayAppend<Variant>(ref variants, ref val);
});
ArrayUtils.ArrayAppend<SerializableEntityStateType>(ref contentPack.entityStateTypes, ref cSkill.activationState);
}
private static SkillDef LoadSkillDef(string assetname)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
SkillDef val = assetBundle.LoadAsset<SkillDef>(assetname);
val.activationState = new SerializableEntityStateType(typeof(ThrowCleaverang));
val.baseRechargeInterval = Config.cooldown.Value;
ArrayUtils.ArrayAppend<SkillDef>(ref contentPack.skillDefs, ref val);
return val;
}
private static void OnLoad()
{
cleaverangIndex = ProjectileCatalog.FindProjectileIndex("DolsoCleaverang");
cleaverangBoostedIndex = ProjectileCatalog.FindProjectileIndex("DolsoCleaverangBoosted");
}
private static void ConfigEvents()
{
Config.cooldown.SettingChanged += delegate
{
cSkill.baseRechargeInterval = Config.cooldown.Value;
cSkillBoosted.baseRechargeInterval = Config.cooldown.Value;
};
Config.procCoef.SettingChanged += delegate
{
cleaverangPrefab.GetComponent<ProjectileDotZone>().overlapProcCoefficient = Config.procCoef.Value;
cleaverangBoostedPrefab.GetComponent<ProjectileDotZone>().overlapProcCoefficient = Config.procCoef.Value;
};
}
}
internal class Config
{
private static ConfigFile configFile;
private static ConfigEntry<string> version;
internal static ConfigEntry<float> damage;
internal static ConfigEntry<float> bleedChance;
internal static ConfigEntry<float> procCoef;
internal static ConfigEntry<float> cooldown;
internal static ConfigEntry<float> interval;
internal static void DoConfig(ConfigFile bepConfigFile)
{
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Expected O, but got Unknown
configFile = bepConfigFile;
damage = configFile.Bind<float>("Stats", "Damage", 0.8f, "Damage multiplier of hits");
bleedChance = configFile.Bind<float>("Stats", "Bleed Chance", 40f, new ConfigDescription("Bleed chance of boosted (from Yes Chef) Cleaverangs", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), Array.Empty<object>()));
procCoef = configFile.Bind<float>("Stats", "Proc Coefficient", 0.9f, "Proc coefficient of the repeated hits");
cooldown = configFile.Bind<float>("Stats", "Cooldown", 2.25f, "Cooldown of Cleaverang. For reference vanilla Dice cooldown is 1.75s");
interval = configFile.Bind<float>("Stats", "Attack Interval", 0.5f, "Interval between attacks");
version = configFile.Bind<string>("", "Config Version", "1.0.1", "Config version, if this is different from current version, resets config");
if (version.Value != "1.0.1")
{
configFile.Clear();
DoConfig(configFile);
}
else if (RiskofOptions.enabled)
{
DoRiskOfOptions();
}
}
internal static void DoRiskOfOptions()
{
RiskofOptions.SetSprite(CleaverangPlugin.assetBundle.LoadAsset<Sprite>("CleaverangIcon"));
RiskofOptions.AddFloat(damage, 0f, 1.5f);
RiskofOptions.AddFloat(bleedChance, 0f, 100f, "{0:f0}");
RiskofOptions.AddFloat(procCoef, 0f, 2f);
RiskofOptions.AddFloat(cooldown, 0.5f, 6f);
RiskofOptions.AddFloat(interval, 0f, 1.5f);
}
[ConCommand(/*Could not decode attribute arguments.*/)]
private static void ReloadConfig(ConCommandArgs args)
{
configFile.Reload();
Debug.Log((object)"Cleaverang config reloaded");
}
}
internal class Hooks
{
internal static void DoHooks()
{
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Expected O, but got Unknown
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Expected O, but got Unknown
HookManager.Hook(typeof(YesChef), "OnEnter", (Delegate)new Action<Action<YesChef>, YesChef>(On_YesChef_OnEnter_AddOverride));
HookManager.Hook(typeof(GlobalEventManager), "ProcessHitEnemy", new Manipulator(IL_GlobalEventManager_OnHitEnemy_SetBleed));
HookManager.Hook(typeof(BoomerangProjectile), "Start", (Delegate)new Action<Action<BoomerangProjectile>, BoomerangProjectile>(OnBoomerangProjectile_Start_SetVelocity));
HookManager.Hook(typeof(BoomerangProjectile), "FixedUpdate", new Manipulator(IL_BoomerangProjectile_FixedUpdate_ChangeFlightPath));
}
private static void On_YesChef_OnEnter_AddOverride(Action<YesChef> orig, YesChef self)
{
if ((Object)(object)((EntityState)self).skillLocator.primary.skillDef == (Object)(object)CleaverangPlugin.cSkill)
{
self.primarySkillOverrideDef = CleaverangPlugin.cSkillBoosted;
}
orig(self);
}
private static void IL_GlobalEventManager_OnHitEnemy_SetBleed(ILContext il)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Expected O, but got Unknown
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: Unknown result type (might be due to invalid IL or missing references)
//IL_0163: Unknown result type (might be due to invalid IL or missing references)
ILCursor val = new ILCursor(il);
int masterIndex = 5;
if (!val.TryGotoNext(new Func<Instruction, bool>[1]
{
(Instruction a) => ILPatternMatchingExt.MatchCallOrCallvirt(a, typeof(CharacterBody), "get_master")
}) || !val.TryGotoNext(new Func<Instruction, bool>[1]
{
(Instruction a) => ILPatternMatchingExt.MatchStloc(a, ref masterIndex)
}))
{
val.LogErrorCaller("master index", "IL_GlobalEventManager_OnHitEnemy_SetBleed");
return;
}
ILLabel branchFalse = null;
int sawFlagIndex = 111;
if (val.TryGotoNext(new Func<Instruction, bool>[1]
{
(Instruction a) => ILPatternMatchingExt.MatchLdsfld(a, typeof(Equipment), "Saw")
}) && val.TryGotoNext(new Func<Instruction, bool>[1]
{
(Instruction a) => ILPatternMatchingExt.MatchBneUn(a, ref branchFalse)
}) && val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
{
(Instruction a) => ILPatternMatchingExt.MatchStloc(a, ref sawFlagIndex)
}))
{
val.Emit(OpCodes.Br, (object)branchFalse);
val.Emit(OpCodes.Ldarg_1);
Instruction prev = val.Prev;
val.Emit(OpCodes.Ldloc, masterIndex);
val.EmitDelegate<Func<DamageInfo, CharacterMaster, int>>((Func<DamageInfo, CharacterMaster, int>)delegate(DamageInfo damageInfo, CharacterMaster master)
{
ProjectileController component = damageInfo.inflictor.GetComponent<ProjectileController>();
return (!Object.op_Implicit((Object)(object)component) || (component.catalogIndex != CleaverangPlugin.cleaverangIndex && (component.catalogIndex != CleaverangPlugin.cleaverangBoostedIndex || Util.CheckRoll(Config.bleedChance.Value, master)))) ? 1 : 0;
});
val.Emit(OpCodes.Stloc, sawFlagIndex);
val.GotoPrev(new Func<Instruction, bool>[1]
{
(Instruction a) => ILPatternMatchingExt.MatchBneUn(a, branchFalse)
});
val.Next.Operand = prev;
}
else
{
val.LogErrorCaller("saw bleed", "IL_GlobalEventManager_OnHitEnemy_SetBleed");
}
}
private static void OnBoomerangProjectile_Start_SetVelocity(Action<BoomerangProjectile> orig, BoomerangProjectile self)
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
orig(self);
if (self.projectileController.catalogIndex == CleaverangPlugin.cleaverangBoostedIndex)
{
self.rigidbody.velocity = self.travelSpeed * ((Component)self).transform.forward;
}
}
private static void IL_BoomerangProjectile_FixedUpdate_ChangeFlightPath(ILContext il)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
ILCursor val = new ILCursor(il);
if (!val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
{
(Instruction a) => ILPatternMatchingExt.MatchCallOrCallvirt(a, typeof(Rigidbody), "set_velocity")
}))
{
return;
}
ILLabel val2 = val.MarkLabel();
if (val.TryGotoPrev(new Func<Instruction, bool>[1]
{
(Instruction a) => ILPatternMatchingExt.MatchLdfld(a, typeof(BoomerangProjectile), "rigidbody")
}))
{
val.EmitDelegate<Func<BoomerangProjectile, bool>>((Func<BoomerangProjectile, bool>)((BoomerangProjectile self) => self.projectileController.catalogIndex == CleaverangPlugin.cleaverangBoostedIndex));
val.Emit(OpCodes.Brtrue, (object)val2);
val.Emit(OpCodes.Ldarg_0);
}
}
}
internal class ThrowCleaverang : BaseState
{
private static GameObject muzzleFlashPrefab;
private float baseDuration;
private bool boosted;
static ThrowCleaverang()
{
Utilities.GetAddressable("RoR2/DLC2/Chef/MuzzleflashChefDiceReturn.prefab", delegate(GameObject a)
{
muzzleFlashPrefab = a;
});
}
public override void OnEnter()
{
//IL_0142: Unknown result type (might be due to invalid IL or missing references)
//IL_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: 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_0228: Unknown result type (might be due to invalid IL or missing references)
//IL_022d: Unknown result type (might be due to invalid IL or missing references)
//IL_017c: Unknown result type (might be due to invalid IL or missing references)
//IL_0181: Unknown result type (might be due to invalid IL or missing references)
//IL_0186: Unknown result type (might be due to invalid IL or missing references)
//IL_0188: Unknown result type (might be due to invalid IL or missing references)
//IL_0196: Unknown result type (might be due to invalid IL or missing references)
//IL_019b: Unknown result type (might be due to invalid IL or missing references)
//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
//IL_01b9: 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_01c6: Unknown result type (might be due to invalid IL or missing references)
//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
//IL_01db: Unknown result type (might be due to invalid IL or missing references)
//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
//IL_0200: Unknown result type (might be due to invalid IL or missing references)
//IL_0202: Unknown result type (might be due to invalid IL or missing references)
//IL_0204: Unknown result type (might be due to invalid IL or missing references)
//IL_0209: Unknown result type (might be due to invalid IL or missing references)
//IL_0210: Unknown result type (might be due to invalid IL or missing references)
//IL_0215: Unknown result type (might be due to invalid IL or missing references)
((BaseState)this).OnEnter();
boosted = ((EntityState)this).characterBody.HasBuff(Buffs.Boosted);
if (boosted && NetworkServer.active)
{
((EntityState)this).characterBody.RemoveBuff(Buffs.Boosted);
}
baseDuration = Config.interval.Value;
float num = baseDuration / base.attackSpeedStat;
((BaseState)this).StartAimMode(num + 2f, false);
if (boosted)
{
((EntityState)this).PlayAnimation("Gesture, Override", "FireSliceAndDice", "FireSliceAndDice.playbackRate", num, 0f);
((EntityState)this).PlayAnimation("Gesture, Additive", "FireSliceAndDice", "FireSliceAndDice.playbackRate", num, 0f);
Util.PlaySound("Play_chef_skill1_boosted_shoot", ((EntityState)this).gameObject);
}
else
{
((EntityState)this).PlayAnimation("Gesture, Override", "FireDice", "FireDice.playbackRate", num, 0f);
((EntityState)this).PlayAnimation("Gesture, Additive", "FireDice", "FireDice.playbackRate", num, 0f);
Util.PlaySound("Play_chef_skill1_shoot", ((EntityState)this).gameObject);
}
EffectManager.SimpleMuzzleFlash(muzzleFlashPrefab, ((Component)((EntityState)this).characterBody.aimOriginTransform).gameObject, "MouthMuzzle", false);
if (((EntityState)this).isAuthority)
{
Ray aimRay = ((BaseState)this).GetAimRay();
Quaternion val = Util.QuaternionSafeLookRotation(((Ray)(ref aimRay)).direction);
if (boosted)
{
GameObject cleaverangBoostedPrefab = CleaverangPlugin.cleaverangBoostedPrefab;
float num2 = 15f;
Quaternion val2 = Quaternion.AngleAxis(90f, ((Ray)(ref aimRay)).direction);
Quaternion val3 = val * Quaternion.Euler(0f, num2, 0f);
FireSingleProjectile(cleaverangBoostedPrefab, ((Ray)(ref aimRay)).origin, val);
FireSingleProjectile(cleaverangBoostedPrefab, ((Ray)(ref aimRay)).origin, val3);
val3 = val2 * val3;
FireSingleProjectile(cleaverangBoostedPrefab, ((Ray)(ref aimRay)).origin, val3);
val3 = val2 * val3;
FireSingleProjectile(cleaverangBoostedPrefab, ((Ray)(ref aimRay)).origin, val3);
val3 = val2 * val3;
FireSingleProjectile(cleaverangBoostedPrefab, ((Ray)(ref aimRay)).origin, val3);
}
else
{
FireSingleProjectile(CleaverangPlugin.cleaverangPrefab, ((Ray)(ref aimRay)).origin, val);
}
}
}
private void FireSingleProjectile(GameObject prefab, Vector3 origin, Quaternion rotation)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
ProjectileManager.instance.FireProjectile(new FireProjectileInfo
{
projectilePrefab = prefab,
position = origin,
rotation = rotation,
owner = ((EntityState)this).gameObject,
damage = base.damageStat * Config.damage.Value,
crit = Util.CheckRoll(base.critStat, ((EntityState)this).characterBody.master),
force = 0f
});
}
public override void FixedUpdate()
{
((EntityState)this).FixedUpdate();
if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= baseDuration / ((EntityState)this).characterBody.attackSpeed)
{
((EntityState)this).outer.SetNextStateToMain();
}
}
public override void OnExit()
{
ChefController component = ((EntityState)this).GetComponent<ChefController>();
component.SetYesChefHeatState(false);
if (((EntityState)this).isAuthority)
{
component.ClearSkillOverrides();
}
if (NetworkServer.active)
{
((EntityState)this).characterBody.RemoveBuff(Buffs.boostedFireEffect);
}
((EntityState)this).OnExit();
}
public override InterruptPriority GetMinimumInterruptPriority()
{
return (InterruptPriority)1;
}
}
}