Decompiled source of FruityAspectsGaming v1.0.3
FruityElites.dll
Decompiled 4 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using EliteReworks.Components; using EliteReworks.EliteReworks; using EliteReworks.Equipment; using EliteReworks.Modules; using EntityStates; using HG; using IL.RoR2; using Mono.Cecil.Cil; using MonoMod.Cil; using MoreStats; using On.RoR2; using R2API; using R2API.Utils; using RoR2; using RoR2.Achievements; using RoR2.Audio; using RoR2.ContentManagement; using RoR2.ExpansionManagement; using RoR2.Networking; using RoR2.Orbs; using RoR2.Projectile; using RoR2.Skills; using RoR2BepInExPack.GameAssetPaths; using SwanSongExtended; 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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")] [assembly: AssemblyCompany("FruityElites")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("FruityElites")] [assembly: AssemblyTitle("FruityElites")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace EliteReworks { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] [R2APISubmoduleDependency(new string[] { "LanguageAPI", "PrefabAPI", "RecalculateStatsAPI", "DotAPI" })] [BepInPlugin("com.RiskOfBrainrot.FruityAspectGaming", "FruityAspectGaming", "1.0.0")] public class EliteReworksPlugin : BaseUnityPlugin { public static EliteReworksPlugin instance; public const string guid = "com.RiskOfBrainrot.FruityAspectGaming"; public const string teamName = "RiskOfBrainrot"; public const string modName = "FruityAspectGaming"; public const string version = "1.0.0"; public const string DEVELOPER_PREFIX = "FRUIT"; public static ExpansionDef expansionDefSS2; private float softEliteHealthBoostCoefficient = 2f; private float rareEliteHealthBoostCoefficient = 4f; private float baseEliteHealthBoostCoefficient = 3f; private float T2EliteHealthBoostCoefficient = 9f; private float rareEliteDamageBoostCoefficient = 2f; private float baseEliteDamageBoostCoefficient = 1.5f; private float T2EliteDamageBoostCoefficient = 4f; public static ConfigFile CustomConfigFile; public static AssetBundle mainAssetBundle => CommonAssets.mainAssetBundle; [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private void SetExpansion() { expansionDefSS2 = SwanSongPlugin.expansionDefSS2; } private void Awake() { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) instance = this; Config.Init(); Log.Init(((BaseUnityPlugin)this).Logger); Language.Init(); Hooks.Init(); CommonAssets.Init(); InitializeContent(); if (Bind("Change Elite Stats", "")) { RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(ChangeEliteTierStats)); } if (Bind("Add Periodical OnHitAll To BeetleGuard Sunder (Affects Overloading Orbs)", "")) { AssetReferenceT<GameObject> val = new AssetReferenceT<GameObject>(RoR2_Base_BeetleGuard.Sunder_prefab); AsyncOperationHandle<GameObject> val2 = AssetAsyncReferenceManager<GameObject>.LoadAsset(val, (AsyncReferenceHandleUnloadType)2); val2.Completed += delegate(AsyncOperationHandle<GameObject> ctx) { BuffSunder(ctx.Result); }; } static bool Bind(string configName, string configDesc) { return GetConfigBool(defaultValue: true, configName, configDesc); } } private void InitializeContent() { Type[] types = Assembly.GetExecutingAssembly().GetTypes(); BeginInitializing<EliteReworkBase>(types, "EliteReworks.txt"); BeginInitializing<EquipmentBase>(types, "EliteReworksEquipment.txt"); } private void BeginInitializing<T>(Type[] allTypes, string fileName = "") where T : SharedBase { Type baseType = typeof(T); if (!baseType.IsAbstract) { Log.Error(Log.Combine() + "Incorrect BaseType: " + baseType.Name); return; } IEnumerable<Type> enumerable = allTypes.Where((Type type) => !type.IsAbstract && type.IsSubclassOf(baseType)); if (enumerable.Count() <= 0) { return; } Log.Debug(Log.Combine(baseType.Name) + "Initializing"); foreach (Type item in enumerable) { string text = Log.Combine(baseType.Name, item.Name); Log.Debug(text); T obj = (T)Activator.CreateInstance(item); if (ValidateBaseType(obj)) { Log.Debug(text + "Validated"); InitializeBaseType(obj); Log.Debug(text + "Initialized"); } } if (!string.IsNullOrEmpty(fileName)) { Language.TryPrintOutput(fileName); } } private bool ValidateBaseType(SharedBase obj) { bool isEnabled = obj.isEnabled; if (obj.lockEnabled) { return isEnabled; } return obj.Bind(isEnabled, "Should This Content Be Enabled"); } private void InitializeBaseType(SharedBase obj) { obj.Init(); } private void BuffSunder(GameObject sunderPrefab) { ProjectileController component = sunderPrefab.GetComponent<ProjectileController>(); ProjectileDamage component2 = sunderPrefab.GetComponent<ProjectileDamage>(); OnHitAllInterval onHitAllInterval = sunderPrefab.AddComponent<OnHitAllInterval>(); onHitAllInterval.pc = component; onHitAllInterval.pd = component2; onHitAllInterval.interval = 0.25f; } private void ChangeEliteTierStats() { Elites.Fire.damageBoostCoefficient = baseEliteDamageBoostCoefficient; Elites.Fire.healthBoostCoefficient = baseEliteHealthBoostCoefficient; Elites.FireHonor.damageBoostCoefficient = baseEliteDamageBoostCoefficient; Elites.FireHonor.healthBoostCoefficient = baseEliteHealthBoostCoefficient / 2f; Elites.Ice.damageBoostCoefficient = baseEliteDamageBoostCoefficient; Elites.Ice.healthBoostCoefficient = baseEliteHealthBoostCoefficient; Elites.IceHonor.damageBoostCoefficient = baseEliteDamageBoostCoefficient; Elites.IceHonor.healthBoostCoefficient = baseEliteHealthBoostCoefficient / 2f; Elites.Lightning.damageBoostCoefficient = baseEliteDamageBoostCoefficient; Elites.Lightning.healthBoostCoefficient = baseEliteHealthBoostCoefficient; Elites.LightningHonor.damageBoostCoefficient = baseEliteDamageBoostCoefficient; Elites.LightningHonor.healthBoostCoefficient = baseEliteHealthBoostCoefficient / 2f; Elites.Poison.damageBoostCoefficient = T2EliteDamageBoostCoefficient; Elites.Poison.healthBoostCoefficient = T2EliteHealthBoostCoefficient; Elites.Haunted.damageBoostCoefficient = T2EliteDamageBoostCoefficient; Elites.Haunted.healthBoostCoefficient = T2EliteHealthBoostCoefficient; Elites.Earth.damageBoostCoefficient = baseEliteDamageBoostCoefficient; Elites.Earth.healthBoostCoefficient = softEliteHealthBoostCoefficient; Elites.EarthHonor.damageBoostCoefficient = baseEliteDamageBoostCoefficient; Elites.EarthHonor.healthBoostCoefficient = softEliteHealthBoostCoefficient / 2f; Elites.Aurelionite.damageBoostCoefficient = rareEliteDamageBoostCoefficient; Elites.Aurelionite.healthBoostCoefficient = rareEliteHealthBoostCoefficient; Elites.AurelioniteHonor.damageBoostCoefficient = rareEliteDamageBoostCoefficient; Elites.AurelioniteHonor.healthBoostCoefficient = rareEliteHealthBoostCoefficient / 2f; Elites.Bead.damageBoostCoefficient = T2EliteDamageBoostCoefficient; Elites.Bead.healthBoostCoefficient = T2EliteHealthBoostCoefficient; } public static bool GetConfigBool(bool defaultValue, string packetTitle, string desc = "") { return ConfigManager.DualBindToConfig("Elite Reworks", Config.MyConfig, packetTitle, defaultValue, desc); } public static ItemDef RetierItem(string itemName, ItemTier tier = 5) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) ItemDef def = LoadItemDef(itemName); return RetierItem(def, tier); } public static ItemDef RetierItem(ItemDef def, ItemTier tier = 5) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)def != (Object)null) { def.tier = tier; def.deprecatedTier = tier; } return def; } private static ItemDef LoadItemDef(string name) { return LegacyResourcesAPI.Load<ItemDef>("ItemDefs/" + name); } } internal static class Log { public static bool enableDebugging; internal static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { enableDebugging = ConfigManager.DualBindToConfig("Elite Reworks", Config.MyConfig, "Enable Debugging", defaultValue: false, "Enable debug outputs to the log for troubleshooting purposes. Enabling this will slow down the game."); _logSource = logSource; } internal static string Combine(params string[] parameters) { string text = "FruityAspectGaming : "; foreach (string text2 in parameters) { text = text + text2 + " : "; } return text; } internal static void Debug(object data) { if (enableDebugging) { _logSource.LogDebug(data); } } internal static void Error(object data) { _logSource.LogError(data); } internal static void ErrorAssetBundle(string assetName, string bundleName) { Error("failed to load asset, " + assetName + ", because it does not exist in asset bundle, " + bundleName); } internal static void Fatal(object data) { _logSource.LogFatal(data); } internal static void Info(object data) { _logSource.LogInfo(data); } internal static void Message(object data) { _logSource.LogMessage(data); } internal static void Warning(object data) { _logSource.LogWarning(data); } } public abstract class SharedBase { public virtual string BASE_TOKEN => TOKEN_PREFIX + TOKEN_IDENTIFIER; public abstract string TOKEN_IDENTIFIER { get; } public abstract string TOKEN_PREFIX { get; } public virtual bool lockEnabled { get; } = false; public abstract string ConfigName { get; } public virtual bool isEnabled { get; } = true; public virtual ConfigFile configFile { get; } = Config.MyConfig; public static ManualLogSource Logger => Log._logSource; public abstract AssetBundle assetBundle { get; } public virtual Type RequiredUnlock { get; } public abstract void Hooks(); public abstract void Lang(); public virtual void Init() { ConfigManager.HandleConfigAttributes(GetType(), ConfigName, configFile); Hooks(); Lang(); } public T Bind<T>(T defaultValue, string configName, string configDesc = "") { return ConfigManager.DualBindToConfig(ConfigName, configFile, configName, defaultValue, configDesc); } public static float GetHyperbolic(float firstStack, float cap, float chance) { if (firstStack >= cap) { return cap * (chance / firstStack); } float num = chance / firstStack; float num2 = 100f * firstStack / (cap - firstStack); return cap * (1f - 100f / (num * num2 + 100f)); } } public static class Tools { public static string modPrefix = string.Format("@{0}+{1}", "ArtificerExtended", "artiskillicons"); public static AssetBundle LoadAssetBundle(byte[] resourceBytes) { if (resourceBytes == null) { throw new ArgumentNullException("resourceBytes"); } return AssetBundle.LoadFromMemory(resourceBytes); } public static string GetModPrefix(this BaseUnityPlugin plugin, string bundleName) { return $"@{plugin.Info.Metadata.Name}+{bundleName}"; } internal static bool isLoaded(string modguid) { foreach (KeyValuePair<string, PluginInfo> pluginInfo in Chainloader.PluginInfos) { string key = pluginInfo.Key; PluginInfo value = pluginInfo.Value; if (key == modguid) { return true; } } return false; } internal static string ConvertDecimal(float d) { return d * 100f + "%"; } internal static void GetMaterial(GameObject model, string childObject, Color color, ref Material material, float scaleMultiplier = 1f, bool replaceAll = false) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown //IL_0092: Unknown result type (might be due to invalid IL or missing references) Renderer[] componentsInChildren = model.GetComponentsInChildren<Renderer>(); Renderer[] array = componentsInChildren; foreach (Renderer val in array) { Renderer val2 = val; if (string.Equals(((Object)val).name, childObject)) { if (color == Color.clear) { Object.Destroy((Object)(object)val); break; } if ((Object)(object)material == (Object)null) { material = new Material(val.material); material.mainTexture = val.material.mainTexture; material.shader = val.material.shader; material.color = color; } val.material = material; Transform transform = ((Component)val).transform; transform.localScale *= scaleMultiplier; if (!replaceAll) { break; } } } } internal static void DebugMaterial(GameObject model) { Renderer[] componentsInChildren = model.GetComponentsInChildren<Renderer>(); Renderer[] array = componentsInChildren; foreach (Renderer val in array) { Renderer val2 = val; Debug.Log((object)("Material: " + ((Object)val2).name.ToString())); } } internal static void GetParticle(GameObject model, string childObject, Color color, float sizeMultiplier = 1f, bool replaceAll = false) { //IL_001c: 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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) ParticleSystem[] componentsInChildren = model.GetComponentsInChildren<ParticleSystem>(); ParticleSystem[] array = componentsInChildren; foreach (ParticleSystem val in array) { ParticleSystem val2 = val; MainModule main = val2.main; ColorOverLifetimeModule colorOverLifetime = val2.colorOverLifetime; ColorBySpeedModule colorBySpeed = val2.colorBySpeed; if (string.Equals(((Object)val2).name, childObject)) { ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(color); ((MainModule)(ref main)).startSizeMultiplier = ((MainModule)(ref main)).startSizeMultiplier * sizeMultiplier; ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(color); ((ColorBySpeedModule)(ref colorBySpeed)).color = MinMaxGradient.op_Implicit(color); if (!replaceAll) { break; } } } } internal static void DebugParticleSystem(GameObject model) { ParticleSystem[] components = model.GetComponents<ParticleSystem>(); ParticleSystem[] array = components; foreach (ParticleSystem val in array) { ParticleSystem val2 = val; Debug.Log((object)("Particle: " + ((Object)val2).name.ToString())); } } internal static void GetLight(GameObject model, string childObject, Color color, bool replaceAll = false) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) Light[] componentsInChildren = model.GetComponentsInChildren<Light>(); Light[] array = componentsInChildren; foreach (Light val in array) { Light val2 = val; if (string.Equals(((Object)val2).name, childObject)) { val2.color = color; if (!replaceAll) { break; } } } } internal static void DebugLight(GameObject model) { Light[] componentsInChildren = model.GetComponentsInChildren<Light>(); Light[] array = componentsInChildren; foreach (Light val in array) { Light val2 = val; Debug.Log((object)("Light: " + ((Object)val2).name.ToString())); } } public static void ClearDotStacksForType(this DotController dotController, DotIndex dotIndex) { //IL_001e: 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) for (int num = dotController.dotStackList.Count - 1; num >= 0; num--) { if (dotController.dotStackList[num].dotIndex == dotIndex) { dotController.RemoveDotStackAtServer(num); } } } public static void ApplyCooldownScale(GenericSkill skillSlot, float cooldownScale) { if ((Object)(object)skillSlot != (Object)null) { skillSlot.cooldownScale *= cooldownScale; } } } } namespace EliteReworks.Modules { public static class CommonAssets { private static AssetBundle _mainAssetBundle; public static string dropPrefabsPath = "Assets/Models/DropPrefabs"; public static string iconsPath = "Assets/Textures/Icons/"; public static string eliteMaterialsPath = "Assets/Textures/Materials/Elite/"; public static GameObject voidtouchedSingularityDelay; public static GameObject voidtouchedSingularity; public static AssetBundle mainAssetBundle { get { return null; } set { _mainAssetBundle = value; } } public static void Init() { CreateVoidtouchedSingularity(); } private static void CreateVoidtouchedSingularity() { //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_00a2: 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) float num = 8f; GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/ElementalRingVoid/ElementalRingVoidBlackHole.prefab").WaitForCompletion(); voidtouchedSingularity = PrefabAPI.InstantiateClone(val, "VoidtouchedSingularity", true); ProjectileFuse component = voidtouchedSingularity.GetComponent<ProjectileFuse>(); if (Object.op_Implicit((Object)(object)component)) { component.fuse = 3f; } RadialForce component2 = voidtouchedSingularity.GetComponent<RadialForce>(); if (Object.op_Implicit((Object)(object)component2)) { component2.radius = num; Transform transform = voidtouchedSingularity.transform; transform.localScale *= num / 15f; } ContentAddition.AddProjectile(voidtouchedSingularity); GameObject val2 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/ExplodeOnDeath/WilloWispDelay.prefab").WaitForCompletion(); voidtouchedSingularityDelay = PrefabAPI.InstantiateClone(val2, "VoidtouchedDelayBlast", true); DelayBlast component3 = voidtouchedSingularityDelay.GetComponent<DelayBlast>(); if (Object.op_Implicit((Object)(object)component3)) { component3.explosionEffect = voidtouchedSingularity; } ContentAddition.AddNetworkedObject(voidtouchedSingularityDelay); } } public class CustomRendererInfo { public string childName; public Material material = null; public bool dontHotpoo = false; public bool ignoreOverlays = false; } internal static class Assets { internal static Dictionary<string, AssetBundle> loadedBundles = new Dictionary<string, AssetBundle>(); internal static AssetBundle LoadAssetBundle(string bundleName) { if (loadedBundles.ContainsKey(bundleName)) { return loadedBundles[bundleName]; } AssetBundle val = null; val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)EliteReworksPlugin.instance).Info.Location), bundleName)); loadedBundles[bundleName] = val; return val; } internal static GameObject CloneTracer(string originalTracerName, string newTracerName) { if ((Object)(object)LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/Tracers/" + originalTracerName) == (Object)null) { return null; } GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/Tracers/" + originalTracerName), newTracerName, true); if (!Object.op_Implicit((Object)(object)val.GetComponent<EffectComponent>())) { val.AddComponent<EffectComponent>(); } if (!Object.op_Implicit((Object)(object)val.GetComponent<VFXAttributes>())) { val.AddComponent<VFXAttributes>(); } if (!Object.op_Implicit((Object)(object)val.GetComponent<NetworkIdentity>())) { val.AddComponent<NetworkIdentity>(); } val.GetComponent<Tracer>().speed = 250f; val.GetComponent<Tracer>().length = 50f; Content.CreateAndAddEffectDef(val); return val; } internal static void ConvertAllRenderersToHopooShader(GameObject objectToConvert) { if (!Object.op_Implicit((Object)(object)objectToConvert)) { return; } MeshRenderer[] componentsInChildren = objectToConvert.GetComponentsInChildren<MeshRenderer>(); foreach (MeshRenderer val in componentsInChildren) { if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial)) { ((Renderer)val).sharedMaterial.ConvertDefaultShaderToHopoo(); } } SkinnedMeshRenderer[] componentsInChildren2 = objectToConvert.GetComponentsInChildren<SkinnedMeshRenderer>(); foreach (SkinnedMeshRenderer val2 in componentsInChildren2) { if (Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)((Renderer)val2).sharedMaterial)) { ((Renderer)val2).sharedMaterial.ConvertDefaultShaderToHopoo(); } } } internal static GameObject LoadCrosshair(string crosshairName) { GameObject val = LegacyResourcesAPI.Load<GameObject>("Prefabs/Crosshair/" + crosshairName + "Crosshair"); if ((Object)(object)val == (Object)null) { Log.Error("could not load crosshair with the name " + crosshairName + ". defaulting to Standard"); return LegacyResourcesAPI.Load<GameObject>("Prefabs/Crosshair/StandardCrosshair"); } return val; } internal static GameObject LoadEffect(this AssetBundle assetBundle, string resourceName, bool parentToTransform) { return assetBundle.LoadEffect(resourceName, "", parentToTransform); } internal static GameObject LoadEffect(this AssetBundle assetBundle, string resourceName, string soundName = "", bool parentToTransform = false) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) GameObject val = assetBundle.LoadAsset<GameObject>(resourceName); if (!Object.op_Implicit((Object)(object)val)) { Log.ErrorAssetBundle(resourceName, ((Object)assetBundle).name); return null; } val.AddComponent<DestroyOnTimer>().duration = 12f; val.AddComponent<NetworkIdentity>(); val.AddComponent<VFXAttributes>().vfxPriority = (VFXPriority)2; EffectComponent val2 = val.AddComponent<EffectComponent>(); val2.applyScale = false; val2.effectIndex = (EffectIndex)(-1); val2.parentToReferencedTransform = parentToTransform; val2.positionAtReferencedTransform = true; val2.soundName = soundName; Content.CreateAndAddEffectDef(val); return val; } internal static GameObject CreateProjectileGhostPrefab(this AssetBundle assetBundle, string ghostName) { GameObject val = assetBundle.LoadAsset<GameObject>(ghostName); if ((Object)(object)val == (Object)null) { Log.Error("Failed to load ghost prefab " + ghostName); } if (!Object.op_Implicit((Object)(object)val.GetComponent<NetworkIdentity>())) { val.AddComponent<NetworkIdentity>(); } if (!Object.op_Implicit((Object)(object)val.GetComponent<ProjectileGhostController>())) { val.AddComponent<ProjectileGhostController>(); } ConvertAllRenderersToHopooShader(val); return val; } internal static GameObject CreateProjectileGhostPrefab(GameObject ghostObject, string newName) { if ((Object)(object)ghostObject == (Object)null) { Log.Error("Failed to load ghost prefab " + ((Object)ghostObject).name); } GameObject val = PrefabAPI.InstantiateClone(ghostObject, newName); if (!Object.op_Implicit((Object)(object)val.GetComponent<NetworkIdentity>())) { val.AddComponent<NetworkIdentity>(); } if (!Object.op_Implicit((Object)(object)val.GetComponent<ProjectileGhostController>())) { val.AddComponent<ProjectileGhostController>(); } return val; } internal static GameObject CloneProjectilePrefab(string prefabName, string newPrefabName) { return PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/Projectiles/" + prefabName), newPrefabName); } internal static GameObject LoadAndAddProjectilePrefab(this AssetBundle assetBundle, string newPrefabName) { GameObject val = assetBundle.LoadAsset<GameObject>(newPrefabName); if ((Object)(object)val == (Object)null) { Log.ErrorAssetBundle(newPrefabName, ((Object)assetBundle).name); return null; } Content.AddProjectilePrefab(val); return val; } } internal static class Materials { private static List<Material> cachedMaterials = new List<Material>(); internal static Shader hotpoo = LegacyResourcesAPI.Load<Shader>("Shaders/Deferred/HGStandard"); public static List<Material> MaterialsWithSwappedShaders { get; } = new List<Material>(); internal static void GetMaterial(GameObject model, string childObject, Color color, ref Material material, float scaleMultiplier = 1f, bool replaceAll = false) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown //IL_0092: Unknown result type (might be due to invalid IL or missing references) Renderer[] componentsInChildren = model.GetComponentsInChildren<Renderer>(); Renderer[] array = componentsInChildren; foreach (Renderer val in array) { Renderer val2 = val; if (string.Equals(((Object)val).name, childObject)) { if (color == Color.clear) { Object.Destroy((Object)(object)val); break; } if ((Object)(object)material == (Object)null) { material = new Material(val.material); material.mainTexture = val.material.mainTexture; material.shader = val.material.shader; material.color = color; } val.material = material; Transform transform = ((Component)val).transform; transform.localScale *= scaleMultiplier; if (!replaceAll) { break; } } } } internal static void DebugMaterial(GameObject model) { Renderer[] componentsInChildren = model.GetComponentsInChildren<Renderer>(); Renderer[] array = componentsInChildren; foreach (Renderer val in array) { Renderer val2 = val; Debug.Log((object)("Material: " + ((Object)val2).name.ToString())); } } public static void SwapShadersFromMaterialsInBundle(AssetBundle bundle) { if (bundle.isStreamedSceneAssetBundle) { Debug.LogWarning((object)"Cannot swap material shaders from a streamed scene assetbundle."); return; } Material[] array = (from mat in bundle.LoadAllAssets<Material>() where ((Object)mat.shader).name.StartsWith("Stubbed") select mat).ToArray(); foreach (Material val in array) { if (!((Object)val.shader).name.StartsWith("Stubbed")) { Debug.LogWarning((object)$"The material {val} has a shader which's name doesnt start with \"Stubbed\" ({((Object)val.shader).name}), this is not allowed for stubbed shaders for MSU. not swapping shader."); continue; } try { SwapShader(val); } catch (Exception arg) { Debug.LogError((object)$"Failed to swap shader of material {val}: {arg}"); } } } private static void SwapShader(Material material) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) string text = ((Object)material.shader).name.Substring("Stubbed".Length); string text2 = text + ".shader"; Shader shader = Addressables.LoadAssetAsync<Shader>((object)text2).WaitForCompletion(); material.shader = shader; MaterialsWithSwappedShaders.Add(material); } public static Material LoadMaterial(this AssetBundle assetBundle, string materialName) { return assetBundle.CreateHopooMaterialFromBundle(materialName); } public static Material CreateHopooMaterialFromBundle(this AssetBundle assetBundle, string materialName) { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown Material val = cachedMaterials.Find(delegate(Material mat) { materialName.Replace(" (Instance)", ""); return ((Object)mat).name.Contains(materialName); }); if (Object.op_Implicit((Object)(object)val)) { Log.Debug(((Object)val).name + " has already been loaded. returning cached"); return val; } val = assetBundle.LoadAsset<Material>(materialName); if (!Object.op_Implicit((Object)(object)val)) { Log.ErrorAssetBundle(materialName, ((Object)assetBundle).name); return new Material(hotpoo); } return val.ConvertDefaultShaderToHopoo(); } public static Material SetHopooMaterial(this Material tempMat) { return tempMat.ConvertDefaultShaderToHopoo(); } public static Material ConvertDefaultShaderToHopoo(this Material tempMat) { //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) if (cachedMaterials.Contains(tempMat)) { Log.Debug(((Object)tempMat).name + " has already been loaded. returning cached"); return tempMat; } float? num = null; Color? val = null; if (tempMat.IsKeywordEnabled("_NORMALMAP")) { num = tempMat.GetFloat("_BumpScale"); } if (tempMat.IsKeywordEnabled("_EMISSION")) { val = tempMat.GetColor("_EmissionColor"); } tempMat.shader = hotpoo; tempMat.SetTexture("_EmTex", tempMat.GetTexture("_EmissionMap")); tempMat.EnableKeyword("DITHER"); if (num.HasValue) { tempMat.SetFloat("_NormalStrength", num.Value); tempMat.SetTexture("_NormalTex", tempMat.GetTexture("_BumpMap")); } if (val.HasValue) { tempMat.SetColor("_EmColor", val.Value); tempMat.SetFloat("_EmPower", 1f); } if (tempMat.IsKeywordEnabled("NOCULL")) { tempMat.SetInt("_Cull", 0); } if (tempMat.IsKeywordEnabled("LIMBREMOVAL")) { tempMat.SetInt("_LimbRemovalOn", 1); } cachedMaterials.Add(tempMat); return tempMat; } public static Material MakeUnique(this Material material) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown if (cachedMaterials.Contains(material)) { return new Material(material); } return material; } public static Material SetColor(this Material material, Color color) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) material.SetColor("_Color", color); return material; } public static Material SetNormal(this Material material, float normalStrength = 1f) { material.SetFloat("_NormalStrength", normalStrength); return material; } public static Material SetEmission(this Material material) { return material.SetEmission(1f); } public static Material SetEmission(this Material material, float emission) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return material.SetEmission(emission, Color.white); } public static Material SetEmission(this Material material, float emission, Color emissionColor) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) material.SetFloat("_EmPower", emission); material.SetColor("_EmColor", emissionColor); return material; } public static Material SetCull(this Material material, bool cull = false) { material.SetInt("_Cull", cull ? 1 : 0); return material; } public static Material SetSpecular(this Material material, float strength) { material.SetFloat("_SpecularStrength", strength); return material; } public static Material SetSpecular(this Material material, float strength, float exponent) { material.SetFloat("_SpecularStrength", strength); material.SetFloat("SpecularExponent", exponent); return material; } } internal static class Particles { internal static void GetParticle(GameObject model, string childObject, Color color, float sizeMultiplier = 1f, bool replaceAll = false) { //IL_001c: 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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) ParticleSystem[] componentsInChildren = model.GetComponentsInChildren<ParticleSystem>(); ParticleSystem[] array = componentsInChildren; foreach (ParticleSystem val in array) { ParticleSystem val2 = val; MainModule main = val2.main; ColorOverLifetimeModule colorOverLifetime = val2.colorOverLifetime; ColorBySpeedModule colorBySpeed = val2.colorBySpeed; if (string.Equals(((Object)val2).name, childObject)) { ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(color); ((MainModule)(ref main)).startSizeMultiplier = ((MainModule)(ref main)).startSizeMultiplier * sizeMultiplier; ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(color); ((ColorBySpeedModule)(ref colorBySpeed)).color = MinMaxGradient.op_Implicit(color); if (!replaceAll) { break; } } } } internal static void DebugParticleSystem(GameObject model) { ParticleSystem[] componentsInChildren = model.GetComponentsInChildren<ParticleSystem>(); ParticleSystem[] array = componentsInChildren; foreach (ParticleSystem val in array) { ParticleSystem val2 = val; Debug.Log((object)("Particle: " + ((Object)val2).name.ToString())); } } } internal class Content { internal static void AddExpansionDef(ExpansionDef expansion) { ContentPacks.expansionDefs.Add(expansion); } internal static void AddCharacterBodyPrefab(GameObject bprefab) { ContentPacks.bodyPrefabs.Add(bprefab); } internal static void AddMasterPrefab(GameObject prefab) { ContentPacks.masterPrefabs.Add(prefab); } internal static void AddProjectilePrefab(GameObject prefab) { ContentPacks.projectilePrefabs.Add(prefab); } internal static void AddSurvivorDef(SurvivorDef survivorDef) { ContentPacks.survivorDefs.Add(survivorDef); } internal static void AddItemDef(ItemDef itemDef) { ContentPacks.itemDefs.Add(itemDef); } internal static void AddEliteDef(EliteDef eliteDef) { ContentPacks.eliteDefs.Add(eliteDef); } internal static void AddArtifactDef(ArtifactDef artifactDef) { ContentPacks.artifactDefs.Add(artifactDef); } internal static void AddNetworkedObjectPrefab(GameObject prefab) { ContentPacks.networkedObjectPrefabs.Add(prefab); } internal static void CreateSurvivor(GameObject bodyPrefab, GameObject displayPrefab, Color charColor, string tokenPrefix) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) CreateSurvivor(bodyPrefab, displayPrefab, charColor, tokenPrefix, null, 100f); } internal static void CreateSurvivor(GameObject bodyPrefab, GameObject displayPrefab, Color charColor, string tokenPrefix, float sortPosition) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) CreateSurvivor(bodyPrefab, displayPrefab, charColor, tokenPrefix, null, sortPosition); } internal static void CreateSurvivor(GameObject bodyPrefab, GameObject displayPrefab, Color charColor, string tokenPrefix, UnlockableDef unlockableDef) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) CreateSurvivor(bodyPrefab, displayPrefab, charColor, tokenPrefix, unlockableDef, 100f); } internal static void CreateSurvivor(GameObject bodyPrefab, GameObject displayPrefab, Color charColor, string tokenPrefix, UnlockableDef unlockableDef, float sortPosition) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) SurvivorDef val = ScriptableObject.CreateInstance<SurvivorDef>(); val.bodyPrefab = bodyPrefab; val.displayPrefab = displayPrefab; val.primaryColor = charColor; val.cachedName = ((Object)bodyPrefab).name.Replace("Body", ""); val.displayNameToken = tokenPrefix + "NAME"; val.descriptionToken = tokenPrefix + "DESCRIPTION"; val.outroFlavorToken = tokenPrefix + "OUTRO_FLAVOR"; val.mainEndingEscapeFailureFlavorToken = tokenPrefix + "OUTRO_FAILURE"; val.desiredSortPosition = sortPosition; val.unlockableDef = unlockableDef; AddSurvivorDef(val); } internal static void AddUnlockableDef(UnlockableDef unlockableDef) { ContentPacks.unlockableDefs.Add(unlockableDef); } internal static UnlockableDef CreateAndAddUnlockbleDef(string identifier, string nameToken, Sprite achievementIcon) { UnlockableDef val = ScriptableObject.CreateInstance<UnlockableDef>(); val.cachedName = identifier; val.nameToken = nameToken; val.achievementIcon = achievementIcon; AddUnlockableDef(val); return val; } internal static void AddSkillDef(SkillDef skillDef) { ContentPacks.skillDefs.Add(skillDef); } internal static void AddSkillFamily(SkillFamily skillFamily) { ContentPacks.skillFamilies.Add(skillFamily); } internal static void AddEntityState(Type entityState) { ContentPacks.entityStates.Add(entityState); } internal static void AddBuffDef(BuffDef buffDef) { ContentPacks.buffDefs.Add(buffDef); } internal static BuffDef CreateAndAddBuff(string buffName, Sprite buffIcon, Color buffColor, bool canStack, bool isDebuff) { //IL_0010: 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) BuffDef val = ScriptableObject.CreateInstance<BuffDef>(); ((Object)val).name = buffName; val.buffColor = buffColor; val.canStack = canStack; val.isDebuff = isDebuff; val.eliteDef = null; val.iconSprite = buffIcon; AddBuffDef(val); return val; } internal static void AddEffectDef(EffectDef effectDef) { ContentPacks.effectDefs.Add(effectDef); } internal static EffectDef CreateAndAddEffectDef(GameObject effectPrefab) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown EffectDef val = new EffectDef(effectPrefab); AddEffectDef(val); return val; } internal static void AddNetworkSoundEventDef(NetworkSoundEventDef networkSoundEventDef) { ContentPacks.networkSoundEventDefs.Add(networkSoundEventDef); } internal static NetworkSoundEventDef CreateAndAddNetworkSoundEventDef(string eventName) { NetworkSoundEventDef val = ScriptableObject.CreateInstance<NetworkSoundEventDef>(); val.akId = AkSoundEngine.GetIDFromString(eventName); val.eventName = eventName; AddNetworkSoundEventDef(val); return val; } } internal static class Skills { public static Dictionary<string, SkillLocator> characterSkillLocators = new Dictionary<string, SkillLocator>(); public static void CreateSkillFamilies(GameObject targetPrefab) { SkillSlot[] array = new SkillSlot[4]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); CreateSkillFamilies(targetPrefab, (SkillSlot[])(object)array); } public static void CreateSkillFamilies(GameObject targetPrefab, params SkillSlot[] slots) { //IL_0010: 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_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected I4, but got Unknown SkillLocator component = targetPrefab.GetComponent<SkillLocator>(); foreach (SkillSlot val in slots) { SkillSlot val2 = val; switch (val2 - -1) { case 1: component.primary = CreateGenericSkillWithSkillFamily(targetPrefab, "Primary"); break; case 2: component.secondary = CreateGenericSkillWithSkillFamily(targetPrefab, "Secondary"); break; case 3: component.utility = CreateGenericSkillWithSkillFamily(targetPrefab, "Utility"); break; case 4: component.special = CreateGenericSkillWithSkillFamily(targetPrefab, "Special"); break; } } } public static void ClearGenericSkills(GameObject targetPrefab) { GenericSkill[] componentsInChildren = targetPrefab.GetComponentsInChildren<GenericSkill>(); foreach (GenericSkill val in componentsInChildren) { Object.DestroyImmediate((Object)(object)val); } } public static GenericSkill CreateGenericSkillWithSkillFamily(GameObject targetPrefab, SkillSlot skillSlot, bool hidden = false) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: 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_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected I4, but got Unknown SkillLocator component = targetPrefab.GetComponent<SkillLocator>(); switch (skillSlot - -1) { case 1: return component.primary = CreateGenericSkillWithSkillFamily(targetPrefab, "Primary", hidden); case 2: return component.secondary = CreateGenericSkillWithSkillFamily(targetPrefab, "Secondary", hidden); case 3: return component.utility = CreateGenericSkillWithSkillFamily(targetPrefab, "Utility", hidden); case 4: return component.special = CreateGenericSkillWithSkillFamily(targetPrefab, "Special", hidden); case 0: Log.Error("Failed to create GenericSkill with skillslot None. If making a GenericSkill outside of the main 4, specify a familyName, and optionally a genericSkillName"); return null; default: return null; } } public static GenericSkill CreateGenericSkillWithSkillFamily(GameObject targetPrefab, string familyName, bool hidden = false) { return CreateGenericSkillWithSkillFamily(targetPrefab, familyName, familyName, hidden); } public static GenericSkill CreateGenericSkillWithSkillFamily(GameObject targetPrefab, string genericSkillName, string familyName, bool hidden = false) { GenericSkill val = targetPrefab.AddComponent<GenericSkill>(); val.skillName = genericSkillName; val.hideInCharacterSelect = hidden; SkillFamily val2 = ScriptableObject.CreateInstance<SkillFamily>(); ((Object)val2).name = ((Object)targetPrefab).name + familyName + "Family"; val2.variants = (Variant[])(object)new Variant[0]; val._skillFamily = val2; Content.AddSkillFamily(val2); return val; } public static void AddSkillToFamily(SkillFamily skillFamily, SkillDef skillDef, UnlockableDef unlockableDef = null) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1); Variant[] variants = skillFamily.variants; int num = skillFamily.variants.Length - 1; Variant val = new Variant { skillDef = skillDef, unlockableDef = unlockableDef }; ((Variant)(ref val)).viewableNode = new Node(skillDef.skillNameToken, false, (Node)null); variants[num] = val; } public static void AddSkillsToFamily(SkillFamily skillFamily, params SkillDef[] skillDefs) { foreach (SkillDef skillDef in skillDefs) { AddSkillToFamily(skillFamily, skillDef); } } public static void AddPrimarySkills(GameObject targetPrefab, params SkillDef[] skillDefs) { AddSkillsToFamily(targetPrefab.GetComponent<SkillLocator>().primary.skillFamily, skillDefs); } public static void AddSecondarySkills(GameObject targetPrefab, params SkillDef[] skillDefs) { AddSkillsToFamily(targetPrefab.GetComponent<SkillLocator>().secondary.skillFamily, skillDefs); } public static void AddUtilitySkills(GameObject targetPrefab, params SkillDef[] skillDefs) { AddSkillsToFamily(targetPrefab.GetComponent<SkillLocator>().utility.skillFamily, skillDefs); } public static void AddSpecialSkills(GameObject targetPrefab, params SkillDef[] skillDefs) { AddSkillsToFamily(targetPrefab.GetComponent<SkillLocator>().special.skillFamily, skillDefs); } public static void AddUnlockablesToFamily(SkillFamily skillFamily, params UnlockableDef[] unlockableDefs) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < unlockableDefs.Length; i++) { Variant val = skillFamily.variants[i]; val.unlockableDef = unlockableDefs[i]; skillFamily.variants[i] = val; } } public static Combo ComboFromType(Type t) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) Combo result = default(Combo); result.activationStateType = new SerializableEntityStateType(t); return result; } } [AttributeUsage(AttributeTargets.Field, AllowMultiple = false)] public class AutoConfigAttribute : Attribute { public string name; public string desc; public object defaultValue; public AutoConfigAttribute(string name, object defaultValue) { Init(name, string.Empty, defaultValue); } public AutoConfigAttribute(string name, string desc, object defaultValue) { Init(name, desc, defaultValue); } public void Init(string name, string desc, object defaultValue) { this.name = name; this.desc = desc; this.defaultValue = defaultValue; } } public static class Config { public static ConfigFile MyConfig; public static ConfigFile BackupConfig; public static void Init() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown MyConfig = new ConfigFile(Paths.ConfigPath + "\\com.RiskOfBrainrot.FruityAspectGaming.cfg", true); BackupConfig = new ConfigFile(Paths.ConfigPath + "\\com.RiskOfBrainrot.FruityAspectGaming.Backup.cfg", true); BackupConfig.Bind<string>(": DO NOT MODIFY THIS FILES CONTENTS :", ": DO NOT MODIFY THIS FILES CONTENTS :", ": DO NOT MODIFY THIS FILES CONTENTS :", ": DO NOT MODIFY THIS FILES CONTENTS :"); } public static ConfigEntry<bool> CharacterEnableConfig(string section, string characterName, string description = "", bool enabledByDefault = true) { if (string.IsNullOrEmpty(description)) { description = "Set to false to disable this character and as much of its code and content as possible"; } return BindAndOptions(section, "Enable " + characterName, enabledByDefault, description, restartRequired: true); } public static ConfigEntry<T> BindAndOptions<T>(string section, string name, T defaultValue, string description = "", bool restartRequired = false) { return BindAndOptions(section, name, defaultValue, 0f, 20f, description, restartRequired); } public static ConfigEntry<T> BindAndOptions<T>(string section, string name, T defaultValue, float min, float max, string description = "", bool restartRequired = false) { if (string.IsNullOrEmpty(description)) { description = name; } if (restartRequired) { description += " (restart required)"; } ConfigEntry<T> val = MyConfig.Bind<T>(section, name, defaultValue, description); if (Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions")) { TryRegisterOption<T>(val, min, max, restartRequired); } return val; } public static ConfigEntry<float> BindAndOptionsSlider(string section, string name, float defaultValue, string description, float min = 0f, float max = 20f, bool restartRequired = false) { return BindAndOptions(section, name, defaultValue, min, max, description, restartRequired); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static void TryRegisterOption<T>(ConfigEntry<T> entry, float min, float max, bool restartRequired) { } public static bool GetKeyPressed(KeyboardShortcut entry) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: 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_0043: Unknown result type (might be due to invalid IL or missing references) foreach (KeyCode modifier in ((KeyboardShortcut)(ref entry)).Modifiers) { if (!Input.GetKey(modifier)) { return false; } } return Input.GetKeyDown(((KeyboardShortcut)(ref entry)).MainKey); } } public class ConfigManager { internal static bool ConfigChanged; internal static bool VersionChanged; public static void HandleConfigAttributes(Type type, string section, ConfigFile config) { TypeInfo typeInfo = type.GetTypeInfo(); FieldInfo[] fields = typeInfo.GetFields(); foreach (FieldInfo fieldInfo in fields) { if (fieldInfo.IsStatic) { Type fieldType = fieldInfo.FieldType; AutoConfigAttribute customAttribute = fieldInfo.GetCustomAttribute<AutoConfigAttribute>(); if (customAttribute != null) { string name = customAttribute.name; object defaultValue = customAttribute.defaultValue; string desc = customAttribute.desc; fieldInfo.SetValue(null, DualBindToConfig(fieldType, section, config, name, defaultValue, desc)); } } } } private static object DualBindToConfig(Type t, string section, ConfigFile config, string configName, object defaultValue, string configDesc) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Expected O, but got Unknown //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Expected O, but got Unknown if (string.IsNullOrWhiteSpace(section) || string.IsNullOrWhiteSpace(configName)) { return defaultValue; } ConfigDescription val = new ConfigDescription(configDesc, (AcceptableValueBase)null, Array.Empty<object>()); MethodInfo methodInfo = (from x in typeof(ConfigFile).GetMethods() where x.Name == "Bind" select x).First(); methodInfo = methodInfo.MakeGenericMethod(t); ConfigEntryBase val2 = (ConfigEntryBase)methodInfo.Invoke(config, new object[3] { (object)new ConfigDefinition(section, configName), defaultValue, val }); ConfigEntryBase val3 = (ConfigEntryBase)methodInfo.Invoke(Config.BackupConfig, new object[3] { (object)new ConfigDefinition(Regex.Replace(config.ConfigFilePath, "\\W", "") + " : " + section, configName), defaultValue, val }); if (!ConfigEqual(val3.DefaultValue, val3.BoxedValue)) { bool flag = true; Log.Warning("Syncing config to new version"); val2.BoxedValue = val2.DefaultValue; val3.BoxedValue = val3.DefaultValue; } if (!ConfigEqual(val2.DefaultValue, val2.BoxedValue)) { ConfigChanged = true; } return val2.BoxedValue; } public static T DualBindToConfig<T>(string section, ConfigFile config, string configName, T defaultValue, string configDesc) { return (T)DualBindToConfig(typeof(T), section, config, configName, defaultValue, configDesc); } private static bool ConfigEqual(object a, object b) { if (a.Equals(b)) { return true; } if (float.TryParse(a.ToString(), out var result) && float.TryParse(b.ToString(), out var result2) && (double)Mathf.Abs(result - result2) < 0.0001) { return true; } return false; } } internal class ContentPacks : IContentPackProvider { internal ContentPack contentPack = new ContentPack(); public static List<ExpansionDef> expansionDefs = new List<ExpansionDef>(); public static List<GameObject> bodyPrefabs = new List<GameObject>(); public static List<GameObject> masterPrefabs = new List<GameObject>(); public static List<GameObject> projectilePrefabs = new List<GameObject>(); public static List<SurvivorDef> survivorDefs = new List<SurvivorDef>(); public static List<UnlockableDef> unlockableDefs = new List<UnlockableDef>(); public static List<SkillFamily> skillFamilies = new List<SkillFamily>(); public static List<SkillDef> skillDefs = new List<SkillDef>(); public static List<Type> entityStates = new List<Type>(); public static List<BuffDef> buffDefs = new List<BuffDef>(); public static List<EffectDef> effectDefs = new List<EffectDef>(); public static List<ItemDef> itemDefs = new List<ItemDef>(); public static List<EliteDef> eliteDefs = new List<EliteDef>(); public static List<ArtifactDef> artifactDefs = new List<ArtifactDef>(); public static List<NetworkSoundEventDef> networkSoundEventDefs = new List<NetworkSoundEventDef>(); public static List<GameObject> networkedObjectPrefabs = new List<GameObject>(); public string identifier => "com.RiskOfBrainrot.FruityAspectGaming"; public void Initialize() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown ContentManager.collectContentPackProviders += new CollectContentPackProvidersDelegate(ContentManager_collectContentPackProviders); } private void ContentManager_collectContentPackProviders(AddContentPackProviderDelegate addContentPackProvider) { addContentPackProvider.Invoke((IContentPackProvider)(object)this); } public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args) { contentPack.identifier = identifier; contentPack.expansionDefs.Add(expansionDefs.ToArray()); contentPack.bodyPrefabs.Add(bodyPrefabs.ToArray()); contentPack.masterPrefabs.Add(masterPrefabs.ToArray()); contentPack.projectilePrefabs.Add(projectilePrefabs.ToArray()); contentPack.survivorDefs.Add(survivorDefs.ToArray()); contentPack.eliteDefs.Add(eliteDefs.ToArray()); contentPack.itemDefs.Add(itemDefs.ToArray()); contentPack.buffDefs.Add(buffDefs.ToArray()); contentPack.artifactDefs.Add(artifactDefs.ToArray()); contentPack.skillDefs.Add(skillDefs.ToArray()); contentPack.skillFamilies.Add(skillFamilies.ToArray()); contentPack.entityStateTypes.Add(entityStates.ToArray()); contentPack.unlockableDefs.Add(unlockableDefs.ToArray()); contentPack.effectDefs.Add(effectDefs.ToArray()); contentPack.networkSoundEventDefs.Add(networkSoundEventDefs.ToArray()); contentPack.networkedObjectPrefabs.Add(networkedObjectPrefabs.ToArray()); args.ReportProgress(1f); yield break; } public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args) { ContentPack.Copy(contentPack, args.output); args.ReportProgress(1f); yield break; } public IEnumerator FinalizeAsync(FinalizeAsyncArgs args) { args.ReportProgress(1f); yield break; } } public class AllyCaps { public struct AllyCap { public GameObject prefab; public int cap; public int lysateCap; } private static List<AllyCap> caps = new List<AllyCap>(); public static void Init() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown CharacterBody.Start += new hook_Start(HopooWhy); } public static void RegisterAllyCap(GameObject prefab, int max = 1, int maxWithLysate = 2) { caps.Add(new AllyCap { prefab = prefab, cap = max, lysateCap = maxWithLysate }); } private static void HopooWhy(orig_Start orig, CharacterBody self) { //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); if (!NetworkServer.active || caps.Count <= 0 || caps == null) { return; } foreach (AllyCap cap in caps) { CharacterMaster master = self.master; object obj; if (master == null) { obj = null; } else { MinionOwnership minionOwnership = master.minionOwnership; obj = ((minionOwnership != null) ? minionOwnership.ownerMaster : null); } if (!Object.op_Implicit((Object)obj)) { continue; } BodyIndex index = BodyCatalog.FindBodyIndex(cap.prefab); if (self.bodyIndex != index) { continue; } MinionOwnership[] array = (from x in Object.FindObjectsOfType<MinionOwnership>() where Object.op_Implicit((Object)(object)x.ownerMaster) && (Object)(object)x.ownerMaster == (Object)(object)self.master.minionOwnership.ownerMaster && Object.op_Implicit((Object)(object)((Component)x).GetComponent<CharacterMaster>()) && Object.op_Implicit((Object)(object)((Component)x).GetComponent<CharacterMaster>().GetBody()) && ((Component)x).GetComponent<CharacterMaster>().GetBody().bodyIndex == index select x).ToArray(); int num = 0; int num2 = ((self.master.minionOwnership.ownerMaster.inventory.GetItemCount(Items.EquipmentMagazineVoid) > 1) ? cap.lysateCap : cap.cap); MinionOwnership[] array2 = array; foreach (MinionOwnership val in array2) { num++; if (num > num2) { ((Component)val).GetComponent<CharacterMaster>().TrueKill(); } } } } } public static class EliteModule { public class CustomEliteDef : ScriptableObject { public EliteDef eliteDef; public EliteDef honorEliteDef; public EliteTiers eliteTier; public Color lightColor = Color.clear; public Texture eliteRamp; public Material overlayMaterial; public GameObject spawnEffect; } public enum EliteTiers { Tier1, Tier1AndHalf, Tier2, Lunar, Other } public static List<CustomEliteDef> Elites = new List<CustomEliteDef>(); public static Texture defaultShaderRamp = CommonAssets.mainAssetBundle.LoadAsset<Texture>(CommonAssets.eliteMaterialsPath + "texRampFrenzied.tex"); public static void Init() { RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(AddElites)); } private static void AddElites() { foreach (CustomEliteDef elite in Elites) { switch (elite.eliteTier) { case EliteTiers.Tier1: { ArrayUtils.ArrayAppend<EliteDef>(ref EliteAPI.VanillaEliteTiers[1].eliteTypes, ref elite.eliteDef); ref EliteDef[] eliteTypes2 = ref EliteAPI.VanillaEliteTiers[2].eliteTypes; EliteDef val = (((Object)(object)elite.honorEliteDef != (Object)null) ? elite.honorEliteDef : elite.eliteDef); ArrayUtils.ArrayAppend<EliteDef>(ref eliteTypes2, ref val); ref EliteDef[] eliteTypes3 = ref EliteAPI.VanillaEliteTiers[3].eliteTypes; val = (((Object)(object)elite.honorEliteDef != (Object)null) ? elite.honorEliteDef : elite.eliteDef); ArrayUtils.ArrayAppend<EliteDef>(ref eliteTypes3, ref val); ArrayUtils.ArrayAppend<EliteDef>(ref EliteAPI.VanillaEliteTiers[4].eliteTypes, ref elite.eliteDef); break; } case EliteTiers.Tier1AndHalf: { ref EliteDef[] eliteTypes = ref EliteAPI.VanillaEliteTiers[3].eliteTypes; EliteDef val = (((Object)(object)elite.honorEliteDef != (Object)null) ? elite.honorEliteDef : elite.eliteDef); ArrayUtils.ArrayAppend<EliteDef>(ref eliteTypes, ref val); ArrayUtils.ArrayAppend<EliteDef>(ref EliteAPI.VanillaEliteTiers[4].eliteTypes, ref elite.eliteDef); break; } case EliteTiers.Tier2: ArrayUtils.ArrayAppend<EliteDef>(ref EliteAPI.VanillaEliteTiers[5].eliteTypes, ref elite.eliteDef); break; case EliteTiers.Lunar: ArrayUtils.ArrayAppend<EliteDef>(ref EliteAPI.VanillaEliteTiers[6].eliteTypes, ref elite.eliteDef); break; } } } } public static class Hooks { public static void Init() { } } internal static class Language { public static class Styling { public static string ConvertDecimal(float value) { return value * 100f + "%"; } public static string DamageColor(string text) { return "<style=cIsDamage>" + text + "</style>"; } public static string HealingColor(string text) { return "<style=cIsHealing>" + text + "</style>"; } public static string DamageValueText(float value) { return DamageColor(ConvertDecimal(value) + " damage"); } public static string UtilityColor(string text) { return "<style=cIsUtility>" + text + "</style>"; } public static string RedText(string text) { return HealthColor(text); } public static string HealthColor(string text) { return "<style=cIsHealth>" + text + "</style>"; } public static string KeywordText(string keyword, string sub) { return "<style=cKeywordName>" + keyword + "</style><style=cSub>" + sub + "</style>"; } public static string ScepterDescription(string desc) { return "\n<color=#d299ff>SCEPTER: " + desc + "</color>"; } public static string VoidColor(string text) { return "<style=cIsVoid>" + text + "</style>"; } public static string StackText(string text) { return StackColor("(" + text + " per stack)"); } public static string StackColor(string text) { return "<style=cStack>" + text + "</style>"; } public static string GetAchievementNameToken(string identifier) { return "ACHIEVEMENT_" + identifier.ToUpperInvariant() + "_NAME"; } public static string GetAchievementDescriptionToken(string identifier) { return "ACHIEVEMENT_" + identifier.ToUpperInvariant() + "_DESCRIPTION"; } public static string NumToAdj(int num) { return num switch { 1 => num + "st", 2 => num + "nd", 3 => num + "rd", _ => num + "th", }; } } public static string TokensOutput = ""; public static bool usingLanguageFolder = false; public static bool printingEnabled = false; public static void Init() { if (usingLanguageFolder) { Language.collectLanguageRootFolders += Language_collectLanguageRootFolders; } } private static void Language_collectLanguageRootFolders(List<string> obj) { string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)EliteReworksPlugin.instance).Info.Location), "Language"); if (Directory.Exists(text)) { obj.Add(text); } } public static void Add(string token, string text) { if (!usingLanguageFolder) { LanguageAPI.Add(token, text); } if (printingEnabled) { TokensOutput = TokensOutput + "\n \"" + token + "\" : \"" + text.Replace(Environment.NewLine, "\\n").Replace("\n", "\\n") + "\","; } } public static void TryPrintOutput(string fileName = "") { if (usingLanguageFolder && printingEnabled) { PrintOutput(fileName); } } public static void PrintOutput(string fileName = "") { if (printingEnabled) { string text = "{\n strings:\n {" + TokensOutput + "\n }\n}"; Log.Message(fileName + ": \n" + text); if (!string.IsNullOrEmpty(fileName)) { string path = Path.Combine(Directory.GetParent(((BaseUnityPlugin)EliteReworksPlugin.instance).Info.Location).FullName, "Language", "en", fileName); File.WriteAllText(path, text); } TokensOutput = ""; } } } } namespace EliteReworks.Modules.BaseStates { public abstract class BaseMeleeAttack : BaseSkillState, IStepSetter { public int swingIndex; protected string hitboxGroupName = "SwordGroup"; protected DamageType damageType = (DamageType)0; protected float damageCoefficient = 3.5f; protected float procCoefficient = 1f; protected float pushForce = 300f; protected Vector3 bonusForce = Vector3.zero; protected float baseDuration = 1f; protected float attackStartPercentTime = 0.2f; protected float attackEndPercentTime = 0.4f; protected float earlyExitPercentTime = 0.4f; protected float hitStopDuration = 0.012f; protected float attackRecoil = 0.75f; protected float hitHopVelocity = 4f; protected string swingSoundString = ""; protected string hitSoundString = ""; protected string muzzleString = "SwingCenter"; protected string playbackRateParam = "Slash.playbackRate"; protected GameObject swingEffectPrefab; protected GameObject hitEffectPrefab; protected NetworkSoundEventIndex impactSound = (NetworkSoundEventIndex)(-1); public float duration; private bool hasFired; private float hitPauseTimer; private OverlapAttack attack; protected bool inHitPause; private bool hasHopped; protected float stopwatch; protected Animator animator; private HitStopCachedState hitStopCachedState; private Vector3 storedVelocity; public override void OnEnter() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) ((BaseState)this).OnEnter(); duration = baseDuration / ((BaseState)this).attackSpeedStat; animator = ((EntityState)this).GetModelAnimator(); ((BaseState)this).StartAimMode(0.5f + duration, false); PlayAttackAnimation(); attack = new OverlapAttack(); attack.damageType = DamageTypeCombo.op_Implicit(damageType); attack.attacker = ((EntityState)this).gameObject; attack.inflictor = ((EntityState)this).gameObject; attack.teamIndex = ((BaseState)this).GetTeam(); attack.damage = damageCoefficient * ((BaseState)this).damageStat; attack.procCoefficient = procCoefficient; attack.hitEffectPrefab = hitEffectPrefab; attack.forceVector = bonusForce; attack.pushAwayForce = pushForce; attack.hitBoxGroup = ((BaseState)this).FindHitBoxGroup(hitboxGroupName); attack.isCrit = ((BaseState)this).RollCrit(); attack.impactSound = impactSound; } protected virtual void PlayAttackAnimation() { ((EntityState)this).PlayCrossfade("Gesture, Override", "Slash" + (1 + swingIndex), playbackRateParam, duration, 0.05f); } public override void OnExit() { if (inHitPause) { RemoveHitstop(); } ((EntityState)this).OnExit(); } protected virtual void PlaySwingEffect() { EffectManager.SimpleMuzzleFlash(swingEffectPrefab, ((EntityState)this).gameObject, muzzleString, false); } protected virtual void OnHitEnemyAuthority() { Util.PlaySound(hitSoundString, ((EntityState)this).gameObject); if (!hasHopped) { if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) && !((EntityState)this).characterMotor.isGrounded && hitHopVelocity > 0f) { ((BaseState)this).SmallHop(((EntityState)this).characterMotor, hitHopVelocity); } hasHopped = true; } ApplyHitstop(); } protected void ApplyHitstop() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) if (!inHitPause && hitStopDuration > 0f) { storedVelocity = ((EntityState)this).characterMotor.velocity; hitStopCachedState = ((BaseState)this).CreateHitStopCachedState(((EntityState)this).characterMotor, animator, playbackRateParam); hitPauseTimer = hitStopDuration / ((BaseState)this).attackSpeedStat; inHitPause = true; } } private void FireAttack() { if (((EntityState)this).isAuthority && attack.Fire((List<HurtBox>)null)) { OnHitEnemyAuthority(); } } private void EnterAttack() { hasFired = true; Util.PlayAttackSpeedSound(swingSoundString, ((EntityState)this).gameObject, ((BaseState)this).attackSpeedStat); PlaySwingEffect(); if (((EntityState)this).isAuthority) { ((BaseState)this).AddRecoil(-1f * attackRecoil, -2f * attackRecoil, -0.5f * attackRecoil, 0.5f * attackRecoil); } } public override void FixedUpdate() { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) ((EntityState)this).FixedUpdate(); hitPauseTimer -= Time.fixedDeltaTime; if (hitPauseTimer <= 0f && inHitPause) { RemoveHitstop(); } if (!inHitPause) { stopwatch += Time.fixedDeltaTime; } else { if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor)) { ((EntityState)this).characterMotor.velocity = Vector3.zero; } if (Object.op_Implicit((Object)(object)animator)) { animator.SetFloat(playbackRateParam, 0f); } } bool flag = stopwatch >= duration * attackStartPercentTime; bool flag2 = stopwatch >= duration * attackEndPercentTime; if ((flag && !flag2) || (flag && flag2 && !hasFired)) { if (!hasFired) { EnterAttack(); } FireAttack(); } if (stopwatch >= duration && ((EntityState)this).isAuthority) { ((EntityState)this).outer.SetNextStateToMain(); } } private void RemoveHitstop() { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) ((BaseState)this).ConsumeHitStopCachedState(hitStopCachedState, ((EntityState)this).characterMotor, animator); inHitPause = false; ((EntityState)this).characterMotor.velocity = storedVelocity; } public override InterruptPriority GetMinimumInterruptPriority() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) if (stopwatch >= duration * earlyExitPercentTime) { return (InterruptPriority)0; } return (InterruptPriority)1; } public override void OnSerialize(NetworkWriter writer) { ((BaseSkillState)this).OnSerialize(writer); writer.Write(swingIndex); } public override void OnDeserialize(NetworkReader reader) { ((BaseSkillState)this).OnDeserialize(reader); swingIndex = reader.ReadInt32(); } public void SetStep(int i) { swingIndex = i; } } public class BaseTimedSkillState : BaseSkillState { public float TimedBaseDuration; public float TimedBaseCastStartTime; public float TimedBaseCastEndTime; protected float duration; protected float castStartPercentTime; protected float castEndPercentTime; protected bool hasFired; protected bool isFiring; protected bool hasExited; protected virtual void InitDurationValues(float baseDuration, float castStartPercentTime, float castEndPercentTime = 1f) { TimedBaseDuration = baseDuration; TimedBaseCastStartTime = castStartPercentTime; TimedBaseCastEndTime = castEndPercentTime; duration = TimedBaseDuration / ((BaseState)this).attackSpeedStat; this.castStartPercentTime = castStartPercentTime * duration; this.castEndPercentTime = castEndPercentTime * duration; } protected virtual void OnCastEnter() { } protected virtual void OnCastFixedUpdate() { } protected virtual void OnCastUpdate() { } protected virtual void OnCastExit() { } public override void FixedUpdate() { ((EntityState)this).FixedUpdate(); if (!hasFired && ((EntityState)this).fixedAge > castStartPercentTime) { hasFired = true; OnCastEnter(); } bool flag = ((EntityState)this).fixedAge >= castStartPercentTime; bool flag2 = ((EntityState)this).fixedAge >= castEndPercentTime; isFiring = false; if ((flag && !flag2) || (flag && flag2 && !hasFired)) { isFiring = true; OnCastFixedUpdate(); } if (flag2 && !hasExited) { hasExited = true; OnCastExit(); } if (((EntityState)this).fixedAge > duration) { ((EntityState)this).outer.SetNextStateToMain(); } } public override void Update() { ((EntityState)this).Update(); if (isFiring) { OnCastUpdate(); } } } public class ExampleTimedSkillState : BaseTimedSkillState { public static float SkillBaseDuration = 1.5f; public static float SkillStartTime = 0.2f; public static float SkillEndTime = 0.9f; public override void OnEnter() { ((BaseState)this).OnEnter(); InitDurationValues(SkillBaseDuration, SkillStartTime, SkillEndTime); } protected override void OnCastEnter() { } protected override void OnCastFixedUpdate() { } protected override void OnCastExit() { } } public class ExampleDelayedSkillState : BaseTimedSkillState { public static float SkillBaseDuration = 1.5f; public static float SkillStartTime = 0.2f; public override void OnEnter() { ((BaseState)this).OnEnter(); InitDurationValues(SkillBaseDuration, SkillStartTime); } protected override void OnCastEnter() { } } } namespace EliteReworks.Modules.Achievements { public abstract class BaseMasteryAchievement : BaseAchievement { public abstract string RequiredCharacterBody { get; } public abstract float RequiredDifficultyCoefficient { get; } public override BodyIndex LookUpRequiredBodyIndex() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) return BodyCatalog.FindBodyIndex(RequiredCharacterBody); } public override void OnBodyRequirementMet() { ((BaseAchievement)this).OnBodyRequirementMet(); Run.onClientGameOverGlobal += OnClientGameOverGlobal; } public override void OnBodyRequirementBroken() { Run.onClientGameOverGlobal -= OnClientGameOverGlobal; ((BaseAchievement)this).OnBodyRequirementBroken(); } private void OnClientGameOverGlobal(Run run, RunReport runReport) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Invalid comparison between Unknown and I4 //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Invalid comparison between Unknown and I4 if (!Object.op_Implicit((Object)(object)runReport.gameEnding) || !runReport.gameEnding.isWin) { return; } DifficultyIndex val = runReport.ruleBook.FindDifficulty(); DifficultyDef difficultyDef = DifficultyCatalog.GetDifficultyDef(val); if (difficultyDef != null) { bool flag = difficultyDef.countsAsHardMode && difficultyDef.scalingValue >= RequiredDifficultyCoefficient; bool flag2 = difficultyDef.nameToken == "INFERNO_NAME"; bool flag3 = (int)val >= 3 && (int)val <= 10; if (flag || flag2 || flag3) { ((BaseAchievement)this).Grant(); } } } } } namespace EliteReworks.Equipment { public abstract class EquipmentBase<T> : EquipmentBase where T : EquipmentBase<T> { public static T instance { get; private set; } public EquipmentBase() { if (instance != null) { throw new InvalidOperationException("Singleton class \"" + typeof(T).Name + "\" inheriting ItemBoilerplate/Item was instantiated twice"); } instance = this as T; } } public abstract class EquipmentBase : SharedBase { public enum TargetingType { Enemies, Friendlies } public class TargetingControllerComponent : MonoBehaviour { public GameObject TargetObject; public GameObject VisualizerPrefab; public Indicator Indicator; public BullseyeSearch TargetFinder; public Action<BullseyeSearch> AdditionalBullseyeFunctionality = delegate { }; public void Awake() { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown Indicator = new Indicator(((Component)this).gameObject, (GameObject)null); } public void OnDestroy() { Invalidate(); } public void Invalidate() { TargetObject = null; Indicator.targetTransform = null; } public void ConfigureTargetFinderBase(EquipmentSlot self) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: 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_0019: Expected O, but got Unknown if (TargetFinder == null) { TargetFinder = new BullseyeSearch(); } TargetFinder.teamMaskFilter = TeamMask.allButNeutral; ((TeamMask)(ref TargetFinder.teamMaskFilter)).RemoveTeam(self.characterBody.teamComponent.teamIndex); TargetFinder.sortMode = (SortMode)2; TargetFinder.filterByLoS = true; float num = default(float); Ray val = CameraRigController.ModifyAimRayIfApplicable(self.GetAimRay(), ((Component)self).gameObject, ref num); TargetFinder.searchOrigin = ((Ray)(ref val)).origin; TargetFinder.searchDirection = ((Ray)(ref val)).direction; TargetFinder.maxAngleFilter = 10f; TargetFinder.viewer = self.characterBody; } public void ConfigureTargetFinderForEnemies(EquipmentSlot self) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) ConfigureTargetFinderBase(self); TargetFinder.teamMaskFilter = TeamMask.GetUnprotectedTeams(self.characterBody.teamComponent.teamIndex); TargetFinder.RefreshCandidates(); TargetFinder.FilterOutGameObject(((Component)self).gameObject); AdditionalBullseyeFunctionality(TargetFinder); PlaceTargetingIndicator(TargetFinder.GetResults()); } public void ConfigureTargetFinderForFriendlies(EquipmentSlot self) { //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_002f: Unknown result type (might be due to invalid IL or missing references) ConfigureTargetFinderBase(self); TargetFinder.teamMaskFilter = TeamMask.none; ((TeamMask)(ref TargetFinder.teamMaskFilter)).AddTeam(self.characterBody.teamComponent.teamIndex); TargetFinder.RefreshCandidates(); TargetFinder.FilterOutGameObject(((Component)self).gameObject); AdditionalBullseyeFunctionality(TargetFinder); PlaceTargetingIndicator(TargetFinder.GetResults()); } public void PlaceTargetingIndicator(IEnumerable<HurtBox> TargetFinderResults) { HurtBox val = (TargetFinderResults.Any() ? TargetFinderResults.First() : null); if (Object.op_Implicit((Object)(object)val)) { TargetObject = ((Component)val.healthComponent).gameObject; Indicator.visualizerPrefab = VisualizerPrefab; Indicator.targetTransform = ((Component)val).transform; } else { Invalidate(); } Indicator.active = Object.op_Implicit((Object)(object)val); } } public EquipmentDef EquipDef; public GameObject TargetingIndicatorPrefabBase = null; public override string TOKEN_PREFIX => "EQUIPMENT_"; public abstract string EquipmentName { get; } public abstract string EquipmentPickupDesc { get; } public abstract string EquipmentFullDescription { get; } public abstract string EquipmentLore { get; } public abstract GameObject EquipmentModel { get; } public abstract Sprite EquipmentIcon { get; } public virtual bool AppearsInSinglePlayer { get; } = true; public virtual bool AppearsInMultiPlayer { get; } = true; public virtual bool CanDrop { get; } = true; public virtual bool IsBoss { get; } = false; public virtual bool IsLunar { get; } = false; public virtual ColorIndex ColorIndex { get; } = (ColorIndex)5; public virtual ExpansionDef RequiredExpansion { get; } = null; public abstract float BaseCooldown { get; } public abstract bool EnigmaCompatible { get; } public abstract bool CanBeRandomlyActivated { get; } public virtual bool UseTargeting { get; } = false; public virtual TargetingType TargetingTypeEnum { get; } = TargetingType.Enemies; internal static void CloneVanillaDisplayRules(Object newDef, Object vanillaDef) { } public override void Init() { base.Init(); CreateEquipment(); } public abstract ItemDisplayRuleDict CreateItemDisplayRules(); public override void Lang() { LanguageAPI.Add(BASE_TOKEN + "_NAME", EquipmentName); LanguageAPI.Add(BASE_TOKEN + "_PICKUP", EquipmentPickupDesc); LanguageAPI.Add(BASE_TOKEN + "_DESCRIPTION", EquipmentFullDescription); LanguageAPI.Add(BASE_TOKEN + "_LORE", EquipmentLore); } protected void CreateEquipment() { //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Expected O, but got Unknown //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Expected O, but got Unknown //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Expected O, but got Unknown //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Expected O, but got Unknown EquipDef = ScriptableObject.CreateInstance<EquipmentDef>(); ((Object)EquipDef).name = BASE_TOKEN; EquipDef.nameToken = BASE_TOKEN + "_NAME"; EquipDef.pickupToken = BASE_TOKEN + "_PICKUP"; EquipDef.descriptionToken = BASE_TOKEN + "_DESCRIPTION"; EquipDef.loreToken = BASE_TOKEN + "_LORE"; EquipDef.pickupModelPrefab = EquipmentModel; EquipDef.pickupIconSprite = EquipmentIcon; EquipDef.appearsInSinglePlayer = AppearsInSinglePlayer; EquipDef.appearsInMultiPlayer = AppearsInMultiPlayer; EquipDef.canDrop = CanDrop; EquipDef.cooldown = Bind(BaseCooldown, "Base Cooldown"); EquipDef.enigmaCompatible = Bind(EnigmaCompatible, "Enigma-Compatible"); EquipDef.canBeRandomlyTriggered = Bind(CanBeRandomlyActivated, "Bottled Chaos-Compatible"); EquipDef.isBoss = IsBoss; EquipDef.isLunar = IsLunar; EquipDef.colorIndex = ColorIndex; EquipDef.requiredExpansion = RequiredExpansion; ItemDisplayRuleDict val = CreateItemDisplayRules(); if (val == null) { val = new ItemDisplayRuleDict(Array.Empty<ItemDisplayRule>()); } ItemAPI.Add(new CustomEquipment(EquipDef, val)); EquipmentSlot.PerformEquipmentAction += new hook_PerformEquipmentAction(PerformEquipmentAction); if (UseTargeting && Object.op_Implicit((Object)(object)TargetingIndicatorPrefabBase)) { EquipmentSlot.Update += new hook_Update(UpdateTargeting); } } internal bool PerformEquipmentAction(orig_PerformEquipmentAction orig, EquipmentSlot self, EquipmentDef equipmentDef) { if ((Object)(object)equipmentDef == (Object)(object)EquipDef) { return ActivateEquipment(self); } return orig.Invoke(self, equipmentDef); } protected abstract bool ActivateEquipment(EquipmentSlot slot); protected void UpdateTargeting(orig_Update orig, EquipmentSlot self) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); if (self.equipmentIndex != EquipDef.equipmentIndex) { return; } TargetingControllerComponent targetingControllerComponent = ((Component)self).GetComponent<TargetingControllerComponent>(); if (!Object.op_Implicit((Object)(object)targetingControllerComponent)) { targetingControllerComponent = ((Component)self).gameObject.AddComponent<TargetingControllerComponent>(); targetingControllerComponent.VisualizerPrefab = TargetingIndicatorPrefabBase; } if (self.stock > 0) { switch (TargetingTypeEnum) { case TargetingType.Enemies: targetingControllerComponent.ConfigureTargetFinderForEnemies(self); break; case TargetingType.Friendlies: targetingControllerComponent.ConfigureTargetFinderForFriendlies(self); break; } } else { targetingControllerComponent.Invalidate(); targetingControllerComponent.Indicator.active = false; } } public static GameObject LoadDropPrefab(string prefabName = "") { GameObject val = null; if (Object.op_Implicit((Object)(object)EliteReworksPlugin.mainAssetBundle) && prefabName != "") { val = EliteReworksPlugin.mainAssetBundle.LoadAsset<GameObject>("Assets/Models/DropPrefabs/Item/" + prefabName + ".prefab"); } if ((Object)(object)val == (Object)null) { val = Resources.Load<GameObject>("prefabs/NullModel"); } return val; } public static GameObject LoadDisplayPrefab(string prefabName = "") { GameObject result = null; if (Object.op_Implicit((Object)(object)EliteReworksPlugin.mainAssetBundle) && prefabName != "") { result = EliteReworksPlugin.mainAssetBundle.LoadAsset<GameObject>("Assets/Models/DisplayPrefabs/Item/" + prefabName + ".prefab"); } return result; } public static Sprite LoadItemIcon(string spriteName = "") { Sprite val = null; if (Object.op_Implicit((Object)(object)EliteReworksPlugin.mainAssetBundle) && spriteName != "") { val = EliteReworksPlugin.mainAssetBundle.LoadAsset<Sprite>("Assets/Textures/Icons/Item/" + spriteName + ".png"); } if ((Object)(object)val == (Object)null) { val = Resources.Load<Sprite>("textures/miscicons/texWIPIcon"); } return val; } public static ExpansionDef SotvExpansionDef() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) return Addressables.LoadAssetAsync<ExpansionDef>((object)"RoR2/DLC1/Common/DLC1.asset").WaitForCompletion(); } } internal class GuillotineEquipment : EquipmentBase<GuillotineEquipment> { public static BuffDef luckBuff; public static BuffDef executionDebuff; [AutoConfig("Bonus Aspect Drop Chance", 0.1f)] public static float aspectDropChance = 0.1f; [AutoConfig("Base Execution Threshold", 0.2f)] public static float newExecutionThresholdBase = 0.2f; [AutoConfig("Bonus Execution Threshold For Status", 0.1f)] public static float newExecutionThresholdStack = 0.1f; [AutoConfig("Execution Status Bonus VS Bosses", false)] private bool strongerVsBosses = false; [AutoConfig("Execution Status Bonus VS Elites", true)] private bool strongerVsElites = true; [AutoConfig("Execution Duration", 10)] public static float executeDuration = 10f; [AutoConfig("Luck Duration", 10)] public static float luckDuration = 9f; [AutoConfig("Guillotine Damage Coefficient", 1)] public static float guillotineDamageCoefficient = 1f; private static ItemDisplayRuleDict IDR = new ItemDisplayRuleDict(Array.Empty<ItemDisplayRule>()); private string baseThreshold = Tools.ConvertDecimal(newExecutionThresholdBase + newExecutionThresholdStack); private string stackThreshold = Tools.ConvertDecimal(newExecutionThresholdStack); public override AssetBundle assetBundle => null; public override string ConfigName => "Reworks : Old Guillotine"; public override string EquipmentName => "Old Guillotine"; public override string TOKEN_IDENTIFIER => "BOBOGUILLOTINE"; public override string EquipmentPickupDesc => "Instantly kill low health Elite monsters."; public override string EquipmentFullDescription => "Instantly kill Elite monsters below " + Language.Styling.RedText(Language.Styling.ConvertDecimal(newExecutionThresholdBase) + " max health") + ". Gain a " + Language.Styling.UtilityColor(Language.Styling.ConvertDecimal(aspectDropChance) + "chance") + " to claim the power of slain Elite monsters."; public override string EquipmentLore => "Order: Old Guillotine\nTracking Number: 782*****\nEstimated Delivery: 04/29/2056\nShipping Method: Standard\nShipping Address: Warehouse 36, Anklar, Primas V\nShipping Details:\n\nEveryone is still operating on adrenaline here. We finally overthrew our oppressors and have taken back Primas V! I know some of the overlords will attempt to buy their way onto a stealth transport, but that’s going to be quite difficult due to their epic economic blunder.\n\nWe don’t just want blood for all the injustices we’ve suffered at their hands. We want to send a message to would-be sympathizers. This old guillotine will serve both as an execution method and a symbol to strike fear into their hearts wherever they might be hiding.\n\nPrimas V is alive!"; public override GameObject EquipmentModel => LegacyResourcesAPI.Load<GameObject>("prefabs/pickupmodels/PickupGuillotine"); public override Sprite EquipmentIcon => LegacyResourcesAPI.Load<Sprite>("textures/itemicons/texGuillotineIcon"); public override float BaseCooldown => 25f; public override bool EnigmaCompatible => false; public override bool CanBeRandomlyActivated => false; public override ItemDisplayRuleDict CreateItemDisplayRules() { return IDR; } public IEnumerator GetDisplayRules(orig_Init orig) { orig.Invoke(); EquipmentBase.CloneVanillaDisplayRules((Object)(object)EquipmentBase<GuillotineEquipment>.instance.EquipDef, (Object)(object)Items.ExecuteLowHealthElite); yield break; } private void GuillotineStats(CharacterBody sender, MoreStatHookEventArgs args) { int buffCount = sender.GetBuffCount(executionDebuff); float num = newExecutionThresholdBase + newExecutionThresholdStack * (float)buffCount; args.ModifyBaseExecutionThreshold(num, buffCount > 0); args.luckAdd += (float)sender.GetBuffCount(luckBuff); } private void GuillotineExecuteBehavior(orig_OnCharacterDeath orig, GlobalEventManager self, DamageReport damageReport) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown CharacterBody attackerBody = damageReport.attackerBody; CharacterBody victimBody = damageReport.victimBody; if (Object.op_Implicit((Object)(object)attackerBody) && Object.op_Implicit((Object)(object)victimBody)) { SkillLocator skillLocator = attackerBody.skillLocator; if (victimBody.HasBuff(executionDebuff)) { attackerBody.AddTimedBuffAuthority(luckBuff.buffIndex, luckDuration); if ((Object)(object)skillLocator != (Object)null) { if (NetworkServer.active && !skillLocator.networkIdentity.hasAuthority) { NetworkWriter val = new NetworkWriter(); val.StartMessage((short)63); val.Write(((Component)skillLocator).gameObject); val.FinishMessage(); NetworkConnection clientAuthorityOwner = skillLocator.networkIdentity.clientAuthorityOwner; if (clientAuthorityOwner != null) { clientAuthorityOwner.SendWriter(val, QosChannelIndex.defaultReliable.intVal); return; } } else { GenericSkill[] array = (GenericSkill[])(object)new GenericSkill[4] { skillLocator.primary, skillLocator.secondary, skillLocator.utility, skillLocator.special }; Util.ShuffleArray<GenericSkill>(array); GenericSkill[] array2 = array; foreach (GenericSkill val2 in array2) { if (Object.op_Implicit((Object)(object)val2) && val2.CanApplyAmmoPack()) { Debug.LogFormat("Resetting skill {0}", new object[1] { val2.skillName }); val2.AddOneStock(); } } } } } } orig.Invoke(self, damageReport); } public override void Init() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) AssetReferenceT<ItemDef> val = new AssetReferenceT<ItemDef>(RoR2_Base_ExecuteLowHealthElite.ExecuteLowHealthElite_asset); AsyncOperationHandle<ItemDef> val2 = AssetAsyncReferenceManager<ItemDef>.LoadAsset(val, (AsyncReferenceHandleUnloadType)2); val2.Completed += delegate(AsyncOperationHandle<ItemDef> ctx) { EliteReworksPlugin.RetierItem(ctx.Result, (ItemTier)5); }; executionDebuff = Content.CreateAndAddBuff("bdExecutionDebuffStackable", Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/Nullifier/texBuffNullifiedIcon.tif").WaitForCompletion(), Color.white, canStack: true, isDebuff: true); BuffDef obj = executionDebuff; obj.flags = (Flags)(obj.flags | 1); luckBuff = Content.CreateAndAddBuff("bdLuckBuffStackable", Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/Nullifier/texBuffNullifiedIcon.tif").WaitForCompletion(), Color.green, canStack: true, isDebuff: false); base.Init(); EquipDef.unlockableDef = UnlockableCatalog.GetUnlockableDef("KillElitesMilestone"); } public override void Hooks() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown ((ResourceAvailability)(ref BodyCatalog.availability)).onAvailable += delegate { EquipmentBase.CloneVanillaDisplayRules((Object)(object)EquipmentBase<GuillotineEquipment>.instance.EquipDef, (Object)(object)Items.ExecuteLowHea