Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of FruitySurvivorTweaks v3.2.7
SurvivorTweaks.dll
Decompiled a week ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.RegularExpressions; using AncientScepter; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using EntityStates; using EntityStates.Bandit2; using EntityStates.Bandit2.Weapon; using EntityStates.Captain.Weapon; using EntityStates.CaptainDefenseMatrixItem; using EntityStates.CaptainSupplyDrop; using EntityStates.Commando; using EntityStates.Commando.CommandoWeapon; using EntityStates.Croco; using EntityStates.Engi.EngiBubbleShield; using EntityStates.Engi.EngiMissilePainter; using EntityStates.Engi.EngiWeapon; using EntityStates.Engi.Mine; using EntityStates.GlobalSkills.LunarNeedle; using EntityStates.Huntress; using EntityStates.Huntress.HuntressWeapon; using EntityStates.Huntress.Weapon; using EntityStates.Loader; using EntityStates.Mage; using EntityStates.Mage.Weapon; using EntityStates.Merc; using EntityStates.Merc.Weapon; using EntityStates.Toolbot; using EntityStates.Treebot; using EntityStates.Treebot.Weapon; using EntityStates.VoidJailer.Weapon; using EntityStates.VoidSurvivor; using EntityStates.VoidSurvivor.Weapon; using IL.EntityStates.Bandit2.Weapon; using IL.EntityStates.Croco; using IL.EntityStates.Engi.EngiWeapon; using IL.EntityStates.Engi.Mine; using IL.RoR2; using MissileRework; using Mono.Cecil.Cil; using MonoMod.Cil; using MoreStats; using On.EntityStates; using On.EntityStates.Bandit2; using On.EntityStates.Bandit2.Weapon; using On.EntityStates.Captain.Weapon; using On.EntityStates.CaptainDefenseMatrixItem; using On.EntityStates.CaptainSupplyDrop; using On.EntityStates.Commando; using On.EntityStates.Commando.CommandoWeapon; using On.EntityStates.Croco; using On.EntityStates.Engi.EngiBubbleShield; using On.EntityStates.Engi.EngiWeapon; using On.EntityStates.Engi.Mine; using On.EntityStates.Huntress; using On.EntityStates.Huntress.HuntressWeapon; using On.EntityStates.Huntress.Weapon; using On.EntityStates.Mage; using On.EntityStates.Mage.Weapon; using On.EntityStates.Merc; using On.EntityStates.Merc.Weapon; using On.EntityStates.Toolbot; using On.EntityStates.Treebot; using On.EntityStates.Treebot.Weapon; using On.EntityStates.VoidSurvivor; using On.EntityStates.VoidSurvivor.Weapon; using On.RoR2; using On.RoR2.Orbs; using On.RoR2.Projectile; using On.RoR2.Skills; using R2API; using R2API.Utils; using RainrotSharedUtils; using RainrotSharedUtils.Components; using RainrotSharedUtils.Shelters; using RainrotSharedUtils.Status; using RoR2; using RoR2.Achievements; using RoR2.Audio; using RoR2.ContentManagement; using RoR2.ExpansionManagement; using RoR2.Orbs; using RoR2.Projectile; using RoR2.Skills; using RoR2.Stats; using RoR2.UI; using RoR2BepInExPack.GameAssetPaths.Version_1_39_0; using RoR2BepInExPack.GameAssetPathsBetter; using SurvivorTweaks.Components; using SurvivorTweaks.Modules; using SurvivorTweaks.Orbs; using SurvivorTweaks.Skills; using SurvivorTweaks.States.Captain; using SurvivorTweaks.States.Commando; using SurvivorTweaks.States.Huntress; using SurvivorTweaks.States.Loader; using SurvivorTweaks.States.VoidFiend; using SurvivorTweaks.SurvivorTweaks; using SurvivorTweaks.Unlocks; using SwanSongExtended; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Events; 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("SurvivorTweaks")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("SurvivorTweaks")] [assembly: AssemblyTitle("SurvivorTweaks")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: UnverifiableCode] namespace SurvivorTweaks { internal static class Log { public static bool enableDebugging; internal static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { enableDebugging = ConfigManager.DualBindToConfig("Swan Song", Config.MyConfig, "Enable Debugging", defaultValue: false, "Enable debug outputs to the log for troubleshooting purposes. Enabling this will slow down the game."); _logSource = logSource; } public static void DebugBreakpoint(string methodName, int breakpointNumber = -1) { string text = "SurvivorTweaks: " + methodName + " IL hook failed!"; if (breakpointNumber >= 0) { text += $" (breakpoint {breakpointNumber})"; } Error(text); } internal static string Combine(params string[] parameters) { string text = "SurvivorTweaks : "; 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)); } } [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.*/)] [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.SurvivorTweaks", "SurvivorTweaks", "3.2.6")] public class SurvivorTweaksPlugin : BaseUnityPlugin { public static SurvivorTweaksPlugin instance; public const string guid = "com.RiskOfBrainrot.SurvivorTweaks"; public const string teamName = "RiskOfBrainrot"; public const string modName = "SurvivorTweaks"; public const string version = "3.2.6"; public const string DEVELOPER_PREFIX = "FRUIT"; public static ExpansionDef expansionDefSS2; public const string iconsPath = ""; public static AssetBundle mainAssetBundle => CommonAssets.mainAssetBundle; public static bool iabMissilesLoaded => ModLoaded("com.RiskOfBrainrot.IAmBecomeMissiles"); public static bool isAELoaded => ModLoaded("com.Borbo.ArtificerExtended"); public static bool is2R4RLoaded => ModLoaded("com.HouseOfFruits.RiskierRain"); public static bool isHBULoaded => ModLoaded("com.Borbo.HuntressBuffULTIMATE"); public static bool isScepterLoaded => ModLoaded("com.DestroyedClone.AncientScepter"); public static bool autosprintLoaded => ModLoaded("com.johnedwa.RTAutoSprintEx"); public static bool acridLungeLoaded => ModLoaded("Withor.AcridBiteLunge"); public static bool ucrLoaded => ModLoaded("HIFU.UltimateCustomRun"); public static bool ModLoaded(string modGuid) { return modGuid != "" && Chainloader.PluginInfos.ContainsKey(modGuid); } public static bool IsMissileArtifactEnabled() { if (ModLoaded("com.RiskOfBrainrot.IAmBecomeMissiles")) { return GetMissileArtifactEnabled(); } return false; } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static bool GetMissileArtifactEnabled() { return RunArtifactManager.instance.IsArtifactEnabled(MissileReworkPlugin.MissileArtifact); } private void Awake() { instance = this; Config.Init(); Log.Init(((BaseUnityPlugin)this).Logger); ShockUtilsModule.UseShockSparks = true; Language.Init(); Hooks.Init(); CommonAssets.Init(); InitializeContent(); Config.Save(); new ContentPacks().Initialize(); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private void SetExpansion() { expansionDefSS2 = SwanSongPlugin.expansionDefSS2; } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static bool GetBodyHasWarfare(CharacterBody body) { return false; } private void InitializeContent() { Type[] types = Assembly.GetExecutingAssembly().GetTypes(); BeginInitializing<SurvivorTweakBase>(types, "SurvivorTweaks.txt"); BeginInitializing<SkillBase>(types, "SurvivorTweaksSkills.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(); } public static bool GetConfigBool(bool defaultValue, string packetTitle, string desc = "") { return ConfigManager.DualBindToConfig(packetTitle, Config.MyConfig, "Should This Content Be Enabled", defaultValue, desc); } public static SkillDef CloneSkillDef(SkillDef oldDef) { //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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) SkillDef val = ScriptableObject.CreateInstance<SkillDef>(); val.skillName = oldDef.skillName; val.skillNameToken = oldDef.skillNameToken; val.skillDescriptionToken = oldDef.skillDescriptionToken; val.icon = oldDef.icon; val.activationStateMachineName = oldDef.activationStateMachineName; val.activationState = oldDef.activationState; val.interruptPriority = oldDef.interruptPriority; val.baseRechargeInterval = oldDef.baseRechargeInterval; val.baseMaxStock = oldDef.baseMaxStock; val.rechargeStock = oldDef.rechargeStock; val.requiredStock = oldDef.requiredStock; val.stockToConsume = oldDef.stockToConsume; val.beginSkillCooldownOnSkillEnd = oldDef.beginSkillCooldownOnSkillEnd; val.fullRestockOnAssign = oldDef.fullRestockOnAssign; val.dontAllowPastMaxStocks = oldDef.dontAllowPastMaxStocks; val.resetCooldownTimerOnUse = oldDef.resetCooldownTimerOnUse; val.isCombatSkill = oldDef.isCombatSkill; val.cancelSprintingOnActivation = oldDef.cancelSprintingOnActivation; val.canceledFromSprinting = oldDef.canceledFromSprinting; val.forceSprintDuringState = oldDef.forceSprintDuringState; val.mustKeyPress = oldDef.mustKeyPress; val.keywordTokens = oldDef.keywordTokens; return val; } public static AssetReferenceT<T> LoadAsync<T>(string guid, Action<T> callback) where T : Object { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) AssetReferenceT<T> val = new AssetReferenceT<T>(guid); AsyncOperationHandle<T> handle2 = AssetAsyncReferenceManager<T>.LoadAsset(val, (AsyncReferenceHandleUnloadType)2); if (callback == null) { return val; } if (handle2.IsDone) { onCompleted(handle2); return val; } handle2.Completed += onCompleted; return val; void onCompleted(AsyncOperationHandle<T> handle) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Invalid comparison between Unknown and I4 if (handle.Result == null || (int)handle.Status != 1) { Debug.LogError((object)$"Failed to load asset [{handle.DebugName}] : {handle.OperationException}"); } else { callback(handle.Result); } } } } public static class Extensions { public static string AsPercent(this float d) { return d * 100f + "%"; } public static void AddPersistentListener(this ProjectileImpactEvent unityEvent, UnityAction<ProjectileImpactInfo> action) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) PersistentCallGroup persistentCalls = ((UnityEventBase)unityEvent).m_PersistentCalls; PersistentCall val = new PersistentCall(); ref Object target = ref val.m_Target; object? target2 = ((Delegate)(object)action).Target; target = (Object)((target2 is Object) ? target2 : null); val.m_TargetAssemblyTypeName = UnityEventTools.TidyAssemblyTypeName(((Delegate)(object)action).Method.DeclaringType.AssemblyQualifiedName); val.m_MethodName = ((Delegate)(object)action).Method.Name; val.m_CallState = (UnityEventCallState)2; val.m_Mode = (PersistentListenerMode)0; persistentCalls.AddListener(val); } public static void AddPersistentListener(this UnityEvent unityEvent, UnityAction action) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) PersistentCallGroup persistentCalls = ((UnityEventBase)unityEvent).m_PersistentCalls; PersistentCall val = new PersistentCall(); ref Object target = ref val.m_Target; object? target2 = ((Delegate)(object)action).Target; target = (Object)((target2 is Object) ? target2 : null); val.m_TargetAssemblyTypeName = UnityEventTools.TidyAssemblyTypeName(((Delegate)(object)action).Method.DeclaringType.AssemblyQualifiedName); val.m_MethodName = ((Delegate)(object)action).Method.Name; val.m_CallState = (UnityEventCallState)2; val.m_Mode = (PersistentListenerMode)0; persistentCalls.AddListener(val); } } 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 SurvivorTweaks.Modules { public static class CommonAssets { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static CustomDotBehaviour <>9__41_0; internal void <AddAcridReworkAssets>b__41_0(DotController self, DotStack dotStack) { } } 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 BuffDef commandoRollBuff; public static BuffDef jetpackSpeedBoost; public static float jetpackSpeedPercent = 0.15f; public static BuffDef captainCdrBuff; public static float captainCdrPercent = 0.25f; public static BuffDef aspdPenaltyDebuff; public static float aspdPenaltyPercent = 0.25f; public static BuffDef desperadoTokenSurplusBuff; public static BuffDef desperadoExecutionDebuff; public static BuffDef lightsoutExecutionDebuff; public static ModdedDamageType AcridFesterDamage; public static ModdedDamageType AcridCorrosiveDamage; public static BuffDef corrosionBuff; public static DotDef corrosionDotDef; public static DotIndex corrosionDotIndex; public static float contagiousTransferRate = 0.5f; public static int corrosionArmorReduction = 15; public static float corrosionDuration = 8f; public static float corrosionDamagePerSecond = 1f; public static float corrosionTickInterval = 1f; public static bool festerResetOnlyKitDots = true; public const string AcridFesterKeywordToken = "KEYWORD_FESTER"; public const string AcridCorrosionKeywordToken = "KEYWORD_CORROSION"; public const string AcridContagiousKeywordToken = "KEYWORD_CONTAGIOUS"; public static AssetBundle mainAssetBundle { get { if ((Object)(object)_mainAssetBundle == (Object)null) { _mainAssetBundle = Assets.LoadAssetBundle("survivortweaks"); } return _mainAssetBundle; } set { _mainAssetBundle = value; } } public static void Init() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown AddAcridReworkAssets(); AddAspdPenaltyDebuff(); AddCommanderRollBuff(); AddJetpackSpeedBoost(); AddBanditExecutionBuffs(); AddCaptainCooldownBuff(); RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(CommonAssetStats); CharacterBody.RecalculateStats += new hook_RecalculateStats(RecalcStats_Stats); BaseState.AddRecoil += new hook_AddRecoil(OnAddRecoil); CharacterBody.AddSpreadBloom += new hook_AddSpreadBloom(OnAddSpreadBloom); } public static void AddBanditExecutionBuffs() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0061: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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) desperadoTokenSurplusBuff = Content.CreateAndAddBuff("bdDesperadoTokenSurplus", Addressables.LoadAssetAsync<Sprite>((object)RoR2_Base_Bandit2.texBuffBanditSkullIcon_tif).WaitForCompletion(), new Color(0.6f, 0.9f, 0.8f, 1f), canStack: true, isDebuff: false); desperadoExecutionDebuff = Content.CreateAndAddBuff("bdDesperadoExecute", null, Color.black, canStack: false, isDebuff: true); BuffDef obj = desperadoExecutionDebuff; obj.flags = (Flags)(obj.flags | 1); desperadoExecutionDebuff.isHidden = true; lightsoutExecutionDebuff = Content.CreateAndAddBuff("bdLightsOutExecute", null, Color.black, canStack: false, isDebuff: true); BuffDef obj2 = lightsoutExecutionDebuff; obj2.flags = (Flags)(obj2.flags | 1); lightsoutExecutionDebuff.isHidden = true; } public static void OnAddSpreadBloom(orig_AddSpreadBloom orig, CharacterBody self, float value) { if (!self.HasBuff(commandoRollBuff)) { orig.Invoke(self, value); } } public static void OnAddRecoil(orig_AddRecoil orig, BaseState self, float verticalMin, float verticalMax, float horizontalMin, float horizontalMax) { if (!self.HasBuff(commandoRollBuff)) { orig.Invoke(self, verticalMin, verticalMax, horizontalMin, horizontalMax); } } public static void AddCommanderRollBuff() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) commandoRollBuff = Content.CreateAndAddBuff("bdDualieRoll", Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/Common/texMovespeedBuffIcon.tif").WaitForCompletion(), new Color(0.8f, 0.6f, 0.1f), canStack: false, isDebuff: false); } public static void AddJetpackSpeedBoost() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) jetpackSpeedBoost = Content.CreateAndAddBuff("bdJetpackSpeed", Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/Common/texMovespeedBuffIcon.tif").WaitForCompletion(), new Color(0.9f, 0.2f, 0.2f), canStack: false, isDebuff: false); } private static void CommonAssetStats(CharacterBody sender, StatHookEventArgs args) { if (sender.HasBuff(aspdPenaltyDebuff)) { args.attackSpeedReductionMultAdd += aspdPenaltyPercent; } if (sender.HasBuff(jetpackSpeedBoost)) { args.moveSpeedMultAdd += jetpackSpeedPercent; } if (sender.HasBuff(captainCdrBuff)) { SkillLocator skillLocator = sender.skillLocator; if ((Object)(object)skillLocator != (Object)null) { float cooldownScale2 = 1f - captainCdrPercent; ApplyCooldownScale(skillLocator.primary, cooldownScale2); ApplyCooldownScale(skillLocator.secondary, cooldownScale2); ApplyCooldownScale(skillLocator.utility, cooldownScale2); ApplyCooldownScale(skillLocator.special, cooldownScale2); } } static void ApplyCooldownScale(GenericSkill skillSlot, float cooldownScale) { if ((Object)(object)skillSlot != (Object)null) { skillSlot.cooldownScale *= cooldownScale; } } } public static void RecalcStats_Stats(orig_RecalculateStats orig, CharacterBody self) { orig.Invoke(self); } public static void AddAspdPenaltyDebuff() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) aspdPenaltyDebuff = Content.CreateAndAddBuff("bdAttackSpeedPenalty", Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/Common/texBuffSlow50Icon.tif").WaitForCompletion(), Color.red, canStack: false, isDebuff: false); } public static void AddCaptainCooldownBuff() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) aspdPenaltyDebuff = Content.CreateAndAddBuff("bdCaptainRestock", Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/Common/texMovespeedBuffIcon.tif").WaitForCompletion(), Color.yellow, canStack: false, isDebuff: false); } private static void AddAcridReworkAssets() { //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_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_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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Expected O, but got Unknown //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Expected O, but got Unknown //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected O, but got Unknown OrbAPI.AddOrb<DiseaseOrb>(); AcridFesterDamage = DamageAPI.ReserveDamageType(); AcridCorrosiveDamage = DamageAPI.ReserveDamageType(); corrosionBuff = Content.CreateAndAddBuff("AcridCorrosion", Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/Common/texBuffBleedingIcon.tif").WaitForCompletion(), Color.yellow, canStack: true, isDebuff: true); corrosionBuff.isDOT = true; corrosionDotDef = new DotDef { associatedBuff = corrosionBuff, damageCoefficient = corrosionDamagePerSecond * corrosionTickInterval, damageColorIndex = (DamageColorIndex)4, interval = corrosionTickInterval }; DotDef obj = corrosionDotDef; object obj2 = <>c.<>9__41_0; if (obj2 == null) { CustomDotBehaviour val = delegate { }; <>c.<>9__41_0 = val; obj2 = (object)val; } corrosionDotIndex = DotAPI.RegisterDotDef(obj, (CustomDotBehaviour)obj2, (CustomDotVisual)null); LanguageAPI.Add("KEYWORD_FESTER", Language.Styling.KeywordText("Festering", "Striking enemies " + Language.Styling.UtilityColor("resets") + " the duration of all " + Language.Styling.HealingColor("Poison") + ", " + Language.Styling.VoidColor("Blight") + ", and " + Language.Styling.DamageColor("Corrosion") + " stacks.")); LanguageAPI.Add("KEYWORD_CORROSION", Language.Styling.KeywordText("Caustic", "Deal " + Language.Styling.DamageColor(Tools.ConvertDecimal(corrosionDamagePerSecond) + " base damage") + " over " + Language.Styling.UtilityColor($"{corrosionDuration}s") + ". Reduce armor by " + Language.Styling.DamageColor(corrosionArmorReduction.ToString()) + ".")); LanguageAPI.Add("KEYWORD_CONTAGIOUS", Language.Styling.KeywordText("Contagious", "This skill transfers " + Language.Styling.DamageColor(Tools.ConvertDecimal(contagiousTransferRate)) + " of " + Language.Styling.UtilityColor("every damage over time stack") + " to nearby enemies.")); RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(CorrosionArmorReduction); OnHit.GetHitBehavior += new HitHookEventHandler(FesterOnHit); } private static void CorrosionArmorReduction(CharacterBody sender, StatHookEventArgs args) { if (sender.HasBuff(corrosionBuff)) { args.armorAdd -= (float)corrosionArmorReduction; } } private static void FesterOnHit(CharacterBody attackerBody, DamageInfo damageInfo, CharacterBody victimBody) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Invalid comparison between Unknown and I4 //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Invalid comparison between Unknown and I4 //IL_0064: 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) if (DamageAPI.HasModdedDamageType(damageInfo, AcridFesterDamage)) { DotController val = DotController.FindDotController(((Component)victimBody).gameObject); if (Object.op_Implicit((Object)(object)val)) { foreach (DotStack dotStack in val.dotStackList) { if (!festerResetOnlyKitDots || (int)dotStack.dotIndex == 5 || (int)dotStack.dotIndex == 4 || dotStack.dotIndex == corrosionDotIndex) { float num = dotStack.totalDuration * damageInfo.procCoefficient; if (dotStack.timer < num) { dotStack.timer = num; } } } } } if (!DamageAPI.HasModdedDamageType(damageInfo, AcridCorrosiveDamage)) { return; } uint? maxStacksFromAttacker = null; if (Object.op_Implicit((Object)(object)damageInfo?.inflictor)) { ProjectileDamage component = damageInfo.inflictor.GetComponent<ProjectileDamage>(); if (Object.op_Implicit((Object)(object)component) && component.useDotMaxStacksFromAttacker) { maxStacksFromAttacker = component.dotMaxStacksFromAttacker; } } InflictDotInfo val2 = default(InflictDotInfo); val2.attackerObject = damageInfo.attacker; val2.victimObject = ((Component)victimBody).gameObject; val2.totalDamage = attackerBody.baseDamage * corrosionDamagePerSecond * corrosionDuration * damageInfo.procCoefficient; val2.damageMultiplier = 1f; val2.dotIndex = corrosionDotIndex; val2.maxStacksFromAttacker = maxStacksFromAttacker; InflictDotInfo val3 = val2; DotController.InflictDot(ref val3); } } 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)SurvivorTweaksPlugin.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_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown MyConfig = new ConfigFile(Paths.ConfigPath + "\\SurvivorTweaks.cfg", true); MyConfig.SaveOnConfigSet = false; BackupConfig = new ConfigFile(Paths.ConfigPath + "\\SurvivorTweaks.Backup.cfg", true); BackupConfig.SaveOnConfigSet = false; 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 void Save() { MyConfig.SaveOnConfigSet = true; MyConfig.Save(); BackupConfig.SaveOnConfigSet = true; BackupConfig.Save(); } 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.SurvivorTweaks"; 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 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)SurvivorTweaksPlugin.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)SurvivorTweaksPlugin.instance).Info.Location).FullName, "Language", "en", fileName); File.WriteAllText(path, text); } TokensOutput = ""; } } } } namespace SurvivorTweaks.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 SurvivorTweaks.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 SurvivorTweaks.Unlocks { public abstract class UnlockBase<T> : UnlockBase where T : UnlockBase<T> { public static T instance { get; private set; } public UnlockBase() { if (instance != null) { throw new InvalidOperationException("Singleton class \"" + typeof(T).Name + "\" inheriting UnlockBase was instantiated twice"); } instance = this as T; } } public abstract class UnlockBase : BaseAchievement { public abstract string TOKEN_IDENTIFIER { get; } public abstract string AchievementName { get; } public abstract string AchievementDesc { get; } public static UnlockableDef CreateUnlockDef(Type RequiredUnlock, Sprite icon) { string name = RequiredUnlock.Name; string text = name.ToUpperInvariant(); UnlockableDef val = Content.CreateAndAddUnlockbleDef(name, name, icon); string nameToken = "ACHIEVEMENT_" + text + "_NAME"; string descToken = "ACHIEVEMENT_" + text + "_DESCRIPTION"; LanguageAPI.Add(nameToken, Reflection.GetPropertyValue<string>(RequiredUnlock, "AchievementName")); LanguageAPI.Add(descToken, Reflection.GetPropertyValue<string>(RequiredUnlock, "AchievementDesc")); val.getHowToUnlockString = () => Language.GetStringFormatted("UNLOCK_VIA_ACHIEVEMENT_FORMAT", new object[2] { Language.GetString(nameToken), Language.GetString(descToken) }); val.getUnlockedString = () => Language.GetStringFormatted("UNLOCKED_FORMAT", new object[2] { Language.GetString(nameToken), Language.GetString(descToken) }); return val; } public void AddLang() { LanguageAPI.Add("ACHIEVEMENT_" + TOKEN_IDENTIFIER + "_NAME", AchievementName); LanguageAPI.Add("ACHIEVEMENT_" + TOKEN_IDENTIFIER + "_DESCRIPTION", AchievementDesc); } public override BodyIndex LookUpRequiredBodyIndex() { //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) //IL_000e: Unknown result type (might be due to invalid IL or missing references) return BodyCatalog.FindBodyIndex("MageBody"); } public static StatDef GetCareerStatTotal(string name) { StatDef val = StatDef.Find(name); if (val == null) { val = StatDef.Register(name, (StatRecordType)0, (StatDataType)0, 0.0, (DisplayValueFormatterDelegate)null); } return val; } } } namespace SurvivorTweaks.SurvivorTweaks { internal class AcridTweaks : SurvivorTweakBase<AcridTweaks> { public static bool isLoaded; public static float acridBaseDamage = 9f; public static float poisonDuration = 10f; public static float blightDuration = 5f; public static float slashDuration = 1f; public static float spitCooldown = 5f; public static float spitDamageCoeff = 1.8f; public static float spitDamageCoeffAfterDistance = 5.8f; public static float spitDistanceForBoost = 21f; public static float spitDuration = 0.4f; public static float spitBlastRadius = 6f; public static int spitBaseStock = 3; public static float biteForceStrength = 8000f; public static float biteCooldown = 3f; public static float biteDamageCoeff = 4.8f; public static float causticCooldown = 7f; public static float frenziedCooldown = 9f; public static float leapMinY = -0.3f; public static float epidemicCooldown = 15f; public static float epidemicDamageCoefficient = 0.5f; public static float epidemicInitialRange = 80f; public static float epidemicSpreadRange = 35f; public static float epidemicProjectileBlastRadius = 3f; public static int epidemicMaxTargets = 20; public static ModdedDamageType AcridSkillBasedDamage; public static string AcridBlightKeywordToken = "KEYWORD_BLIGHT"; public override string survivorName => "Acrid"; public override string bodyName => "CrocoBody"; public override void Init() { //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown GetBodyObject(); GetSkillsFromBodyObject(bodyObject); CharacterBody component = bodyObject.GetComponent<CharacterBody>(); component.baseMoveSpeed = 8f; component.baseDamage = acridBaseDamage; ChangePassive(); ChangeVanillaPrimary(primary); ChangeVanillaSecondaries(secondary); ChangeVanillaUtilities(utility); ChangeVanillaSpecials(special); GlobalEventManager.ProcessHitEnemy += new Manipulator(ChangePoisonDuration); LanguageAPI.Add("KEYWORD_POISON", "<style=cKeywordName>Poisonous</style>" + $"<style=cSub>Deal damage equal to <style=cIsDamage>up to {poisonDuration}%</style> of their maximum health over {poisonDuration}s. " + "<i>Poison cannot kill enemies.</i></style>"); LanguageAPI.Add(AcridBlightKeywordToken, "<style=cKeywordName>Blighted</style>" + $"<style=cSub>Deal <style=cIsDamage>60% base damage</style> over <style=cIsUtility>{blightDuration}s</style>. " + "<i>Blight can stack.</i></style>"); } private void ChangePassive() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown AcridSkillBasedDamage = DamageAPI.ReserveDamageType(); GenericSkill[] components = bodyObject.GetComponents<GenericSkill>(); GenericSkill val = components[0]; if (Object.op_Implicit((Object)(object)val)) { val.hideInCharacterSelect = true; Object.Destroy((Object)(object)val); } else { Debug.LogError((object)"No ACRID passive skill found"); } FireSpit.OnEnter += new Manipulator(FixSpitDamageTypes); Bite.AuthorityModifyOverlapAttack += new hook_AuthorityModifyOverlapAttack(FixBiteDamageTypes); } private void FixBiteDamageTypes(orig_AuthorityModifyOverlapAttack orig, Bite self, OverlapAttack overlapAttack) { //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_0018: Unknown result type (might be due to invalid IL or missing references) overlapAttack.damageType = DamageTypeCombo.op_Implicit((DamageType)1572864); overlapAttack.damageType.damageSource = (DamageSource)2; } private void FixSpitDamageTypes(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_004e: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld<FireProjectileInfo>(x, "damageTypeOverride") })) { int index = val.Index; val