using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using EntityStates; using EntityStates.AI.Walker; using EntityStates.DefectiveUnit; using EntityStates.Gup; using EntityStates.Poltergeist; using GorpMod.Characters.Enemies.Gorp; using GorpMod.Characters.Enemies.Gorp.Comopnents; using GorpMod.Characters.Enemies.Gorp.States; using GorpMod.Enemies.Gorp.Content; using GorpMod.Modules; using GorpMod.Modules.Characters; using GorpMod.Modules.Components; using HG.BlendableTypes; using HG.Reflection; using JetBrains.Annotations; using KinematicCharacterController; using On.RoR2; using R2API; using RiskOfOptions; using RiskOfOptions.OptionConfigs; using RiskOfOptions.Options; using RoR2; using RoR2.Achievements; using RoR2.AsyncManagement; using RoR2.Audio; using RoR2.CharacterAI; using RoR2.ContentManagement; using RoR2.Navigation; using RoR2.Projectile; using RoR2.Skills; using RoR2.UI; using RoR2BepInExPack.GameAssetPathsBetter; using ShaderSwapper; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; using UnityEngine.Rendering; using UnityEngine.ResourceManagement.AsyncOperations; [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: OptIn] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: AssemblyInformationalVersion("1.0.0+b539640433c8c3bb1a0281349d110c7fa5d0d969")] [assembly: AssemblyProduct("GorpMod")] [assembly: AssemblyTitle("GorpMod")] [assembly: AssemblyCompany("GorpMod")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Matchmaker { public static class Util { public static bool IsDebug => CharacterConfig.Debug.Value; public static Vector3 ToVector3(this Vector2 vector) { //IL_0000: 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_0011: Unknown result type (might be due to invalid IL or missing references) return new Vector3(vector.x, vector.y, 0f); } public static Vector3 ToVector3(this Vector2Int vector) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) return new Vector3((float)((Vector2Int)(ref vector)).x, (float)((Vector2Int)(ref vector)).y, 0f); } public static Vector2 ToVector2(this Vector3 vector) { //IL_0000: 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_000c: Unknown result type (might be due to invalid IL or missing references) return new Vector2(vector.x, vector.y); } public static Vector2 ToVector2(this Vector2Int vector) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) return new Vector2((float)((Vector2Int)(ref vector)).x, (float)((Vector2Int)(ref vector)).y); } public static Vector2Int RoundToInt(this Vector2 vector) { //IL_0000: 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_0016: Unknown result type (might be due to invalid IL or missing references) return new Vector2Int(Mathf.RoundToInt(vector.x), Mathf.RoundToInt(vector.y)); } public static Vector2Int FloorToInt(this Vector2 vector) { //IL_0000: 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_0016: Unknown result type (might be due to invalid IL or missing references) return new Vector2Int(Mathf.FloorToInt(vector.x), Mathf.FloorToInt(vector.y)); } public static bool FAILSAFE(ref int count) { count++; if (count > 100000) { Debug.LogError((object)"FAILSAFE"); return true; } return false; } public static float ExpDecayLerp(float a, float b, float decay, float deltaTime) { return b + (a - b) * Mathf.Exp((0f - decay) * deltaTime); } public static Vector3 ExpDecayLerp(Vector3 a, Vector3 b, float decay, float deltaTime) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: 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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) return b + (a - b) * Mathf.Exp((0f - decay) * deltaTime); } public static Color ExpDecayLerp(Color a, Color b, float decay, float deltaTime) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: 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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) return b + (a - b) * Mathf.Exp((0f - decay) * deltaTime); } public static void NormalizeSpriteScale(SpriteRenderer spriteRenderer, float scale) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001d: 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) //IL_0035: Unknown result type (might be due to invalid IL or missing references) Transform transform = ((Component)spriteRenderer).transform; Vector3 val = Vector3.one * scale * spriteRenderer.sprite.pixelsPerUnit; Rect rect = spriteRenderer.sprite.rect; transform.localScale = val / ((Rect)(ref rect)).width; } public static int WeightedRandom(List values, bool normalize = true) { if (normalize) { values.Normalize(); } float num = 0f; float value = Random.value; for (int i = 0; i < values.Count; i++) { num += values[i]; if (value <= num) { return i; } } return 0; } public static void Normalize(this List weights) { float num = 0f; for (int i = 0; i < weights.Count; i++) { num += weights[i]; } if (num > 0f) { for (int j = 0; j < weights.Count; j++) { weights[j] /= num; } } } } } namespace GorpMod { [BepInPlugin("com.TheTimesweeper.Gorp", "Gorp", "0.1.0")] public class GorpPlugin : BaseUnityPlugin { public const string MODUID = "com.TheTimesweeper.Gorp"; public const string MODNAME = "Gorp"; public const string MODVERSION = "0.1.0"; public const string DEVELOPER_PREFIX = "HABIBI"; public static GorpPlugin instance; private void Awake() { instance = this; Log.Init(((BaseUnityPlugin)this).Logger); Materials.Init(); Language.Init(); new GorpCharacter().Initialize(); new ContentPacks().Initialize(); } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCGorp(ConCommandArgs args) { //IL_0013: 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_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) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0076: 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_0056: 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) //IL_0065: 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_006f: Unknown result type (might be due to invalid IL or missing references) CharacterBody senderBody = ((ConCommandArgs)(ref args)).GetSenderBody(); InputBankTest inputBank = senderBody.inputBank; Ray val = default(Ray); ((Ray)(ref val))..ctor(inputBank.aimOrigin, inputBank.aimDirection); Vector3 val2 = senderBody.transform.position; RaycastHit val3 = default(RaycastHit); if (Util.CharacterRaycast(((Component)senderBody).gameObject, val, ref val3, float.PositiveInfinity, ((LayerIndex)(ref LayerIndex.world)).mask, (QueryTriggerInteraction)1)) { val2 = ((RaycastHit)(ref val3)).point + Vector3.up * 0.3f; } GameObject val4 = Object.Instantiate(GorpCharacter.BossEncounter, val2, Quaternion.identity); if (NetworkServer.active) { NetworkServer.Spawn(val4); } } } internal static class Log { private static ManualLogSource _logSource; public static DateTime _startTime = default(DateTime); private static string timesLog = ""; private static string funnyLog = ""; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void Debug(object data) { _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); } internal static bool CheckNullAndWarn(string name, object objecte) { Warning($"{name} is {objecte != null}"); return objecte != null; } internal static void WarningDebug(string format, params object[] data) { DebugWarning(format, data); } internal static void DebugWarning(string format, params object[] data) { bool flag = false; } internal static void CurrentTime(string funny) { bool flag = false; } internal static void AllTimes() { if (!string.IsNullOrEmpty(timesLog)) { Warning(timesLog); Warning(funnyLog); } } } } namespace GorpMod.Modules { internal static class Asset { internal static Dictionary loadedBundles = new Dictionary(); internal static Dictionary> loadingBundles = new Dictionary>(); internal static AssetBundle LoadAssetBundle(string bundleName) { AssetBundle result = null; try { result = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)GorpPlugin.instance).Info.Location), "AssetBundles", bundleName)); } catch (Exception arg) { Log.Error($"Error loading asset bundle, {bundleName}. Your asset bundle must be in a folder next to your mod dll called 'AssetBundles'. Follow the guide to build and install your mod correctly!\n{arg}"); } return result; } internal static void LoadAssetBundleAsync(string bundleName, Action onComplete) { if (bundleName == "myassetbundle") { Log.Error("AssetBundle name hasn't been changed. not loading any assets to avoid conflicts. Everything will now break.\nMake sure to rename your assetbundle filename and rename the AssetBundleName field in your character setup code."); } if (loadedBundles.ContainsKey(bundleName)) { onComplete(loadedBundles[bundleName]); return; } if (loadingBundles.ContainsKey(bundleName)) { Dictionary> dictionary = loadingBundles; string key = bundleName; dictionary[key] = (Action)Delegate.Combine(dictionary[key], onComplete); return; } loadingBundles[bundleName] = onComplete; string path = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)GorpPlugin.instance).Info.Location), "AssetBundles", bundleName); Action onComplete2 = delegate(AssetBundle bundle) { loadedBundles[bundleName] = bundle; if (loadingBundles.ContainsKey(bundleName)) { loadingBundles[bundleName]?.Invoke(bundle); loadingBundles.Remove(bundleName); } }; ContentPacks.asyncLoadCoroutines.Add(LoadAssetBundleFromPathAsync(path, onComplete2)); } internal static IEnumerator LoadAssetBundleFromPathAsync(string path, Action onComplete) { AssetBundleCreateRequest request = AssetBundle.LoadFromFileAsync(path); while (!((AsyncOperation)request).isDone) { yield return null; } onComplete?.Invoke(request.assetBundle); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static void RunShaderSwaper(AssetBundleCreateRequest request) { ContentPacks.asyncLoadCoroutines.Add(ShaderSwapper.UpgradeStubbedShadersAsync(request.assetBundle)); } internal static void LoadAssetAsync(this AssetBundle assetBundle, string name, Action onComplete) where T : Object { ContentPacks.asyncLoadCoroutines.Add(assetBundle.LoadAssetCoroutine(name, onComplete)); } internal static void LoadAssetAsync(string Path, Action onComplete) where T : Object { ContentPacks.asyncLoadCoroutines.Add(LoadAssetCoroutine(Path, onComplete)); } internal static AsyncAsset AddAsyncAsset(this AssetBundle assetBundle, string name, Action onComplete = null) where T : Object { return new AsyncAsset(assetBundle, name, onComplete).AddCoroutine(); } internal static AsyncAsset AddAsyncAsset(string path, Action onComplete = null) where T : Object { return new AsyncAsset(path, onComplete).AddCoroutine(); } internal static IEnumerator LoadAssetCoroutine(this AssetBundle assetBundle, string name, Action onComplete) where T : Object { AssetBundleRequest request = assetBundle.LoadAssetAsync(name); while (!((AsyncOperation)request).isDone) { yield return null; } onComplete?.Invoke((T)(object)/*isinst with value type is only supported in some contexts*/); } internal static IEnumerator LoadAssetCoroutine(object key, Action OnComplete) where T : Object { AsyncOperationHandle loadAsset = Addressables.LoadAssetAsync(key); while (!loadAsset.IsDone) { yield return null; } OnComplete?.Invoke(loadAsset.Result); } internal static void LoadAssetsAsync(AsyncAsset load1, Action onComplete) where T1 : Object { ContentPacks.asyncLoadCoroutines.Add(LoadAssetsAsyncCoroutine(load1, onComplete)); } internal static IEnumerator LoadAssetsAsyncCoroutine(AsyncAsset load1, Action onComplete) where T1 : Object { while (!load1.coroutine.MoveNext()) { yield return null; } onComplete(load1.result); } internal static void LoadAssetsAsync(AsyncAsset load1, AsyncAsset load2, Action onComplete) where T1 : Object where T2 : Object { ContentPacks.asyncLoadCoroutines.Add(LoadAssetsAsyncCoroutine(load1, load2, onComplete)); } internal static IEnumerator LoadAssetsAsyncCoroutine(AsyncAsset load1, AsyncAsset load2, Action onComplete) where T1 : Object where T2 : Object { while (!load1.coroutine.MoveNext()) { yield return null; } while (!load2.coroutine.MoveNext()) { yield return null; } onComplete(load1.result, load2.result); } internal static void LoadAssetsAsync(AsyncAsset load1, AsyncAsset load2, AsyncAsset load3, Action onComplete) where T1 : Object where T2 : Object where T3 : Object { ContentPacks.asyncLoadCoroutines.Add(LoadAssetsAsyncCoroutine(load1, load2, load3, onComplete)); } internal static IEnumerator LoadAssetsAsyncCoroutine(AsyncAsset load1, AsyncAsset load2, AsyncAsset load3, Action onComplete) where T1 : Object where T2 : Object where T3 : Object { while (!load1.coroutine.MoveNext()) { yield return null; } while (!load2.coroutine.MoveNext()) { yield return null; } while (!load3.coroutine.MoveNext()) { yield return null; } onComplete(load1.result, load2.result, load3.result); } internal static void LoadAssetsAsync(AsyncAsset load1, AsyncAsset load2, AsyncAsset load3, AsyncAsset load4, Action onComplete) where T1 : Object where T2 : Object where T3 : Object where T4 : Object { ContentPacks.asyncLoadCoroutines.Add(LoadAssetsAsyncCoroutine(load1, load2, load3, load4, onComplete)); } internal static IEnumerator LoadAssetsAsyncCoroutine(AsyncAsset load1, AsyncAsset load2, AsyncAsset load3, AsyncAsset load4, Action onComplete) where T1 : Object where T2 : Object where T3 : Object where T4 : Object { while (!load1.coroutine.MoveNext()) { yield return null; } while (!load2.coroutine.MoveNext()) { yield return null; } while (!load3.coroutine.MoveNext()) { yield return null; } while (!load4.coroutine.MoveNext()) { yield return null; } onComplete(load1.result, load2.result, load3.result, load4.result); } internal static IEnumerator LoadFromAddressableOrBundle(AssetBundle assetBundle, string bundlePath, string addressablePath, Action OnComplete) where T : Object { if (!string.IsNullOrEmpty(bundlePath)) { return assetBundle.LoadAssetCoroutine(bundlePath, OnComplete); } if (!string.IsNullOrEmpty(addressablePath)) { return LoadAssetCoroutine(addressablePath, OnComplete); } return null; } internal static IEnumerator PreLoadAssetsAsync(AssetBundle assetBundle, params string[] paths) where T : Object { List coroutines = PreLoadAssetsAsyncCoroutines(assetBundle, paths); for (int i = 0; i < coroutines.Count; i++) { while (coroutines[i].MoveNext()) { yield return null; } } } internal static List PreLoadAssetsAsyncCoroutines(AssetBundle assetBundle, params string[] paths) where T : Object { List list = new List(); for (int i = 0; i < paths.Length; i++) { list.Add(assetBundle.LoadAssetCoroutine(paths[i], null)); } return list; } internal static IEnumerator LoadBuffIconAsync(BuffDef buffDef, AssetBundle assetBundle, string bundleLoadPath) { return assetBundle.LoadAssetCoroutine(bundleLoadPath, (Action)delegate(Sprite result) { buffDef.iconSprite = result; }); } internal static IEnumerator LoadBuffIconAsync(BuffDef buffDef, string addressablePath) { return Asset.LoadAssetCoroutine((object)addressablePath, (Action)delegate(Sprite result) { buffDef.iconSprite = result; }); } public static void RecolorEffects(Color color, GameObject MercSwordSlash) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0031: 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_0055: Unknown result type (might be due to invalid IL or missing references) ParticleSystemRenderer[] componentsInChildren = MercSwordSlash.GetComponentsInChildren(); ParticleSystemRenderer[] array = componentsInChildren; foreach (ParticleSystemRenderer val in array) { ((Renderer)val).sharedMaterial = new Material(((Renderer)val).sharedMaterial); ((Renderer)val).sharedMaterial.SetColor("_MainColor", color); ((Renderer)val).sharedMaterial.SetColor("_Color", color); ((Renderer)val).sharedMaterial.SetColor("_TintColor", color); } } internal static GameObject DebugClone(this GameObject gameObject, bool network = false) { bool flag = false; return gameObject; } internal static GameObject CloneTracer(string originalTracerName, string newTracerName) { GameObject val = LegacyResourcesAPI.Load("Prefabs/Effects/Tracers/" + originalTracerName); if ((Object)(object)val == (Object)null) { return null; } GameObject val2 = PrefabAPI.InstantiateClone(val, newTracerName, true); if (!Object.op_Implicit((Object)(object)val2.GetComponent())) { val2.AddComponent(); } if (!Object.op_Implicit((Object)(object)val2.GetComponent())) { val2.AddComponent(); } if (!Object.op_Implicit((Object)(object)val2.GetComponent())) { val2.AddComponent(); } val2.GetComponent().speed = 250f; val2.GetComponent().length = 50f; Content.CreateAndAddEffectDef(val2); return val2; } internal static void ConvertAllRenderersToHopooShader(GameObject objectToConvert) { if (Object.op_Implicit((Object)(object)objectToConvert)) { MeshRenderer[] componentsInChildren = objectToConvert.GetComponentsInChildren(); foreach (MeshRenderer val in componentsInChildren) { ((Renderer)val).sharedMaterial?.ConvertDefaultShaderToHopoo(); } SkinnedMeshRenderer[] componentsInChildren2 = objectToConvert.GetComponentsInChildren(); foreach (SkinnedMeshRenderer val2 in componentsInChildren2) { ((Renderer)val2).sharedMaterial?.ConvertDefaultShaderToHopoo(); } } } internal static GameObject LoadCrosshair(string crosshairName) { GameObject val = LegacyResourcesAPI.Load("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("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) { GameObject val = assetBundle.LoadAsset(resourceName); if (!Object.op_Implicit((Object)(object)val)) { Log.ErrorAssetBundle(resourceName, ((Object)assetBundle).name); return null; } CreateEffectFromObject(val, soundName, parentToTransform); return val; } internal static void CreateEffectFromObject(GameObject newEffect, string soundName, bool parentToTransform) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) newEffect.AddComponent().duration = 6f; newEffect.AddComponent(); if (!Object.op_Implicit((Object)(object)newEffect.GetComponent())) { newEffect.AddComponent().vfxPriority = (VFXPriority)2; } EffectComponent component = newEffect.GetComponent(); if (!Object.op_Implicit((Object)(object)component)) { component = newEffect.AddComponent(); component.applyScale = true; component.effectIndex = (EffectIndex)(-1); component.parentToReferencedTransform = parentToTransform; component.positionAtReferencedTransform = true; component.soundName = soundName; } Content.CreateAndAddEffectDef(newEffect); } internal static GameObject CreateProjectileGhostPrefab(this AssetBundle assetBundle, string ghostName) { GameObject val = assetBundle.LoadAsset(ghostName); if ((Object)(object)val == (Object)null) { Log.Error("Failed to load ghost prefab " + ghostName); } if (!Object.op_Implicit((Object)(object)val.GetComponent())) { val.AddComponent(); } if (!Object.op_Implicit((Object)(object)val.GetComponent())) { val.AddComponent(); } ConvertAllRenderersToHopooShader(val); return val; } internal static GameObject CloneProjectilePrefab(string prefabName, string newPrefabName) { return PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load("Prefabs/Projectiles/" + prefabName), newPrefabName); } internal static GameObject LoadAndAddProjectilePrefab(this AssetBundle assetBundle, string newPrefabName) { GameObject val = assetBundle.LoadAsset(newPrefabName); if ((Object)(object)val == (Object)null) { Log.ErrorAssetBundle(newPrefabName, ((Object)assetBundle).name); return null; } Content.AddProjectilePrefab(val); return val; } } public class AsyncAsset where T : Object { public T result; public bool isDone; public IEnumerator coroutine; public Action onComplete; public static implicit operator T(AsyncAsset asset) { return asset.result; } public AsyncAsset(string path_, Action onComplete_ = null) { onComplete = onComplete_; coroutine = Asset.LoadAssetCoroutine(path_, OnCoroutineComplete); } public AsyncAsset(AssetBundle bundle_, string name_, Action onComplete_ = null) { onComplete = onComplete_; coroutine = bundle_.LoadAssetCoroutine(name_, OnCoroutineComplete); } public AsyncAsset AddCoroutine() { ContentPacks.asyncLoadCoroutines.Add(coroutine); return this; } public void OnCoroutineComplete(T loadResult) { result = loadResult; isDone = true; onComplete?.Invoke(result); } } internal static class CameraParams { internal static CharacterCameraParamsData CreateCameraParams(float pivotVerticalOffset, Vector3 idealPosition, float pitch = 70f, float wallCushion = 0.1f, float fov = 0f) { //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_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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_0033: 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_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) CharacterCameraParamsData result = new CharacterCameraParamsData { maxPitch = BlendableFloat.op_Implicit(pitch), minPitch = BlendableFloat.op_Implicit(0f - pitch), pivotVerticalOffset = BlendableFloat.op_Implicit(pivotVerticalOffset), idealLocalCameraPos = BlendableVector3.op_Implicit(idealPosition), wallCushion = BlendableFloat.op_Implicit(wallCushion) }; if (fov != 0f) { result.fov = new BlendableFloat { value = fov, alpha = 1f }; } return result; } internal static CameraParamsOverrideHandle OverrideCameraParams(CameraTargetParams camParams, CharacterCameraParamsData paramsData, float transitionDuration = 0.5f) { //IL_0003: 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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) CameraParamsOverrideRequest val = new CameraParamsOverrideRequest { cameraParamsData = paramsData, priority = 1f }; return camParams.AddParamsOverride(val, transitionDuration); } } public class ConfigEntry { } public class ConfigEntry : ConfigEntry { public ConfigEntry ActualConfigEntry; public T DefaultValue; public T Value { get { if (ActualConfigEntry != null) { return ActualConfigEntry.Value; } return DefaultValue; } } public static implicit operator T(ConfigEntry config) { return config.Value; } public ConfigEntry(T defaultValue) { ActualConfigEntry = null; DefaultValue = defaultValue; } public ConfigEntry(ConfigEntry actualConfigEntry, T defaultValue) { ActualConfigEntry = actualConfigEntry; DefaultValue = defaultValue; } } public static class Config { public static ConfigFile MyConfig = ((BaseUnityPlugin)GorpPlugin.instance).Config; private static List disabledSections = new List(); private static bool enableAllSections = false; private static bool loadedIcon; public static void DisableSection(string section) { disabledSections.Add(section); } private static bool SectionDisabled(string section) { return disabledSections.Contains(section); } public static void ConfigureBody(CharacterBody bodyComponent, string section, string bodyInfoTitle = "") { if (string.IsNullOrEmpty(bodyInfoTitle)) { bodyInfoTitle = ((Object)bodyComponent).name; } bodyComponent.baseMaxHealth = BindAndOptions(section, bodyInfoTitle + " Base Max Health", bodyComponent.baseMaxHealth, 0f, 10000f, "levelMaxHealth will be adjusted accordingly (baseMaxHealth * 0.3)", restartRequired: true).Value; bodyComponent.levelMaxHealth = Mathf.Round(bodyComponent.baseMaxHealth * 0.3f); bodyComponent.baseRegen = BindAndOptions(section, bodyInfoTitle + " Base Regen", bodyComponent.baseRegen, "levelRegen will be adjusted accordingly (baseRegen * 0.2)", restartRequired: true).Value; bodyComponent.levelRegen = bodyComponent.baseRegen * 0.2f; bodyComponent.baseArmor = BindAndOptions(section, bodyInfoTitle + " Armor", bodyComponent.baseArmor, "", restartRequired: true).Value; bodyComponent.baseDamage = BindAndOptions(section, bodyInfoTitle + " Base Damage", bodyComponent.baseDamage, "pretty much all survivors are 12. If you want to change damage, change damage of the moves instead.\nlevelDamage will be adjusted accordingly (baseDamage * 0.2)", restartRequired: true).Value; bodyComponent.levelDamage = bodyComponent.baseDamage * 0.2f; bodyComponent.baseMoveSpeed = BindAndOptions(section, bodyInfoTitle + " Base Move Speed", bodyComponent.baseMoveSpeed, "", restartRequired: true).Value; bodyComponent.baseJumpCount = BindAndOptions(section, bodyInfoTitle + " Jump Count", bodyComponent.baseJumpCount, "", restartRequired: true).Value; } public static void ConfigureSkillDef(SkillDef skillDef, string section, string skillTitle, bool cooldown = true, bool maxStock = true, bool rechargeStock = false) { if (cooldown) { skillDef.baseRechargeInterval = BindAndOptions(section, skillTitle + " cooldown", skillDef.baseRechargeInterval, 0f, 20f, "", restartRequired: true).Value; } if (maxStock) { skillDef.baseMaxStock = BindAndOptions(section, skillTitle + " stocks", skillDef.baseMaxStock, 0f, 100f, "", restartRequired: true).Value; } if (rechargeStock) { skillDef.rechargeStock = BindAndOptions(section, skillTitle + " recharge stocks", skillDef.baseMaxStock, 0f, 100f, "", restartRequired: true).Value; } } public static ConfigEntry 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 BindAndOptionsSlider(string section, string name, T defaultValue, float min = 0f, float max = 20f, string description = "", bool restartRequired = false) { return BindAndOptions(section, name, defaultValue, min, max, description, restartRequired); } public static ConfigEntry BindAndOptions(string section, string name, T defaultValue, string description = "", bool restartRequired = false) { return BindAndOptions(section, name, defaultValue, 0f, 20f, description, restartRequired); } public static ConfigEntry BindAndOptions(string section, string name, T defaultValue, float min, float max, string description = "", bool restartRequired = false) { if (string.IsNullOrEmpty(description)) { description = name; } description += $"\nDefault: {defaultValue}"; if (restartRequired) { description += "\n(restart required)"; } if (!enableAllSections && SectionDisabled(section)) { return new ConfigEntry(null, defaultValue); } ConfigEntry val = MyConfig.Bind(section, name, defaultValue, description); if (Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions")) { TryRegisterOption(val, min, max, restartRequired); } return new ConfigEntry(val, defaultValue); } public static ConfigEntry BindAndOptions(string section, string name, ValueType defaultValue, float min, float max, string description = "", bool restartRequired = false) { //IL_0089: Unknown result type (might be due to invalid IL or missing references) if (defaultValue is float) { return BindAndOptions(section, name, (float)(object)defaultValue, min, max, description, restartRequired); } if (defaultValue is int) { return BindAndOptions(section, name, (int)(object)defaultValue, min, max, description, restartRequired); } if (defaultValue is bool) { return BindAndOptions(section, name, (bool)(object)defaultValue, min, max, description, restartRequired); } if (defaultValue is KeyboardShortcut) { return BindAndOptions(section, name, (KeyboardShortcut)(object)defaultValue, min, max, description, restartRequired); } if (defaultValue == null) { Log.Error($"defaultvalue was null somehow for {section}:{name} {defaultValue}"); } Log.Error($"Configuring a field with unsupported type {defaultValue.GetType()} for {section}:{name}"); return null; } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static void TryRegisterOption(ConfigEntry entry, float min, float max, bool restartRequired) { //IL_0015: 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) //IL_0021: 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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0067: 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_007b: Expected O, but got Unknown //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected O, but got Unknown //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Expected O, but got Unknown if (entry is ConfigEntry) { ModSettingsManager.AddOption((BaseOption)new SliderOption(entry as ConfigEntry, new SliderConfig { min = min, max = max, formatString = "{0:0.00}", restartRequired = restartRequired })); } if (entry is ConfigEntry) { ModSettingsManager.AddOption((BaseOption)new IntSliderOption(entry as ConfigEntry, new IntSliderConfig { min = (int)min, max = (int)max, restartRequired = restartRequired })); } if (entry is ConfigEntry) { ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(entry as ConfigEntry, restartRequired)); } if (entry is ConfigEntry) { ModSettingsManager.AddOption((BaseOption)new KeyBindOption(entry as ConfigEntry, restartRequired)); } if (!loadedIcon) { loadedIcon = true; try { ModSettingsManager.SetModIcon(ImgHandler.LoadSpriteFromModFolder("icon.png")); } catch (Exception ex) { Log.Error("error adding ROO mod icon\n" + ex); } } } public static void InitConfigAttributes(Type typeWithStaticConfigFieldsMakeSureTheyreStatic) { FieldInfo[] fields = typeWithStaticConfigFieldsMakeSureTheyreStatic.GetFields(); FieldInfo[] array = fields; foreach (FieldInfo fieldInfo in array) { ConfigureAttribute customAttribute = fieldInfo.GetCustomAttribute(); if (customAttribute != null) { customAttribute.InitFromField(fieldInfo); try { fieldInfo.SetValue(null, BindAndOptions(customAttribute.section, customAttribute.name, customAttribute.defaultValue, customAttribute.min, customAttribute.max, customAttribute.description, customAttribute.restartRequired)); } catch { throw new Exception("Error adding config " + customAttribute.section + ": " + customAttribute.name + "."); } } } } 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); } } [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] public class ConfigureAttribute : Attribute { public string name; public string description; public float min = 0f; public float max = 20f; public bool restartRequired = false; public string section { get; private set; } public ValueType defaultValue { get; private set; } public ConfigureAttribute(string section, float defaultValue) { this.section = section; this.defaultValue = defaultValue; } public ConfigureAttribute(string section, int defaultValue) { this.section = section; this.defaultValue = defaultValue; } public ConfigureAttribute(string section, bool defaultValue) { this.section = section; this.defaultValue = defaultValue; } public ConfigureAttribute(string section, KeyboardShortcut defaultValue) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) this.section = section; this.defaultValue = (ValueType)(object)defaultValue; } public void InitFromField(FieldInfo fieldInfo) { if (string.IsNullOrEmpty(name)) { name = fieldInfo.Name; } if (string.IsNullOrEmpty(description)) { description = name; } } } internal class Content { internal static void AddEntityStateConfiguration(EntityStateConfiguration entityStateConfiguration) { ContentPacks.entityStateConfigurations.Add(entityStateConfiguration); } 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 NetworkAndAddProjectilePrefab(GameObject prefab) { PrefabAPI.RegisterNetworkPrefab(prefab); AddProjectilePrefab(prefab); } internal static void AddSurvivorDef(SurvivorDef survivorDef) { ContentPacks.survivorDefs.Add(survivorDef); } 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(); 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(); val.cachedName = identifier; val.nameToken = nameToken; val.achievementIcon = achievementIcon; AddUnlockableDef(val); return val; } internal static void AddNetworkedObject(GameObject gameObject) { ContentPacks.networkedObjects.Add(gameObject); } 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, bool isHidden) { //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(); ((Object)val).name = buffName; val.buffColor = buffColor; val.canStack = canStack; val.isDebuff = isDebuff; val.eliteDef = null; val.iconSprite = buffIcon; val.isHidden = isHidden; AddBuffDef(val); return val; } internal static void AddItemDef(ItemDef itemDef) { ContentPacks.itemDefs.Add(itemDef); } internal static ItemDef CreateAndAddItemDef(string itemName, Sprite iconSprite, ItemTier itemTier, bool hidden = false, bool canRemove = false) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) return CreateAndAddItemDef("HABIBI" + itemName + "Item", itemName, iconSprite, itemTier, hidden, canRemove); } internal static ItemDef CreateAndAddItemDef(string itemname, string token, Sprite iconSprite, ItemTier itemTier, bool hidden = false, bool canRemove = false) { //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) ItemDef val = ScriptableObject.CreateInstance(); ((Object)val).name = itemname; val.nameToken = "HABIBIITEM_" + token.ToUpperInvariant() + "_NAME"; val.descriptionToken = "HABIBIITEM_" + token.ToUpperInvariant() + "_DESCRIPTION"; val.pickupToken = "HABIBIITEM_" + token.ToUpperInvariant() + "_PICKUP"; val.loreToken = "HABIBIITEM_" + token.ToUpperInvariant() + "_LORE"; val.canRemove = canRemove; val.pickupIconSprite = iconSprite; val.hidden = hidden; val.tier = itemTier; val.deprecatedTier = itemTier; AddItemDef(val); return val; } internal static void AddEffectDef(EffectDef effectDef) { ContentPacks.effectDefs.Add(effectDef); } internal static EffectDef CreateAndAddEffectDef(GameObject effectPrefab, bool donotPool = false) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown if (donotPool) { VFXAttributes orAddComponent = effectPrefab.GetOrAddComponent(); orAddComponent.DoNotPool = true; } 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(); val.akId = AkSoundEngine.GetIDFromString(eventName); val.eventName = eventName; AddNetworkSoundEventDef(val); return val; } } internal class ContentPacks : IContentPackProvider { internal ContentPack contentPack = new ContentPack(); public static List bodyPrefabs = new List(); public static List masterPrefabs = new List(); public static List projectilePrefabs = new List(); public static List survivorDefs = new List(); public static List unlockableDefs = new List(); public static List skillFamilies = new List(); public static List skillDefs = new List(); public static List entityStates = new List(); public static List entityStateConfigurations = new List(); public static List buffDefs = new List(); public static List effectDefs = new List(); public static List itemDefs = new List(); public static List networkSoundEventDefs = new List(); public static List networkedObjects = new List(); public static List asyncLoadCoroutines = new List(); public string identifier => "com.TheTimesweeper.Gorp"; 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; Log.CurrentTime("LoadStaticContentAsync start"); for (int i = 0; i < asyncLoadCoroutines.Count; i++) { while (asyncLoadCoroutines[i].MoveNext()) { yield return null; } } Log.CurrentTime("LoadStaticContentAsync done"); contentPack.bodyPrefabs.Add(bodyPrefabs.ToArray()); contentPack.masterPrefabs.Add(masterPrefabs.ToArray()); contentPack.projectilePrefabs.Add(projectilePrefabs.ToArray()); contentPack.survivorDefs.Add(survivorDefs.ToArray()); contentPack.unlockableDefs.Add(unlockableDefs.ToArray()); contentPack.skillDefs.Add(skillDefs.ToArray()); contentPack.skillFamilies.Add(skillFamilies.ToArray()); contentPack.entityStateTypes.Add(entityStates.ToArray()); contentPack.entityStateConfigurations.Add(entityStateConfigurations.ToArray()); contentPack.buffDefs.Add(buffDefs.ToArray()); contentPack.effectDefs.Add(effectDefs.ToArray()); contentPack.itemDefs.Add(itemDefs.ToArray()); contentPack.networkSoundEventDefs.Add(networkSoundEventDefs.ToArray()); contentPack.networkedObjectPrefabs.Add(networkedObjects.ToArray()); args.ReportProgress(1f); } 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 ImgHandler { public static Sprite LoadSprite(string path, string name) { Texture2D texture2D = LoadTex2D(path, pointFilter: true); return CreateSprite(texture2D, name); } public static Texture2D LoadTex2D(string fullFilePath, bool pointFilter = false) { Texture2D val = LoadPNG(fullFilePath, pointFilter); if (pointFilter) { ((Texture)val).filterMode = (FilterMode)0; val.Apply(); } return val; } private static Sprite CreateSprite(Texture2D texture2D, string name) { //IL_0038: 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) ((Object)texture2D).name = name; ((Texture)texture2D).filterMode = (FilterMode)0; texture2D.Apply(); Rect val = default(Rect); ((Rect)(ref val))..ctor(0f, 0f, (float)((Texture)texture2D).width, (float)((Texture)texture2D).height); Sprite val2 = Sprite.Create(texture2D, val, new Vector2(0.5f, 0.5f), 16f); ((Object)val2).name = name; return val2; } public static Texture2D LoadPNG(params string[] pathDirectories) { string text = pathDirectories[0]; for (int i = 1; i < pathDirectories.Length; i++) { text = Path.Combine(text, pathDirectories[i]); } return LoadPNG(text); } public static Texture2D LoadPNG(string filePath, bool pointFilter = false) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown Texture2D val = new Texture2D(2, 2); byte[] array = File.ReadAllBytes(filePath); ImageConversion.LoadImage(val, array); ((Texture)val).filterMode = (FilterMode)(!pointFilter); val.Apply(); return val; } internal static Sprite LoadSpriteFromModFolder(string fileName) { Texture2D texture2D = LoadTex2DFromPModFolder(fileName); return CreateSprite(texture2D, fileName); } internal static Texture2D LoadTex2DFromPModFolder(string fileName, bool pointFilter = false) { string fullFilePath = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)GorpPlugin.instance).Info.Location), fileName); return LoadTex2D(fullFilePath, pointFilter); } } internal static class ItemDisplayCheck { public static List allDisplayedItems; public static void PrintUnused(ItemDisplayRuleSet itemDisplayRuleSet, string bodyName = "") { PrintUnused((IEnumerable)itemDisplayRuleSet.keyAssetRuleGroups.ToList(), bodyName); } public static void PrintUnused(IEnumerable ruleSet = null, string bodyName = "") { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) string text = "generating item displays for " + bodyName; if (allDisplayedItems == null) { LazyGatherAllItems(); } List list = new List(allDisplayedItems); string text2 = ""; if (ruleSet != null) { foreach (KeyAssetRuleGroup item in ruleSet) { if (item.displayRuleGroup.rules.Length != 0) { list.Remove(item.keyAsset); if (string.IsNullOrEmpty(text2)) { text2 = item.displayRuleGroup.rules[0].childName; } } } } if (string.IsNullOrEmpty(text2)) { text2 = "Chest"; } foreach (Object item2 in list) { string text3 = ""; if (ItemDisplays.KeyAssetDisplayRules.ContainsKey(item2)) { text3 += SpitOutNewRule(item2, text2, ItemDisplays.KeyAssetDisplayRules[item2]); } else { Log.Error($"COULD NOT FIND DISPLAY PREFABS FOR KEYASSET {item2}"); } text += text3; } Log.Message(text); } private static void LazyGatherAllItems() { allDisplayedItems = new List(ItemDisplays.KeyAssetDisplayRules.Keys); allDisplayedItems.Sort(delegate(Object item1, Object item2) { if (item1 is ItemDef && item2 is ItemDef) { return item1.name.CompareTo(item2.name); } if (item1 is EquipmentDef && item2 is EquipmentDef) { return item1.name.CompareTo(item2.name); } if (item1 is ItemDef && item2 is EquipmentDef) { return -1; } return (item1 is EquipmentDef && item2 is ItemDef) ? 1 : 0; }); } private static string SpitOutNewRule(Object asset, string firstCompatibleChild, ItemDisplayRule[] displayRules) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Invalid comparison between Unknown and I4 //IL_00a5: Unknown result type (might be due to invalid IL or missing references) if (displayRules.Length == 0) { return $"\n[NO DISPLAY RULES FOUND FOR THE KEYASSET {asset}"; } string text = "\n itemDisplayRules.Add(ItemDisplays.CreateDisplayRuleGroupWithRules(ItemDisplays.GetKeyAsset(\"" + asset.name + "\")"; for (int i = 0; i < displayRules.Length; i++) { text = (((int)displayRules[i].limbMask != 0) ? (text + ",\n" + $" ItemDisplays.CreateLimbMaskDisplayRule(LimbFlags.{displayRules[i].limbMask})") : (text + ",\n ItemDisplays.CreateDisplayRule(ItemDisplays.LoadDisplay(\"" + ((Object)displayRules[i].followerPrefab).name + "\"),\n \"" + firstCompatibleChild + "\",\n new Vector3(2, 2, 2),\n new Vector3(0, 0, 0),\n new Vector3(1, 1, 1)\n )")); } return text + "\n ));"; } } internal static class ItemDisplays { private static Dictionary itemDisplayPrefabs = new Dictionary(); public static Dictionary KeyAssetDisplayRules = new Dictionary(); public static Dictionary KeyAssets = new Dictionary(); public static bool initialized = false; public static bool initializing = false; public static event Action OnDisplaysPopulated; public static void SetItemDisplaysWhenReady(Action onComplete) { if (initialized) { onComplete?.Invoke(); return; } OnDisplaysPopulated += onComplete; if (!initializing) { initializing = true; ContentPacks.asyncLoadCoroutines.Add(PopulateDisplays()); RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(DisposeWhenDone)); } } internal static void DisposeWhenDone() { initialized = false; initializing = false; itemDisplayPrefabs = null; KeyAssetDisplayRules = null; KeyAssets = null; } internal static Object GetKeyAsset(string key) { if (KeyAssets.ContainsKey(key)) { return KeyAssets[key]; } Log.Warning("shit not found for " + key); return null; } internal static IEnumerator PopulateDisplays() { IEnumerator loadIDRS = Asset.LoadAssetCoroutine((object)"RoR2/Base/Loader/LoaderBody.prefab", (Action)delegate(GameObject result) { PopulateFromBody(result); }); while (loadIDRS.MoveNext()) { yield return null; } PopulateCustomLightningArm(); initialized = true; ItemDisplays.OnDisplaysPopulated?.Invoke(); } private static void PopulateFromBody(GameObject bodyPrefab) { ItemDisplayRuleSet itemDisplayRuleSet = ((Component)bodyPrefab.GetComponent().modelTransform).GetComponent().itemDisplayRuleSet; KeyAssetRuleGroup[] keyAssetRuleGroups = itemDisplayRuleSet.keyAssetRuleGroups; for (int i = 0; i < keyAssetRuleGroups.Length; i++) { ItemDisplayRule[] rules = keyAssetRuleGroups[i].displayRuleGroup.rules; KeyAssetDisplayRules[keyAssetRuleGroups[i].keyAsset] = rules; KeyAssets[keyAssetRuleGroups[i].keyAsset.name] = keyAssetRuleGroups[i].keyAsset; for (int j = 0; j < rules.Length; j++) { GameObject followerPrefab = rules[j].followerPrefab; if (Object.op_Implicit((Object)(object)followerPrefab)) { string key = ((Object)followerPrefab).name?.ToLowerInvariant(); if (!itemDisplayPrefabs.ContainsKey(key)) { itemDisplayPrefabs[key] = followerPrefab; } } } } } private static void PopulateCustomLightningArm() { GameObject val = PrefabAPI.InstantiateClone(itemDisplayPrefabs["displaylightningarmright"], "DisplayLightningCustom", false); LimbMatcher component = val.GetComponent(); component.limbPairs[0].targetChildLimb = "LightningArm1"; component.limbPairs[1].targetChildLimb = "LightningArm2"; component.limbPairs[2].targetChildLimb = "LightningArmEnd"; itemDisplayPrefabs["displaylightningarmcustom"] = val; } public static GameObject LoadDisplay(string name) { if (itemDisplayPrefabs.ContainsKey(name.ToLowerInvariant()) && Object.op_Implicit((Object)(object)itemDisplayPrefabs[name.ToLowerInvariant()])) { return itemDisplayPrefabs[name.ToLowerInvariant()]; } Log.Error("item display " + name + " returned null"); return null; } public static KeyAssetRuleGroup CreateGenericDisplayRule(Object itemDef, string prefabName, string childName, Vector3 position, Vector3 rotation, Vector3 scale) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) return CreateDisplayRuleGroupWithRules(itemDef, CreateDisplayRule(prefabName, childName, position, rotation, scale)); } public static KeyAssetRuleGroup CreateGenericDisplayRule(Object itemDef, GameObject prefab, string childName, Vector3 position, Vector3 rotation, Vector3 scale) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) return CreateDisplayRuleGroupWithRules(itemDef, CreateDisplayRule(prefab, childName, position, rotation, scale)); } public static KeyAssetRuleGroup CreateDisplayRuleGroupWithRules(string itemName, params ItemDisplayRule[] rules) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) return CreateDisplayRuleGroupWithRules(GetKeyAssetFromString(itemName), rules); } public static KeyAssetRuleGroup CreateDisplayRuleGroupWithRules(Object keyAsset_, params ItemDisplayRule[] rules) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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) //IL_0043: Unknown result type (might be due to invalid IL or missing references) if (keyAsset_ == (Object)null) { Log.Error("could not find keyasset"); } return new KeyAssetRuleGroup { keyAsset = keyAsset_, displayRuleGroup = new DisplayRuleGroup { rules = rules } }; } public static ItemDisplayRule CreateDisplayRule(string prefabName, string childName, Vector3 position, Vector3 rotation, Vector3 scale) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) return CreateDisplayRule(LoadDisplay(prefabName), childName, position, rotation, scale); } public static ItemDisplayRule CreateDisplayRule(GameObject itemPrefab, string childName, Vector3 position, Vector3 rotation, Vector3 scale) { //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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) return new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, childName = childName, followerPrefab = itemPrefab, limbMask = (LimbFlags)0, localPos = position, localAngles = rotation, localScale = scale }; } public static ItemDisplayRule CreateLimbMaskDisplayRule(LimbFlags limb) { //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_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_002d: 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_0031: Unknown result type (might be due to invalid IL or missing references) return new ItemDisplayRule { ruleType = (ItemDisplayRuleType)1, limbMask = limb, childName = "", followerPrefab = null }; } private static Object GetKeyAssetFromString(string itemName) { Object val = KeyAssets[itemName]; if (val == (Object)null) { Log.Error("Could not load keyasset for " + itemName); } return val; } } internal static class LanguageAPI { public static void Add(string token, string text) { Language.Add(token, text); } } internal static class Language { public static string TokensOutput = ""; public static bool printingEnabled = false; public static void Init() { Language.collectLanguageRootFolders += Language_collectLanguageRootFolders; } private static void Language_collectLanguageRootFolders(List obj) { string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)GorpPlugin.instance).Info.Location), "Language"); if (Directory.Exists(text)) { obj.Add(text); } } public static void Add(string token, string text) { LanguageAPI.Add(token, text, "en"); if (printingEnabled) { TokensOutput = TokensOutput + "\n \"" + token + "\" : \"" + text.Replace(Environment.NewLine, "\\n").Replace("\n", "\\n") + "\","; } } 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)GorpPlugin.instance).Info.Location).FullName, "Language", "english", fileName); File.WriteAllText(path, text); } TokensOutput = ""; } } } internal static class Materials { private static List cachedMaterials = new List(); internal static Shader _hotpoo; internal static Shader hotpoo { get { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_hotpoo == (Object)null) { Log.Warning("Hotpoo was null. doing the big scary waitforcompletion"); _hotpoo = Addressables.LoadAssetAsync((object)"RoR2/Base/Shaders/HGStandard.shader").WaitForCompletion(); } return _hotpoo; } set { _hotpoo = value; } } public static void Init() { ContentPacks.asyncLoadCoroutines.Add(Asset.LoadAssetCoroutine((object)"RoR2/Base/Shaders/HGStandard.shader", (Action)delegate(Shader result) { hotpoo = result; })); } [Obsolete("CreateHopooMaterialFromBundle is a bit more descriptive")] 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(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_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_015c: 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; } string text = ((Object)tempMat.shader).name.ToLowerInvariant(); if (!text.StartsWith("standard") && !text.StartsWith("autodesk")) { Log.Debug(((Object)tempMat).name + " is not unity standard shader. aborting material conversion"); 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) { material.SetFloat("_EmPower", emission); return material; } 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 Prefabs { private static PhysicMaterial ragdollMaterial; public static IEnumerator CreateDisplayPrefabAsync(AssetBundle assetBundle, string displayPrefabName, GameObject characterModelObject, Action OnComplete) { return assetBundle.LoadAssetCoroutine(displayPrefabName, (Action)delegate(GameObject display) { if ((Object)(object)display == (Object)null) { Log.Error("could not load display prefab " + displayPrefabName + ". Make sure this prefab exists in assetbundle " + ((Object)assetBundle).name); OnComplete(null); } else { CharacterModel val = display.GetComponent(); if (!Object.op_Implicit((Object)(object)val)) { val = display.AddComponent(); } val.baseRendererInfos = characterModelObject.GetComponent().baseRendererInfos; Asset.ConvertAllRenderersToHopooShader(display); OnComplete(display); } }); } public static GameObject CreateDisplayPrefab(AssetBundle assetBundle, string displayPrefabName, GameObject bodyPrefab) { GameObject val = assetBundle.LoadAsset(displayPrefabName); if ((Object)(object)val == (Object)null) { Log.Error("could not load display prefab " + displayPrefabName + ". Make sure this prefab exists in assetbundle " + ((Object)assetBundle).name); return null; } CharacterModel val2 = val.GetComponent(); if (!Object.op_Implicit((Object)(object)val2)) { val2 = val.AddComponent(); } val2.baseRendererInfos = bodyPrefab.GetComponentInChildren().baseRendererInfos; Asset.ConvertAllRenderersToHopooShader(val); return val; } internal static IEnumerator LoadCharacterModelAsync(AssetBundle assetBundle, string modelName, Action onComplete) { return assetBundle.LoadAssetCoroutine(modelName, onComplete); } internal static IEnumerator CloneCharacterBodyAsync(GameObject modelObject, BodyInfo bodyInfo, Action onComplete) { return Asset.LoadAssetCoroutine((object)bodyInfo.bodyToClonePath, (Action)delegate(GameObject loadedBody) { if (!Object.op_Implicit((Object)(object)loadedBody)) { Log.Error(bodyInfo.bodyToClonePath + " Body to clone is not a valid body, character creation failed"); } else { GameObject val = PrefabAPI.InstantiateClone(loadedBody, bodyInfo.bodyName); for (int num = val.transform.childCount - 1; num >= 0; num--) { Object.DestroyImmediate((Object)(object)((Component)val.transform.GetChild(num)).gameObject); } CreateBodyPrefab(val, modelObject, bodyInfo); onComplete?.Invoke(val); } }); } public static GameObject LoadCharacterModel(AssetBundle assetBundle, string modelName) { GameObject val = assetBundle.LoadAsset(modelName); if ((Object)(object)val == (Object)null) { Log.Error("could not load model prefab " + modelName + ". Make sure this prefab exists in assetbundle " + ((Object)assetBundle).name); return null; } return PrefabAPI.InstantiateClone(val, modelName, false); } public static GameObject LoadCharacterBody(AssetBundle assetBundle, string bodyName) { GameObject val = assetBundle.LoadAsset(bodyName); if ((Object)(object)val == (Object)null) { Log.Error("could not load body prefab " + bodyName + ". Make sure this prefab exists in assetbundle " + ((Object)assetBundle).name); return null; } return val; } public static GameObject CloneCharacterBody(BodyInfo bodyInfo) { GameObject val = LegacyResourcesAPI.Load("Prefabs/CharacterBodies/" + bodyInfo.bodynameToClone + "Body"); if (!Object.op_Implicit((Object)(object)val)) { Log.Error(bodyInfo.bodynameToClone + " Body to clone is not a valid body, character creation failed"); return null; } GameObject val2 = PrefabAPI.InstantiateClone(val, bodyInfo.bodyName); for (int num = val2.transform.childCount - 1; num >= 0; num--) { Object.DestroyImmediate((Object)(object)((Component)val2.transform.GetChild(num)).gameObject); } return val2; } public static GameObject CreateBodyPrefab(AssetBundle assetBundle, string modelPrefabName, BodyInfo bodyInfo) { return CreateBodyPrefab(LoadCharacterModel(assetBundle, modelPrefabName), bodyInfo); } public static GameObject CreateBodyPrefab(GameObject model, BodyInfo bodyInfo) { return CreateBodyPrefab(CloneCharacterBody(bodyInfo), model, bodyInfo); } public static GameObject CreateBodyPrefab(GameObject newBodyPrefab, AssetBundle assetBundle, string modelName, BodyInfo bodyInfo) { return CreateBodyPrefab(newBodyPrefab, LoadCharacterModel(assetBundle, modelName), bodyInfo); } public static GameObject CreateBodyPrefab(AssetBundle assetBundle, string bodyPrefabName, string modelPrefabName, BodyInfo bodyInfo) { return CreateBodyPrefab(LoadCharacterBody(assetBundle, bodyPrefabName), LoadCharacterModel(assetBundle, modelPrefabName), bodyInfo); } public static GameObject CreateBodyPrefab(GameObject newBodyPrefab, GameObject model, BodyInfo bodyInfo) { if ((Object)(object)model == (Object)null || (Object)(object)newBodyPrefab == (Object)null) { Log.Error($"Character creation failed. Model: {model}, Body: {newBodyPrefab}"); return null; } SetupCharacterBody(newBodyPrefab, bodyInfo); Transform modelBaseTransform = AddCharacterModelToSurvivorBody(newBodyPrefab, model.transform, bodyInfo); SetupModelLocator(newBodyPrefab, modelBaseTransform, model.transform); SetupCharacterDirection(newBodyPrefab, modelBaseTransform, model.transform); SetupCameraTargetParams(newBodyPrefab, bodyInfo); SetupCapsuleCollider(newBodyPrefab); Skills.ClearGenericSkills(newBodyPrefab); Content.AddCharacterBodyPrefab(newBodyPrefab); return newBodyPrefab; } private static void SetupCharacterBody(GameObject newBodyPrefab, BodyInfo bodyInfo) { //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_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) CharacterBody component = newBodyPrefab.GetComponent(); component.baseNameToken = bodyInfo.bodyNameToken; component.subtitleNameToken = bodyInfo.subtitleNameToken; component.portraitIcon = bodyInfo.characterPortrait; component.bodyColor = bodyInfo.bodyColor; component._defaultCrosshairPrefab = bodyInfo.crosshair; component.hideCrosshair = false; component.preferredPodPrefab = bodyInfo.podPrefab; component.baseMaxHealth = bodyInfo.maxHealth; component.baseRegen = bodyInfo.healthRegen; component.baseArmor = bodyInfo.armor; component.baseMaxShield = bodyInfo.shield; component.baseDamage = bodyInfo.damage; component.baseAttackSpeed = bodyInfo.attackSpeed; component.baseCrit = bodyInfo.crit; component.baseMoveSpeed = bodyInfo.moveSpeed; component.baseJumpPower = bodyInfo.jumpPower; component.autoCalculateLevelStats = bodyInfo.autoCalculateLevelStats; if (bodyInfo.autoCalculateLevelStats) { component.levelMaxHealth = Mathf.Round(component.baseMaxHealth * 0.3f); component.levelMaxShield = Mathf.Round(component.baseMaxShield * 0.3f); component.levelRegen = component.baseRegen * 0.2f; component.levelMoveSpeed = 0f; component.levelJumpPower = 0f; component.levelDamage = component.baseDamage * 0.2f; component.levelAttackSpeed = 0f; component.levelCrit = 0f; component.levelArmor = 0f; } else { component.levelMaxHealth = bodyInfo.healthGrowth; component.levelMaxShield = bodyInfo.shieldGrowth; component.levelRegen = bodyInfo.regenGrowth; component.levelMoveSpeed = bodyInfo.moveSpeedGrowth; component.levelJumpPower = bodyInfo.jumpPowerGrowth; component.levelDamage = bodyInfo.damageGrowth; component.levelAttackSpeed = bodyInfo.attackSpeedGrowth; component.levelCrit = bodyInfo.critGrowth; component.levelArmor = bodyInfo.armorGrowth; } component.baseAcceleration = bodyInfo.acceleration; component.baseJumpCount = bodyInfo.jumpCount; component.bodyFlags = bodyInfo.bodyFlags; component.sprintingSpeedMultiplier = 1.45f; component.rootMotionInMainState = false; component.hullClassification = (HullClassification)0; component.isChampion = false; } private static Transform AddCharacterModelToSurvivorBody(GameObject bodyPrefab, Transform modelTransform, BodyInfo bodyInfo) { //IL_0063: 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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) Transform val = bodyPrefab.transform.Find("ModelBase"); if ((Object)(object)val == (Object)null) { val = new GameObject("ModelBase").transform; val.parent = bodyPrefab.transform; val.localPosition = bodyInfo.modelBasePosition; val.localRotation = Quaternion.identity; } modelTransform.parent = ((Component)val).transform; modelTransform.localPosition = Vector3.zero; modelTransform.localRotation = Quaternion.identity; Transform val2 = bodyPrefab.transform.Find("CameraPivot"); if ((Object)(object)val2 == (Object)null) { val2 = new GameObject("CameraPivot").transform; val2.parent = bodyPrefab.transform; val2.localPosition = bodyInfo.cameraPivotPosition; val2.localRotation = Quaternion.identity; } Transform val3 = bodyPrefab.transform.Find("AimOrigin"); if ((Object)(object)val3 == (Object)null) { val3 = new GameObject("AimOrigin").transform; val3.parent = bodyPrefab.transform; val3.localPosition = bodyInfo.aimOriginPosition; val3.localRotation = Quaternion.identity; } bodyPrefab.GetComponent().aimOriginTransform = val3; return ((Component)val).transform; } private static void SetupCharacterDirection(GameObject prefab, Transform modelBaseTransform, Transform modelTransform) { if (Object.op_Implicit((Object)(object)prefab.GetComponent())) { CharacterDirection component = prefab.GetComponent(); component.targetTransform = modelBaseTransform; component.overrideAnimatorForwardTransform = null; component.rootMotionAccumulator = null; component.modelAnimator = ((Component)modelTransform).GetComponent(); component.driveFromRootRotation = false; component.turnSpeed = 720f; } } private static void SetupCameraTargetParams(GameObject prefab, BodyInfo bodyInfo) { CameraTargetParams component = prefab.GetComponent(); component.cameraParams = bodyInfo.cameraParams; component.cameraPivotTransform = prefab.transform.Find("CameraPivot"); } private static void SetupModelLocator(GameObject prefab, Transform modelBaseTransform, Transform modelTransform) { ModelLocator component = prefab.GetComponent(); component.modelTransform = modelTransform; component.modelBaseTransform = modelBaseTransform; } private static void SetupCapsuleCollider(GameObject prefab) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) CapsuleCollider component = prefab.GetComponent(); component.center = new Vector3(0f, 0f, 0f); component.radius = 0.5f; component.height = 1.82f; component.direction = 1; } public static CharacterModel SetupCharacterModel(GameObject bodyPrefab_, BodyInfo bodyInfo_, CustomRendererInfo[] customInfos_ = null) { CharacterModel val = ((Component)bodyPrefab_.GetComponent().modelTransform).gameObject.GetComponent(); bool flag = (Object)(object)val != (Object)null; if (!flag) { val = ((Component)bodyPrefab_.GetComponent().modelTransform).gameObject.AddComponent(); } val.body = bodyPrefab_.GetComponent(); if (!flag) { SetupCustomRendererInfos(val, customInfos_); } else { SetupPreAttachedRendererInfos(val); } SetupHurtboxGroup(bodyPrefab_, ((Component)val).gameObject); if (bodyInfo_.hasAimAnimator) { SetupAimAnimator(bodyPrefab_, ((Component)val).gameObject); } if (bodyInfo_.hasFoostepController) { SetupFootstepController(((Component)val).gameObject); } if (bodyInfo_.hasRagdoll) { SetupRagdoll(((Component)val).gameObject); } if (bodyInfo_.hasSkinController) { SetupSkinController(((Component)val).gameObject); } return val; } public static void SetupPreAttachedRendererInfos(CharacterModel characterModel) { for (int i = 0; i < characterModel.baseRendererInfos.Length; i++) { if ((Object)(object)characterModel.baseRendererInfos[i].defaultMaterial == (Object)null) { characterModel.baseRendererInfos[i].defaultMaterial = characterModel.baseRendererInfos[i].renderer.sharedMaterial; } if ((Object)(object)characterModel.baseRendererInfos[i].defaultMaterial == (Object)null) { Log.Error($"no material for rendererinfo of this renderer: {characterModel.baseRendererInfos[i].renderer}"); } else { characterModel.baseRendererInfos[i].defaultMaterial.ConvertDefaultShaderToHopoo(); } } } public static void SetupCustomRendererInfos(CharacterModel characterModel, CustomRendererInfo[] customInfos) { //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) ChildLocator component = ((Component)characterModel).GetComponent(); if (!Object.op_Implicit((Object)(object)component)) { Log.Error("Failed CharacterModel setup: ChildLocator component does not exist on the model"); return; } List list = new List(); for (int i = 0; i < customInfos.Length; i++) { if (!Object.op_Implicit((Object)(object)component.FindChild(customInfos[i].childName))) { Log.Error("Trying to add a RendererInfo for a renderer that does not exist: " + customInfos[i].childName); continue; } Renderer component2 = ((Component)component.FindChild(customInfos[i].childName)).GetComponent(); if (Object.op_Implicit((Object)(object)component2)) { Material val = customInfos[i].material; if ((Object)(object)val == (Object)null) { val = ((!customInfos[i].dontHotpoo) ? component2.sharedMaterial.ConvertDefaultShaderToHopoo() : component2.sharedMaterial); } list.Add(new RendererInfo { renderer = component2, defaultMaterial = val, ignoreOverlays = customInfos[i].ignoreOverlays, defaultShadowCastingMode = (ShadowCastingMode)1 }); } } characterModel.baseRendererInfos = list.ToArray(); } private static void SetupHurtboxGroup(GameObject bodyPrefab, GameObject model) { SetupMainHurtboxesFromChildLocator(bodyPrefab, model); SetHurtboxesHealthComponents(bodyPrefab); } private static void SetupMainHurtboxesFromChildLocator(GameObject bodyPrefab, GameObject model) { //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)bodyPrefab.GetComponent() != (Object)null) { Log.Debug("HurtBoxGroup already exists on model prefab. aborting code setup"); return; } ChildLocator component = model.GetComponent(); if (!Object.op_Implicit((Object)(object)component.FindChild("MainHurtbox"))) { Log.Error("Could not set up main hurtbox: make sure you have a transform pair in your prefab's ChildLocator called 'MainHurtbox'"); return; } HurtBoxGroup val = model.AddComponent(); HurtBox val2 = null; GameObject val3 = component.FindChildGameObject("HeadHurtbox"); if (Object.op_Implicit((Object)(object)val3)) { Log.Debug("HeadHurtboxFound. Setting up"); val2 = val3.AddComponent(); ((Component)val2).gameObject.layer = LayerIndex.entityPrecise.intVal; val2.healthComponent = bodyPrefab.GetComponent(); val2.isBullseye = false; val2.isSniperTarget = true; val2.damageModifier = (DamageModifier)0; val2.hurtBoxGroup = val; val2.indexInGroup = 1; } HurtBox val4 = component.FindChildGameObject("MainHurtbox").AddComponent(); ((Component)val4).gameObject.layer = LayerIndex.entityPrecise.intVal; val4.healthComponent = bodyPrefab.GetComponent(); val4.isBullseye = true; val4.isSniperTarget = (Object)(object)val2 == (Object)null; val4.damageModifier = (DamageModifier)0; val4.hurtBoxGroup = val; val4.indexInGroup = 0; if (Object.op_Implicit((Object)(object)val2)) { val.hurtBoxes = (HurtBox[])(object)new HurtBox[2] { val4, val2 }; } else { val.hurtBoxes = (HurtBox[])(object)new HurtBox[1] { val4 }; } val.mainHurtBox = val4; val.bullseyeCount = 1; } public static void SetHurtboxesHealthComponents(GameObject bodyPrefab) { HealthComponent component = bodyPrefab.GetComponent(); HurtBoxGroup[] componentsInChildren = bodyPrefab.GetComponentsInChildren(); foreach (HurtBoxGroup val in componentsInChildren) { val.mainHurtBox.healthComponent = component; for (int j = 0; j < val.hurtBoxes.Length; j++) { val.hurtBoxes[j].healthComponent = component; } } } private static void SetupFootstepController(GameObject model) { FootstepHandler footstepHandler = model.AddComponent(); footstepHandler.baseFootstepString = "Play_player_footstep"; footstepHandler.sprintFootstepOverrideString = ""; footstepHandler.enableFootstepDust = true; ContentPacks.asyncLoadCoroutines.Add(Asset.LoadAssetCoroutine((object)"RoR2/Base/Common/VFX/GenericFootstepDust.prefab", (Action)delegate(GameObject result) { footstepHandler.footstepDustPrefab = result; })); } private static void SetupRagdoll(GameObject model) { RagdollController ragdollController = model.GetComponent(); if (!Object.op_Implicit((Object)(object)ragdollController)) { return; } if ((Object)(object)ragdollMaterial == (Object)null) { ContentPacks.asyncLoadCoroutines.Add(Asset.LoadAssetCoroutine((object)"RoR2/Base/Common/physmatRagdoll.physicMaterial", (Action)delegate(PhysicMaterial result) { ragdollMaterial = result; SetupRagdollBones(ragdollController); })); } else { SetupRagdollBones(ragdollController); } } private static void SetupRagdollBones(RagdollController ragdollController) { Transform[] bones = ragdollController.bones; foreach (Transform val in bones) { if (Object.op_Implicit((Object)(object)val)) { ((Component)val).gameObject.layer = LayerIndex.ragdoll.intVal; Collider component = ((Component)val).GetComponent(); if (Object.op_Implicit((Object)(object)component)) { component.sharedMaterial = ragdollMaterial; } else { Log.Error($"Ragdoll bone {((Component)val).gameObject} doesn't have a collider. Ragdoll will break."); } } } } private static void SetupAimAnimator(GameObject prefab, GameObject model) { AimAnimator val = model.AddComponent(); val.directionComponent = prefab.GetComponent(); val.pitchRangeMax = 60f; val.pitchRangeMin = -60f; val.yawRangeMin = -80f; val.yawRangeMax = 80f; val.pitchGiveupRange = 30f; val.yawGiveupRange = 10f; val.giveupDuration = 3f; val.inputBank = prefab.GetComponent(); } private static void SetupSkinController(GameObject gameObject) { gameObject.GetOrAddComponent(); } public static void CreateGenericDoppelganger(GameObject bodyPrefab, string masterName, string masterToCopy) { CloneDopplegangerMaster(bodyPrefab, masterName, masterToCopy); } public static GameObject CloneDopplegangerMaster(GameObject bodyPrefab, string masterName, string masterToCopy) { GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load("Prefabs/CharacterMasters/" + masterToCopy + "MonsterMaster"), masterName, true); val.GetComponent().bodyPrefab = bodyPrefab; Content.AddMasterPrefab(val); return val; } public static void CloneDopplegangerMasterAsync(GameObject bodyPrefab, string masterName, string masterToCopyPath = "RoR2/Base/Merc/MercMonsterMaster.prefab", Action onComplete = null) { ContentPacks.asyncLoadCoroutines.Add(CloneDopplegangerMasterAsyncCoroutine(bodyPrefab, masterName, masterToCopyPath, onComplete)); } public static IEnumerator CloneDopplegangerMasterAsyncCoroutine(GameObject bodyPrefab, string masterName, string masterToCopyPath = "RoR2/Base/Merc/MercMonsterMaster.prefab", Action onComplete = null) { return Asset.LoadAssetCoroutine((object)masterToCopyPath, (Action)delegate(GameObject result) { GameObject val = PrefabAPI.InstantiateClone(result, masterName, true); val.GetComponent().bodyPrefab = bodyPrefab; Content.AddMasterPrefab(val); onComplete?.Invoke(val); }); } public static GameObject CreateBlankMasterPrefab(GameObject bodyPrefab, string masterName) { GameObject master = LegacyResourcesAPI.Load("Prefabs/CharacterMasters/CommandoMonsterMaster"); return CloneMaster(bodyPrefab, masterName, master); } public static IEnumerator CreateBlankMasterPrefabAsyncCoroutine(GameObject bodyPrefab, string masterName, Action onComplete) { return Asset.LoadAssetCoroutine((object)"RoR2/Base/Commando/CommandoMonsterMaster.prefab", (Action)delegate(GameObject result) { onComplete(CloneMaster(bodyPrefab, masterName, result)); }); } public static void CreateBlankMasterPrefabAsync(GameObject bodyPrefab, string masterName, Action onComplete) { ContentPacks.asyncLoadCoroutines.Add(Asset.LoadAssetCoroutine((object)"RoR2/Base/Commando/CommandoMonsterMaster.prefab", (Action)delegate(GameObject result) { onComplete(CloneMaster(bodyPrefab, masterName, result)); })); } private static GameObject CloneMaster(GameObject bodyPrefab, string masterName, GameObject master) { GameObject val = PrefabAPI.InstantiateClone(master, masterName, true); ContentPacks.masterPrefabs.Add(val); CharacterMaster component = val.GetComponent(); component.bodyPrefab = bodyPrefab; AISkillDriver[] components = val.GetComponents(); for (int i = 0; i < components.Length; i++) { Object.Destroy((Object)(object)components[i]); } return val; } public static GameObject LoadMaster(this AssetBundle assetBundle, GameObject bodyPrefab, string assetName) { //IL_0047: 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) GameObject val = assetBundle.LoadAsset(assetName); BaseAI val2 = val.GetComponent(); if ((Object)(object)val2 == (Object)null) { val2 = val.AddComponent(); val2.aimVectorDampTime = 0.1f; val2.aimVectorMaxSpeed = 360f; } val2.scanState = new SerializableEntityStateType(typeof(Wander)); EntityStateMachine component = val.GetComponent(); if ((Object)(object)component == (Object)null) { AddEntityStateMachine(val, "AI", typeof(Wander), typeof(Wander)); } val2.stateMachine = component; CharacterMaster val3 = val.GetComponent(); if ((Object)(object)val3 == (Object)null) { val3 = val.AddComponent(); } val3.bodyPrefab = bodyPrefab; val3.teamIndex = (TeamIndex)2; Content.AddMasterPrefab(val); return val; } public static void ClearEntityStateMachines(GameObject bodyPrefab) { EntityStateMachine[] components = bodyPrefab.GetComponents(); for (int num = components.Length - 1; num >= 0; num--) { Object.DestroyImmediate((Object)(object)components[num]); } NetworkStateMachine component = bodyPrefab.GetComponent(); component.stateMachines = Array.Empty(); CharacterDeathBehavior component2 = bodyPrefab.GetComponent(); if (Object.op_Implicit((Object)(object)component2)) { component2.idleStateMachine = Array.Empty(); } SetStateOnHurt component3 = bodyPrefab.GetComponent(); if (Object.op_Implicit((Object)(object)component3)) { component3.idleStateMachine = Array.Empty(); } } public static EntityStateMachine AddMainEntityStateMachine(GameObject bodyPrefab, string machineName = "Body", Type mainStateType = null, Type initalStateType = null) { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) EntityStateMachine val = EntityStateMachine.FindByCustomName(bodyPrefab, machineName); if ((Object)(object)val == (Object)null) { val = bodyPrefab.AddComponent(); } else { Log.Message("An Entity State Machine already exists with the name " + machineName + ". replacing."); } val.customName = machineName; if (mainStateType == null) { mainStateType = typeof(GenericCharacterMain); } val.mainStateType = new SerializableEntityStateType(mainStateType); if (initalStateType == null) { initalStateType = typeof(SpawnTeleporterState); } val.initialStateType = new SerializableEntityStateType(initalStateType); NetworkStateMachine component = bodyPrefab.GetComponent(); if (Object.op_Implicit((Object)(object)component)) { component.stateMachines = component.stateMachines.Append(val).ToArray(); } CharacterDeathBehavior component2 = bodyPrefab.GetComponent(); if (Object.op_Implicit((Object)(object)component2)) { component2.deathStateMachine = val; } SetStateOnHurt component3 = bodyPrefab.GetComponent(); if (Object.op_Implicit((Object)(object)component3)) { component3.targetStateMachine = val; } return val; } public static EntityStateMachine AddEntityStateMachine(GameObject prefab, string machineName, Type mainStateType = null, Type initalStateType = null, bool addToHurt = true, bool addToDeath = true) { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) EntityStateMachine val = EntityStateMachine.FindByCustomName(prefab, machineName); if ((Object)(object)val == (Object)null) { val = prefab.AddComponent(); } else { Log.Message("An Entity State Machine already exists with the name " + machineName + ". replacing."); } val.customName = machineName; if (mainStateType == null) { mainStateType = typeof(Idle); } val.mainStateType = new SerializableEntityStateType(mainStateType); if (initalStateType == null) { initalStateType = typeof(Idle); } val.initialStateType = new SerializableEntityStateType(initalStateType); NetworkStateMachine component = prefab.GetComponent(); if (Object.op_Implicit((Object)(object)component)) { component.stateMachines = component.stateMachines.Append(val).ToArray(); } CharacterDeathBehavior component2 = prefab.GetComponent(); if (Object.op_Implicit((Object)(object)component2) && addToDeath) { component2.idleStateMachine = component2.idleStateMachine.Append(val).ToArray(); } SetStateOnHurt component3 = prefab.GetComponent(); if (Object.op_Implicit((Object)(object)component3) && addToHurt) { component3.idleStateMachine = component3.idleStateMachine.Append(val).ToArray(); } return val; } public static void SetupHitBoxGroup(GameObject modelPrefab, string groupName, params string[] hitboxChildNames) { ChildLocator component = modelPrefab.GetComponent(); Transform[] array = (Transform[])(object)new Transform[hitboxChildNames.Length]; for (int i = 0; i < hitboxChildNames.Length; i++) { array[i] = component.FindChild(hitboxChildNames[i]); if ((Object)(object)array[i] == (Object)null) { Log.Error("missing hitbox for " + hitboxChildNames[i]); } } SetupHitBoxGroup(modelPrefab, groupName, array); } [Obsolete("use SetupHitBoxGroup")] public static void SetupHitbox(GameObject prefab, Transform hitboxTransform, string hitboxName) { SetupHitBoxGroup(prefab, hitboxName, hitboxTransform); } public static void SetupHitBoxGroup(GameObject prefab, string hitBoxGroupName, params Transform[] hitBoxTransforms) { List list = new List(); foreach (Transform val in hitBoxTransforms) { if ((Object)(object)val == (Object)null) { Log.Error("Error setting up hitboxGroup for " + hitBoxGroupName + ": hitbox transform was null"); continue; } HitBox item = ((Component)val).gameObject.AddComponent(); ((Component)val).gameObject.layer = LayerIndex.projectile.intVal; list.Add(item); } if (list.Count == 0) { Log.Error("No hitboxes were set up. aborting setting up hitboxGroup for " + hitBoxGroupName); return; } HitBoxGroup val2 = prefab.AddComponent(); val2.hitBoxes = list.ToArray(); val2.groupName = hitBoxGroupName; } public static T GetOrAddComponent(this GameObject gameObject) where T : Component { T val = gameObject.GetComponent(); if ((Object)(object)val == (Object)null) { val = gameObject.AddComponent(); } return val; } } public class CustomRendererInfo { public string childName; public Material material = null; public bool dontHotpoo = false; public bool ignoreOverlays = false; } internal static class Skills { 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(); 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(); 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(); 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(); val.skillName = genericSkillName; val.hideInCharacterSelect = hidden; SkillFamily val2 = ScriptableObject.CreateInstance(); ((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().primary.skillFamily, skillDefs); } public static void AddSecondarySkills(GameObject targetPrefab, params SkillDef[] skillDefs) { AddSkillsToFamily(targetPrefab.GetComponent().secondary.skillFamily, skillDefs); } public static void AddUtilitySkills(GameObject targetPrefab, params SkillDef[] skillDefs) { AddSkillsToFamily(targetPrefab.GetComponent().utility.skillFamily, skillDefs); } public static void AddSpecialSkills(GameObject targetPrefab, params SkillDef[] skillDefs) { AddSkillsToFamily(targetPrefab.GetComponent().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 SkillDef CreateSkillDef(SkillDefInfo skillDefInfo) { return Skills.CreateSkillDef(skillDefInfo); } public static T CreateSkillDef(SkillDefInfo skillDefInfo) where T : SkillDef { //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) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) T val = ScriptableObject.CreateInstance(); ((SkillDef)val).skillName = skillDefInfo.skillName; ((Object)(object)val).name = skillDefInfo.skillName; ((SkillDef)val).skillNameToken = skillDefInfo.skillNameToken; ((SkillDef)val).skillDescriptionToken = skillDefInfo.skillDescriptionToken; ((SkillDef)val).icon = skillDefInfo.skillIcon; ((SkillDef)val).activationState = skillDefInfo.activationState; ((SkillDef)val).activationStateMachineName = skillDefInfo.activationStateMachineName; ((SkillDef)val).interruptPriority = skillDefInfo.interruptPriority; ((SkillDef)val).baseMaxStock = skillDefInfo.baseMaxStock; ((SkillDef)val).baseRechargeInterval = skillDefInfo.baseRechargeInterval; ((SkillDef)val).rechargeStock = skillDefInfo.rechargeStock; ((SkillDef)val).requiredStock = skillDefInfo.requiredStock; ((SkillDef)val).stockToConsume = skillDefInfo.stockToConsume; ((SkillDef)val).dontAllowPastMaxStocks = skillDefInfo.dontAllowPastMaxStocks; ((SkillDef)val).beginSkillCooldownOnSkillEnd = skillDefInfo.beginSkillCooldownOnSkillEnd; ((SkillDef)val).canceledFromSprinting = skillDefInfo.canceledFromSprinting; ((SkillDef)val).forceSprintDuringState = skillDefInfo.forceSprintDuringState; ((SkillDef)val).fullRestockOnAssign = skillDefInfo.fullRestockOnAssign; ((SkillDef)val).resetCooldownTimerOnUse = skillDefInfo.resetCooldownTimerOnUse; ((SkillDef)val).isCombatSkill = skillDefInfo.isCombatSkill; ((SkillDef)val).mustKeyPress = skillDefInfo.mustKeyPress; ((SkillDef)val).cancelSprintingOnActivation = skillDefInfo.cancelSprintingOnActivation; ((SkillDef)val).keywordTokens = skillDefInfo.keywordTokens; Content.AddSkillDef((SkillDef)(object)val); return val; } } internal class SkillDefInfo { public string skillName; public string skillNameToken; public string skillDescriptionToken; public string[] keywordTokens = Array.Empty(); public Sprite skillIcon; public SerializableEntityStateType activationState; public string activationStateMachineName; public InterruptPriority interruptPriority; public float baseRechargeInterval; public int baseMaxStock = 1; public int rechargeStock = 1; public int requiredStock = 1; public int stockToConsume = 1; public bool resetCooldownTimerOnUse = false; public bool fullRestockOnAssign = true; public bool dontAllowPastMaxStocks = false; public bool beginSkillCooldownOnSkillEnd = false; public bool mustKeyPress = false; public bool isCombatSkill = true; public bool canceledFromSprinting = false; public bool cancelSprintingOnActivation = true; public bool forceSprintDuringState = false; public SkillDefInfo() { } public SkillDefInfo(string skillName, string skillNameToken, string skillDescriptionToken, Sprite skillIcon, SerializableEntityStateType activationState, string activationStateMachineName = "Weapon", bool agile = false) { //IL_008c: 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_00c2: Unknown result type (might be due to invalid IL or missing references) this.skillName = skillName; this.skillNameToken = skillNameToken; this.skillDescriptionToken = skillDescriptionToken; this.skillIcon = skillIcon; this.activationState = activationState; this.activationStateMachineName = activationStateMachineName; cancelSprintingOnActivation = !agile; if (agile) { keywordTokens = new string[1] { "KEYWORD_AGILE" }; } interruptPriority = (InterruptPriority)0; isCombatSkill = true; baseRechargeInterval = 0f; requiredStock = 0; stockToConsume = 0; } } internal static class Skins { internal struct SkinDefInfo { internal SkinDef[] BaseSkins; internal Sprite Icon; internal string NameToken; internal UnlockableDef UnlockableDef; internal GameObject RootObject; internal RendererInfo[] RendererInfos; internal MeshReplacement[] MeshReplacements; internal GameObjectActivation[] GameObjectActivations; internal ProjectileGhostReplacement[] ProjectileGhostReplacements; internal MinionSkinReplacement[] MinionSkinReplacements; internal string Name; } internal static SkinDef CreateSkinDef(string skinName, Sprite skinIcon, RendererInfo[] defaultRendererInfos, GameObject root, UnlockableDef unlockableDef = null) { //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Expected O, but got Unknown //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Expected O, but got Unknown SkinDefInfo skinDefInfo = new SkinDefInfo { BaseSkins = Array.Empty(), GameObjectActivations = (GameObjectActivation[])(object)new GameObjectActivation[0], Icon = skinIcon, MeshReplacements = (MeshReplacement[])(object)new MeshReplacement[0], MinionSkinReplacements = (MinionSkinReplacement[])(object)new MinionSkinReplacement[0], Name = skinName, NameToken = skinName, ProjectileGhostReplacements = (ProjectileGhostReplacement[])(object)new ProjectileGhostReplacement[0], RendererInfos = (RendererInfo[])(object)new RendererInfo[defaultRendererInfos.Length], RootObject = root, UnlockableDef = unlockableDef }; SkinDef.Awake += new hook_Awake(DoNothing); SkinDef val = ScriptableObject.CreateInstance(); val.baseSkins = skinDefInfo.BaseSkins; val.icon = skinDefInfo.Icon; val.unlockableDef = skinDefInfo.UnlockableDef; val.rootObject = skinDefInfo.RootObject; defaultRendererInfos.CopyTo(skinDefInfo.RendererInfos, 0); val.rendererInfos = skinDefInfo.RendererInfos; val.gameObjectActivations = skinDefInfo.GameObjectActivations; val.meshReplacements = skinDefInfo.MeshReplacements; val.projectileGhostReplacements = skinDefInfo.ProjectileGhostReplacements; val.minionSkinReplacements = skinDefInfo.MinionSkinReplacements; val.nameToken = skinDefInfo.NameToken; ((Object)val).name = skinDefInfo.Name; PopulateSkinDef(defaultRendererInfos, skinDefInfo, val); SkinDef.Awake -= new hook_Awake(DoNothing); return val; } internal static SkinDef GetCurrentSkinDef(CharacterBody characterBody) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return SkinCatalog.GetBodySkinDef(characterBody.bodyIndex, (int)characterBody.skinIndex); } public static T CreateSkinDef(string skinName, Sprite skinIcon, RendererInfo[] defaultRendererInfos, GameObject root, UnlockableDef unlockableDef = null) where T : SkinDef { //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Expected O, but got Unknown //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Expected O, but got Unknown SkinDefInfo skinDefInfo = new SkinDefInfo { BaseSkins = Array.Empty(), GameObjectActivations = (GameObjectActivation[])(object)new GameObjectActivation[0], Icon = skinIcon, MeshReplacements = (MeshReplacement[])(object)new MeshReplacement[0], MinionSkinReplacements = (MinionSkinReplacement[])(object)new MinionSkinReplacement[0], Name = skinName, NameToken = skinName, ProjectileGhostReplacements = (ProjectileGhostReplacement[])(object)new ProjectileGhostReplacement[0], RendererInfos = (RendererInfo[])(object)new RendererInfo[defaultRendererInfos.Length], RootObject = root, UnlockableDef = unlockableDef }; SkinDef.Awake += new hook_Awake(DoNothing); T val = ScriptableObject.CreateInstance(); PopulateSkinDef(defaultRendererInfos, skinDefInfo, (SkinDef)(object)val); SkinDef.Awake -= new hook_Awake(DoNothing); return val; } private static void PopulateSkinDef(RendererInfo[] rendererInfos, SkinDefInfo skinDefInfo, SkinDef skinDef) { skinDef.baseSkins = skinDefInfo.BaseSkins; skinDef.icon = skinDefInfo.Icon; skinDef.unlockableDef = skinDefInfo.UnlockableDef; skinDef.rootObject = skinDefInfo.RootObject; rendererInfos.CopyTo(skinDefInfo.RendererInfos, 0); skinDef.rendererInfos = skinDefInfo.RendererInfos; skinDef.gameObjectActivations = skinDefInfo.GameObjectActivations; skinDef.meshReplacements = skinDefInfo.MeshReplacements; skinDef.projectileGhostReplacements = skinDefInfo.ProjectileGhostReplacements; skinDef.minionSkinReplacements = skinDefInfo.MinionSkinReplacements; skinDef.nameToken = skinDefInfo.NameToken; ((Object)skinDef).name = skinDefInfo.Name; } public static T DuplicateScepterSkinDef(T originalSkinDef, string newName = "_SCEPTER") where T : SkinDef { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Expected O, but got Unknown SkinDef.Awake += new hook_Awake(DoNothing); T val = ScriptableObject.CreateInstance(); ((SkinDef)val).baseSkins = (SkinDef[])(object)new SkinDef[1] { originalSkinDef }; ((SkinDef)val).icon = ((SkinDef)originalSkinDef).icon; ((SkinDef)val).unlockableDef = ((SkinDef)originalSkinDef).unlockableDef; ((SkinDef)val).rootObject = ((SkinDef)originalSkinDef).rootObject; ((SkinDef)val).rendererInfos = ((SkinDef)originalSkinDef).rendererInfos; ((SkinDef)val).gameObjectActivations = ((SkinDef)originalSkinDef).gameObjectActivations; ((SkinDef)val).meshReplacements = ((SkinDef)originalSkinDef).meshReplacements; ((SkinDef)val).projectileGhostReplacements = ((SkinDef)originalSkinDef).projectileGhostReplacements; ((SkinDef)val).minionSkinReplacements = ((SkinDef)originalSkinDef).minionSkinReplacements; ((SkinDef)val).nameToken = ((SkinDef)originalSkinDef).nameToken + newName; ((Object)(object)val).name = ((Object)(object)originalSkinDef).name + newName; SkinDef.Awake -= new hook_Awake(DoNothing); return val; } private static void DoNothing(orig_Awake orig, SkinDef self) { } private static RendererInfo[] getRendererMaterials(RendererInfo[] defaultRenderers, params Material[] materials) { RendererInfo[] array = (RendererInfo[])(object)new RendererInfo[defaultRenderers.Length]; defaultRenderers.CopyTo(array, 0); for (int i = 0; i < array.Length; i++) { try { array[i].defaultMaterial = materials[i]; } catch { Log.Error("error adding skin rendererinfo material. make sure you're not passing in too many"); } } return array; } internal static MeshReplacement[] GetMeshReplacements(this AssetBundle assetBundle, RendererInfo[] defaultRendererInfos, params string[] meshes) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) List list = new List(); for (int i = 0; i < defaultRendererInfos.Length; i++) { if (!string.IsNullOrEmpty(meshes[i])) { list.Add(new MeshReplacement { renderer = defaultRendererInfos[i].renderer, mesh = assetBundle.LoadAsset(meshes[i]) }); } } return list.ToArray(); } internal static List CreateAllActivatedGameObjectsList(ChildLocator childLocator, params string[] allChildren) { List list = new List(); for (int i = 0; i < allChildren.Length; i++) { list.Add(childLocator.FindChildGameObject(allChildren[i])); } return list; } internal static GameObjectActivation[] GetGameObjectActivationsFromList(List allObjects, params int[] activatedChildren) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) GameObjectActivation[] array = (GameObjectActivation[])(object)new GameObjectActivation[allObjects.Count]; for (int i = 0; i < allObjects.Count; i++) { array[i] = new GameObjectActivation { gameObject = allObjects[i], shouldActivate = activatedChildren.Contains(i) }; } return array; } internal static Sprite CreateRecolorIcon(Color color) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0019: 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) //IL_0052: 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) Texture2D val = new Texture2D(4, 4, (TextureFormat)4, false); Color[] pixels = val.GetPixels(); for (int i = 0; i < pixels.Length; i++) { pixels[i] = color; } val.SetPixels(pixels); val.Apply(); return Sprite.Create(val, new Rect(0f, 0f, 4f, 4f), new Vector2(0.5f, 0.5f)); } } internal static class Tokens { public const string agilePrefix = "Agile."; public static string DamageText(string text) { return "" + text + ""; } public static string DamageValueText(float value) { return $"{value * 100f}% damage"; } public static string UtilityText(string text) { return "" + text + ""; } public static string RedText(string text) { return HealthText(text); } public static string HealthText(string text) { return "" + text + ""; } public static string KeywordText(string keyword, string sub) { return "" + keyword + "" + sub + ""; } public static string ScepterDescription(string desc) { return "\nSCEPTER: " + desc + ""; } public static string GetAchievementNameToken(string identifier) { return "ACHIEVEMENT_" + identifier.ToUpperInvariant() + "_NAME"; } public static string GetAchievementDescriptionToken(string identifier) { return "ACHIEVEMENT_" + identifier.ToUpperInvariant() + "_DESCRIPTION"; } } } namespace GorpMod.Modules.UI { public abstract class CompanionHUDManager : MonoBehaviour where TComponent : IHasCompanionUI where TUI : ICompanionUI { private TUI companionUI; private TComponent companionComponent; private GameObject cachedBodyObject; public HUD hud { get; set; } public abstract GameObject UIPrefab { get; } public abstract bool LocalUserOnly { get; } protected abstract string transformPath { get; } private void Awake() { hud = ((Component)this).GetComponent(); } private void Update() { if (!Object.op_Implicit((Object)(object)hud.targetBodyObject)) { return; } if ((Object)(object)cachedBodyObject == (Object)null || (Object)(object)cachedBodyObject != (Object)(object)hud.targetBodyObject) { if (companionUI != null) { companionUI.OnBodyLost(); companionUI = default(TUI); } cachedBodyObject = hud.targetBodyObject; companionComponent = cachedBodyObject.GetComponent(); if (companionComponent != null && companionUI == null) { InitCompanionUI(); } } if (companionUI != null && companionComponent != null && companionComponent.allowUIUpdate) { ref TComponent reference = ref companionComponent; TUI val = companionUI; reference.CompanionUI = val; companionUI.OnUIUpdate(); } } protected virtual void InitCompanionUI() { //IL_0087: Unknown result type (might be due to invalid IL or missing references) if (LocalUserOnly) { PlayerCharacterMasterController component = ((Component)hud.targetMaster).GetComponent(); if ((Object)(object)component == (Object)null) { return; } NetworkIdentity component2 = component.networkUserObject.GetComponent(); if ((Object)(object)component2 == (Object)null || !component2.isLocalPlayer) { return; } } GameObject val = Object.Instantiate(UIPrefab, ((Component)hud).transform.Find(transformPath)); val.transform.localPosition = Vector3.zero; companionUI = val.GetComponent(); companionUI.OnInitialize(companionComponent, hud); } } public interface ICompanionUI { void OnInitialize(T hasUIComponent, HUD hud); void OnUIUpdate(); void OnBodyUnFocused(); void OnBodyLost(); } public interface IHasCompanionUI { bool allowUIUpdate { get; set; } T CompanionUI { get; set; } } } namespace GorpMod.Modules.SkillDefs { public abstract class GenericTrackerSkillDef : HasComponentSkillDef where T : ITracker { private static bool HasTarget([NotNull] GenericSkill skillSlot) { T componentFromSkillDef = ((InstanceData)(object)skillSlot.skillInstanceData).componentFromSkillDef1; return Object.op_Implicit((Object)(object)componentFromSkillDef?.GetTrackingTarget()); } public override bool CanExecute([NotNull] GenericSkill skillSlot) { return HasTarget(skillSlot) && ((SkillDef)this).CanExecute(skillSlot); } public override bool IsReady([NotNull] GenericSkill skillSlot) { return ((SkillDef)this).IsReady(skillSlot) && HasTarget(skillSlot); } } public interface IHasSkillDefComponent { T componentFromSkillDef1 { get; set; } } public abstract class HasComponentSkillDef : SkillDef { public class InstanceData : BaseSkillInstanceData { public T componentFromSkillDef1; } public override BaseSkillInstanceData OnAssigned([NotNull] GenericSkill skillSlot) { return (BaseSkillInstanceData)(object)new InstanceData { componentFromSkillDef1 = ((Component)skillSlot).GetComponent() }; } public override EntityState InstantiateNextState([NotNull] GenericSkill skillSlot) { EntityState val = ((SkillDef)this).InstantiateNextState(skillSlot); InstanceData instanceData = (InstanceData)(object)skillSlot.skillInstanceData; if (val is IHasSkillDefComponent hasSkillDefComponent) { hasSkillDefComponent.componentFromSkillDef1 = instanceData.componentFromSkillDef1; } return val; } } public interface IHasSkillDefComponent { T componentFromSkillDef1 { get; set; } U componentFromSkillDef2 { get; set; } } public abstract class HasComponentSkillDef : SkillDef { public class InstanceData : BaseSkillInstanceData { public T componentFromSkillDef1; public U componentFromSkillDef2; } public override BaseSkillInstanceData OnAssigned([NotNull] GenericSkill skillSlot) { return (BaseSkillInstanceData)(object)new InstanceData { componentFromSkillDef1 = ((Component)skillSlot).GetComponent(), componentFromSkillDef2 = ((Component)skillSlot).GetComponent() }; } public override EntityState InstantiateNextState([NotNull] GenericSkill skillSlot) { EntityState val = ((SkillDef)this).InstantiateNextState(skillSlot); InstanceData instanceData = (InstanceData)(object)skillSlot.skillInstanceData; if (val is IHasSkillDefComponent hasSkillDefComponent) { hasSkillDefComponent.componentFromSkillDef1 = instanceData.componentFromSkillDef1; hasSkillDefComponent.componentFromSkillDef2 = instanceData.componentFromSkillDef2; } return val; } } public interface IHasSkillDefComponent { T componentFromSkillDef1 { get; set; } U componentFromSkillDef2 { get; set; } V componentFromSkillDef3 { get; set; } } public abstract class HasComponentSkillDef : SkillDef { public class InstanceData : BaseSkillInstanceData { public T componentFromSkillDef1; public U componentFromSkillDef2; public V componentFromSkillDef3; } public override BaseSkillInstanceData OnAssigned([NotNull] GenericSkill skillSlot) { return (BaseSkillInstanceData)(object)new InstanceData { componentFromSkillDef1 = ((Component)skillSlot).GetComponent(), componentFromSkillDef2 = ((Component)skillSlot).GetComponent(), componentFromSkillDef3 = ((Component)skillSlot).GetComponent() }; } public override EntityState InstantiateNextState([NotNull] GenericSkill skillSlot) { EntityState val = ((SkillDef)this).InstantiateNextState(skillSlot); InstanceData instanceData = (InstanceData)(object)skillSlot.skillInstanceData; if (val is IHasSkillDefComponent hasSkillDefComponent) { hasSkillDefComponent.componentFromSkillDef1 = instanceData.componentFromSkillDef1; hasSkillDefComponent.componentFromSkillDef2 = instanceData.componentFromSkillDef2; hasSkillDefComponent.componentFromSkillDef3 = instanceData.componentFromSkillDef3; } return val; } } public abstract class PlayAnimationWhenReadySkillDef : SkillDef { public class InstanceData : BaseSkillInstanceData { public Animator animator; } public string animatorBoolParameterName; public override BaseSkillInstanceData OnAssigned([NotNull] GenericSkill skillSlot) { return (BaseSkillInstanceData)(object)new InstanceData { animator = ((Component)skillSlot.characterBody.modelLocator.modelTransform).GetComponent() }; } public override void OnFixedUpdate([NotNull] GenericSkill skillSlot, float deltaTime) { if (!skillSlot.CanExecute()) { ((InstanceData)(object)skillSlot.skillInstanceData).animator.SetBool(animatorBoolParameterName, false); } } } } namespace GorpMod.Modules.Components { public abstract class GenericTracker : MonoBehaviour, ITracker { protected TeamMask mask; protected float trackerUpdateInterval = 0.01f; protected Indicator indicator; private HurtBox trackingTarget; private InputBankTest inputBank; private float trackerUpdateStopwatch; private TeamComponent teamComponent; private readonly BullseyeSearch search = new BullseyeSearch(); public abstract float maxTrackingDistance { get; } public abstract float maxTrackingAngle { get; } public abstract SortMode bullseyeSortMode { get; } public abstract bool filterByLoS { get; } protected virtual void Awake() { SetIndicator(); } protected virtual void SetIndicator() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown indicator = new Indicator(((Component)this).gameObject, LegacyResourcesAPI.Load("Prefabs/HuntressTrackingIndicator")); } protected virtual void Start() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) inputBank = ((Component)this).GetComponent(); teamComponent = ((Component)this).GetComponent(); mask = GetTeamMask(); } protected virtual TeamMask GetTeamMask() { //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_0014: Unknown result type (might be due to invalid IL or missing references) return TeamMask.GetUnprotectedTeams(teamComponent.teamIndex); } public HurtBox GetTrackingTarget() { return trackingTarget; } public bool GetIsAlly() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)trackingTarget == (Object)null) { return false; } return !FriendlyFireManager.ShouldDirectHitProceed(trackingTarget.healthComponent, teamComponent.teamIndex); } protected virtual void OnEnable() { indicator.active = true; } protected virtual void OnDisable() { indicator.active = false; } private void FixedUpdate() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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) trackerUpdateStopwatch += Time.fixedDeltaTime; if (trackerUpdateStopwatch >= trackerUpdateInterval) { trackerUpdateStopwatch -= trackerUpdateInterval; Ray aimRay = default(Ray); ((Ray)(ref aimRay))..ctor(inputBank.aimOrigin, inputBank.aimDirection); trackingTarget = SearchForTarget(aimRay); Indicator obj = indicator; HurtBox obj2 = trackingTarget; obj.targetTransform = ((obj2 != null) ? ((Component)obj2).transform : null); } } protected virtual HurtBox SearchForTarget(Ray aimRay) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) if (this is IDependentTracker { dependentTracker: not null } dependentTracker && Object.op_Implicit((Object)(object)dependentTracker.dependentTracker.GetTrackingTarget())) { return dependentTracker.dependentTracker.GetTrackingTarget(); } search.teamMaskFilter = mask; search.filterByLoS = filterByLoS; search.searchOrigin = ((Ray)(ref aimRay)).origin; search.searchDirection = ((Ray)(ref aimRay)).direction; search.sortMode = bullseyeSortMode; search.maxDistanceFilter = maxTrackingDistance; search.maxAngleFilter = maxTrackingAngle; search.RefreshCandidates(); search.FilterOutGameObject(((Component)this).gameObject); return search.GetResults().FirstOrDefault(); } } public interface IDependentTracker { ITracker dependentTracker { get; set; } } public interface ITracker { HurtBox GetTrackingTarget(); } public abstract class TrackerSkillDefRequired : GenericTracker where T : SkillDef { private Dictionary skillMap = new Dictionary(); protected override void Start() { base.Start(); GenericSkill[] components = ((Component)this).GetComponents(); for (int i = 0; i < components.Length; i++) { skillMap[components[i]] = false; components[i].onSkillChanged += OnSkillChanged; OnSkillChanged(components[i]); } } private void OnDestroy() { foreach (GenericSkill key in skillMap.Keys) { key.onSkillChanged -= OnSkillChanged; } } protected virtual void OnSkillChanged(GenericSkill genericSkill) { skillMap[genericSkill] = genericSkill.skillDef is T; CheckSkills(); } private void CheckSkills() { foreach (bool value in skillMap.Values) { if (value) { ((Behaviour)this).enabled = true; return; } } ((Behaviour)this).enabled = false; } } } namespace GorpMod.Modules.Characters { public abstract class BaseItemDisplaysSetup { public void SetItemDisplays(ItemDisplayRuleSet itemDisplayRuleSet) { ItemDisplays.SetItemDisplaysWhenReady(delegate { List list = new List(); SetItemDisplayRules(list); itemDisplayRuleSet.keyAssetRuleGroups = list.ToArray(); }); } protected abstract void SetItemDisplayRules(List itemDisplayRules); } public abstract class CharacterBase where T : CharacterBase, new() { private BodyInfo cachedBodyInfo; private BodyIndex? _lazyBodyIndex; public abstract string assetBundleName { get; } public abstract string bodyName { get; } public abstract string modelPrefabName { get; } public abstract BodyInfo bodyInfo { get; } protected BodyInfo _bodyInfo { get { if (cachedBodyInfo == null) { cachedBodyInfo = bodyInfo; } return cachedBodyInfo; } set { cachedBodyInfo = value; } } public virtual CustomRendererInfo[] customRendererInfos { get; } public virtual BaseItemDisplaysSetup itemDisplays { get; } public static T instance { get; private set; } public virtual AssetBundle assetBundle { get; protected set; } public virtual GameObject bodyPrefab { get; protected set; } public virtual CharacterBody prefabCharacterBody { get; protected set; } public virtual GameObject characterModelObject { get; protected set; } public virtual CharacterModel prefabCharacterModel { get; protected set; } public BodyIndex bodyIndex { get { //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //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) //IL_0057: Invalid comparison between Unknown and I4 //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) if (!_lazyBodyIndex.HasValue) { if ((Object)(object)bodyPrefab == (Object)null) { Log.Error("Cannot get BodyIndex for " + bodyName + ". Body has not been created."); return (BodyIndex)0; } BodyIndex val = bodyPrefab.GetComponent().bodyIndex; if ((int)val == 0) { Log.Error("Cannot get BodyIndex for " + bodyName + ". Body has not been registered."); return val; } _lazyBodyIndex = val; } return _lazyBodyIndex.Value; } } public static BodyIndex GetBodyIndexSafe() { //IL_0026: 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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) if (instance != null) { return instance.bodyIndex; } return (BodyIndex)0; } public static string GetBodyNameSafe() { if (instance != null) { return instance.bodyName; } return ""; } public virtual void Initialize() { instance = this as T; Log.CurrentTime(bodyName + " init"); Asset.LoadAssetBundleAsync(assetBundleName, delegate(AssetBundle loadedAssetBundle) { Log.CurrentTime(bodyName + " assetbundle loaded"); assetBundle = loadedAssetBundle; ContentPacks.asyncLoadCoroutines.Add(LoadAssetsThenInitializeCharacter()); if (_bodyInfo != null) { ContentPacks.asyncLoadCoroutines.Add(_bodyInfo.FinalizeBodyInfoAsync(assetBundle)); if (_bodyInfo.asyncLoads != null) { ContentPacks.asyncLoadCoroutines.AddRange(_bodyInfo.asyncLoads); } } }); } public virtual List GetAssetBundleInitializedCoroutines() { return null; } public virtual IEnumerator LoadAssetsThenInitializeCharacter() { List subEnumerators = GetAssetBundleInitializedCoroutines(); if (subEnumerators != null) { for (int i = 0; i < subEnumerators.Count; i++) { while (subEnumerators[i].MoveNext()) { yield return null; } } } InitializeCharacter(); } public virtual void InitializeCharacter() { InitializeCharacterBodyPrefab(); } public abstract void OnCharacterInitialized(); protected virtual void InitializeCharacterBodyPrefab() { ContentPacks.asyncLoadCoroutines.Add(Prefabs.LoadCharacterModelAsync(assetBundle, modelPrefabName, delegate(GameObject modelResult) { characterModelObject = PrefabAPI.InstantiateClone(modelResult, modelPrefabName); ContentPacks.asyncLoadCoroutines.Add(Prefabs.CloneCharacterBodyAsync(characterModelObject, _bodyInfo, delegate(GameObject bodyResult) { bodyPrefab = bodyResult; prefabCharacterBody = bodyPrefab.GetComponent(); prefabCharacterModel = Prefabs.SetupCharacterModel(bodyPrefab, _bodyInfo, customRendererInfos); Log.CurrentTime(bodyName + " body prefab complete"); InitializeItemDisplays(); ContentPacks.asyncLoadCoroutines.Add(LoadAssetsThenFinalizeCharacter()); })); })); } public virtual void InitializeItemDisplays() { ItemDisplayRuleSet val = ScriptableObject.CreateInstance(); ((Object)val).name = "idrs" + bodyName; prefabCharacterModel.itemDisplayRuleSet = val; if (itemDisplays != null) { itemDisplays.SetItemDisplays(prefabCharacterModel.itemDisplayRuleSet); } } public virtual List GetCoroutinesAfterPrefabCreation() { return null; } public virtual IEnumerator LoadAssetsThenFinalizeCharacter() { List subEnumerators = GetCoroutinesAfterPrefabCreation(); if (subEnumerators != null) { for (int i = 0; i < subEnumerators.Count; i++) { while (subEnumerators[i].MoveNext()) { yield return null; } } } OnCharacterInitialized(); } public abstract void InitializeEntityStateMachines(); public abstract void InitializeSkills(); public abstract void InitializeSkins(); public abstract void InitializeCharacterMaster(); } public class BodyInfo { public string bodyName = ""; public string bodyNameToken = ""; public string subtitleNameToken = ""; [Obsolete("I recommend loading asynchronously instead, using bodyToClonePath.")] public string bodynameToClone = "Commando"; public string bodyToClonePath = "RoR2/Base/Commando/CommandoBody.prefab"; public Color bodyColor = Color.white; public float sortPosition = 100f; public BodyFlags bodyFlags = (BodyFlags)16; public Texture characterPortrait = null; public string characterPortraitBundlePath = null; public string characterPortraitAddressablePath = null; public GameObject crosshair = null; public string crosshairBundlePath = null; public string crosshairAddressablePath = null; public GameObject podPrefab = null; public string podPrefabBundlePath = null; public string podPrefabAddressablePath = null; public List asyncLoads = null; public float maxHealth = 100f; public float healthRegen = 1f; public float armor = 0f; public float shield = 0f; public int jumpCount = 1; public float damage = 12f; public float attackSpeed = 1f; public float crit = 1f; public float moveSpeed = 7f; public float acceleration = 80f; public float jumpPower = 15f; public bool autoCalculateLevelStats = true; public float healthGrowth = 30.000002f; public float regenGrowth = 0.2f; public float armorGrowth = 0f; public float shieldGrowth = 0f; public float damageGrowth = 2.4f; public float attackSpeedGrowth = 0f; public float critGrowth = 0f; public float moveSpeedGrowth = 0f; public float jumpPowerGrowth = 0f; public Vector3 aimOriginPosition = new Vector3(0f, 1.6f, 0f); public Vector3 modelBasePosition = new Vector3(0f, -0.92f, 0f); public Vector3 cameraPivotPosition = new Vector3(0f, 0.8f, 0f); public float cameraParamsVerticalOffset = 1.37f; public float cameraParamsDepth = -10f; internal bool hasAimAnimator = true; internal bool hasCharacterDirection = true; internal bool hasFoostepController = true; internal bool hasRagdoll = true; internal bool hasSkinController = true; private CharacterCameraParams _cameraParams; public CharacterCameraParams cameraParams { get { //IL_0030: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_cameraParams == (Object)null) { _cameraParams = ScriptableObject.CreateInstance(); _cameraParams.data.minPitch = BlendableFloat.op_Implicit(-70f); _cameraParams.data.maxPitch = BlendableFloat.op_Implicit(70f); _cameraParams.data.wallCushion = BlendableFloat.op_Implicit(0.1f); _cameraParams.data.pivotVerticalOffset = BlendableFloat.op_Implicit(cameraParamsVerticalOffset); _cameraParams.data.idealLocalCameraPos = BlendableVector3.op_Implicit(new Vector3(0f, 0f, cameraParamsDepth)); } return _cameraParams; } set { _cameraParams = value; } } public IEnumerator FinalizeBodyInfoAsync(AssetBundle assetBundle) { List bodyInfoLoads = new List(); if ((Object)(object)characterPortrait == (Object)null) { bodyInfoLoads.Add(Asset.LoadFromAddressableOrBundle(assetBundle, characterPortraitBundlePath, characterPortraitAddressablePath, (Action)delegate(Texture result) { characterPortrait = result; })); } if ((Object)(object)crosshair == (Object)null) { bodyInfoLoads.Add(Asset.LoadFromAddressableOrBundle(assetBundle, crosshairBundlePath, crosshairAddressablePath, (Action)delegate(GameObject result) { crosshair = result; })); } if ((Object)(object)podPrefab == (Object)null) { bodyInfoLoads.Add(Asset.LoadFromAddressableOrBundle(assetBundle, podPrefabBundlePath, podPrefabAddressablePath, (Action)delegate(GameObject result) { podPrefab = result; })); } for (int i = 0; i < bodyInfoLoads.Count; i++) { while (bodyInfoLoads[i] != null && bodyInfoLoads[i].MoveNext()) { yield return null; } } } } public abstract class SurvivorBase : CharacterBase where T : SurvivorBase, new() { public abstract string masterName { get; } public abstract string displayPrefabName { get; } public abstract string survivorTokenPrefix { get; } public abstract UnlockableDef characterUnlockableDef { get; } public virtual GameObject displayPrefab { get; protected set; } public override List GetCoroutinesAfterPrefabCreation() { List list = new List(); list.Add(Prefabs.CreateDisplayPrefabAsync(assetBundle, displayPrefabName, characterModelObject, delegate(GameObject result) { displayPrefab = result; InitializeSurvivor(); })); return list; } protected virtual void InitializeSurvivor() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) RegisterNewSurvivor(bodyPrefab, displayPrefab, base._bodyInfo.bodyColor, survivorTokenPrefix, characterUnlockableDef, base._bodyInfo.sortPosition); } public static void RegisterNewSurvivor(GameObject bodyPrefab, GameObject displayPrefab, Color charColor, string tokenPrefix, UnlockableDef unlockableDef, float sortPosition) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) Log.Warning("created " + ((Object)bodyPrefab).name + " survivordef"); Content.CreateSurvivor(bodyPrefab, displayPrefab, charColor, tokenPrefix, unlockableDef, sortPosition); } protected virtual void AddCssPreviewSkill(int indexFromEditor, SkillFamily skillFamily, SkillDef skillDef) { CharacterSelectSurvivorPreviewDisplayController component = displayPrefab.GetComponent(); if (!Object.op_Implicit((Object)(object)component)) { Log.Error("trying to add skillChangeResponse to null CharacterSelectSurvivorPreviewDisplayController.\nMake sure you created one on your Display prefab in editor"); return; } component.skillChangeResponses[indexFromEditor].triggerSkillFamily = skillFamily; component.skillChangeResponses[indexFromEditor].triggerSkill = skillDef; } protected virtual void AddCssPreviewSkin(int indexFromEditor, SkinDef skinDef) { CharacterSelectSurvivorPreviewDisplayController component = displayPrefab.GetComponent(); if (!Object.op_Implicit((Object)(object)component)) { Log.Error("trying to add skinChangeResponse to null CharacterSelectSurvivorPreviewDisplayController.\nMake sure you created one on your Display prefab in editor"); } else { component.skinChangeResponses[indexFromEditor].triggerSkin = skinDef; } } protected virtual void FinalizeCSSPreviewDisplayController() { //IL_0073: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)displayPrefab)) { return; } CharacterSelectSurvivorPreviewDisplayController component = displayPrefab.GetComponent(); if (!Object.op_Implicit((Object)(object)component)) { return; } component.bodyPrefab = bodyPrefab; List list = new List(); for (int i = 0; i < component.skillChangeResponses.Length; i++) { if ((Object)(object)component.skillChangeResponses[i].triggerSkillFamily != (Object)null) { list.Add(component.skillChangeResponses[i]); } } component.skillChangeResponses = list.ToArray(); } } } namespace GorpMod.Modules.BaseStates { public class BaseEmote : BaseState { public string soundString; public string animString; public float duration; private uint activePlayID; private Animator animator; private ChildLocator childLocator; public LocalUser localUser; private CharacterCameraParamsData emoteCameraParams = new CharacterCameraParamsData { maxPitch = BlendableFloat.op_Implicit(70f), minPitch = BlendableFloat.op_Implicit(-70f), pivotVerticalOffset = BlendableFloat.op_Implicit(0.2f), idealLocalCameraPos = BlendableVector3.op_Implicit(emoteCameraPosition), wallCushion = BlendableFloat.op_Implicit(0.1f) }; public static Vector3 emoteCameraPosition = new Vector3(0f, -0.8f, -10.2f); private CameraParamsOverrideHandle camOverrideHandle; public override void OnEnter() { //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00db: 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_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) ((BaseState)this).OnEnter(); animator = ((EntityState)this).GetModelAnimator(); childLocator = ((EntityState)this).GetModelChildLocator(); FindLocalUser(); ((EntityState)this).characterBody.hideCrosshair = true; if (Object.op_Implicit((Object)(object)((EntityState)this).GetAimAnimator())) { ((Behaviour)((EntityState)this).GetAimAnimator()).enabled = false; } animator.SetLayerWeight(animator.GetLayerIndex("AimPitch"), 0f); animator.SetLayerWeight(animator.GetLayerIndex("AimYaw"), 0f); ((EntityState)this).PlayAnimation("FullBody, Override", animString); activePlayID = Util.PlaySound(soundString, ((EntityState)this).gameObject); CameraParamsOverrideRequest val = new CameraParamsOverrideRequest { cameraParamsData = emoteCameraParams, priority = 0f }; camOverrideHandle = ((EntityState)this).cameraTargetParams.AddParamsOverride(val, 0.5f); } public override void OnExit() { //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) ((EntityState)this).OnExit(); ((EntityState)this).characterBody.hideCrosshair = false; if (Object.op_Implicit((Object)(object)((EntityState)this).GetAimAnimator())) { ((Behaviour)((EntityState)this).GetAimAnimator()).enabled = true; } animator.SetLayerWeight(animator.GetLayerIndex("AimPitch"), 1f); animator.SetLayerWeight(animator.GetLayerIndex("AimYaw"), 1f); ((EntityState)this).PlayAnimation("FullBody, Override", "BufferEmpty"); if (activePlayID != 0) { AkSoundEngine.StopPlayingID(activePlayID); } ((EntityState)this).cameraTargetParams.RemoveParamsOverride(camOverrideHandle, 0.5f); } public override void FixedUpdate() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) ((EntityState)this).FixedUpdate(); bool flag = false; if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor)) { if (!((EntityState)this).characterMotor.isGrounded) { flag = true; } if (((EntityState)this).characterMotor.velocity != Vector3.zero) { flag = true; } } if (Object.op_Implicit((Object)(object)((EntityState)this).inputBank)) { if (((EntityState)this).inputBank.skill1.down) { flag = true; } if (((EntityState)this).inputBank.skill2.down) { flag = true; } if (((EntityState)this).inputBank.skill3.down) { flag = true; } if (((EntityState)this).inputBank.skill4.down) { flag = true; } if (((EntityState)this).inputBank.jump.down) { flag = true; } if (((EntityState)this).inputBank.moveVector != Vector3.zero) { flag = true; } } if (!((EntityState)this).isAuthority || ((EntityState)this).characterMotor.isGrounded) { } if (duration > 0f && ((EntityState)this).fixedAge >= duration) { flag = true; } if (flag) { ((EntityState)this).outer.SetNextStateToMain(); } } private void CheckEmote(KeyCode keybind, EntityState state) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if (Input.GetKeyDown(keybind) && !localUser.isUIFocused) { ((EntityState)this).outer.SetInterruptState(state, (InterruptPriority)0); } } private bool CheckEmote(KeyboardShortcut keybind) where T : EntityState, new() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if (Config.GetKeyPressed(keybind)) { FindLocalUser(); if (localUser != null && !localUser.isUIFocused) { ((EntityState)this).outer.SetInterruptState((EntityState)(object)new T(), (InterruptPriority)0); return true; } } return false; } private void FindLocalUser() { if (localUser != null || !Object.op_Implicit((Object)(object)((EntityState)this).characterBody)) { return; } foreach (LocalUser readOnlyLocalUsers in LocalUserManager.readOnlyLocalUsersList) { if ((Object)(object)readOnlyLocalUsers.cachedBody == (Object)(object)((EntityState)this).characterBody) { localUser = readOnlyLocalUsers; break; } } } public override InterruptPriority GetMinimumInterruptPriority() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) return (InterruptPriority)0; } } public abstract class BaseMeleeAttack : BaseSkillState { public string hitBoxGroupName = "SwordGroup"; public DamageTypeCombo damageType = DamageTypeCombo.GenericPrimary; public float damageCoefficient = 3.5f; public float procCoefficient = 1f; public float pushForce = 300f; public Vector3 bonusForce = Vector3.zero; public float baseDuration = 1f; public float attackStartPercentTime = 0.2f; public float attackEndPercentTime = 0.4f; public float earlyExitPercentTime = 0.4f; public float hitStopDuration = 0.012f; public float attackRecoil = 0.75f; public float hitHopVelocity = 4f; public string swingSoundString = ""; public string muzzleString = "SwingCenter"; public string playbackRateParam; public GameObject swingEffectPrefab; public GameObject hitEffectPrefab; public NetworkSoundEventIndex impactSound = (NetworkSoundEventIndex)(-1); protected OverlapAttack overlapAttack; protected float duration; protected Animator animator; protected float stopwatch; protected bool inHitPause; protected bool hasFired; private float hitPauseTimer; private bool hasHopped; private HitStopCachedState hitStopCachedState; private Vector3 storedVelocity; private GameObject swingEffectInstance; private EffectManagerHelper swingEffectInstanceHelper; private ScaleParticleSystemDuration swingEffectParticleScaler; public override void OnEnter() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) ((BaseState)this).OnEnter(); duration = baseDuration / ((BaseState)this).attackSpeedStat; animator = ((EntityState)this).GetModelAnimator(); ((BaseState)this).StartAimMode(0.5f + duration, false); overlapAttack = new OverlapAttack(); overlapAttack.damageType = damageType; overlapAttack.attacker = ((EntityState)this).gameObject; overlapAttack.inflictor = ((EntityState)this).gameObject; overlapAttack.teamIndex = ((BaseState)this).GetTeam(); overlapAttack.damage = damageCoefficient * ((BaseState)this).damageStat; overlapAttack.procCoefficient = procCoefficient; overlapAttack.hitEffectPrefab = hitEffectPrefab; overlapAttack.forceVector = bonusForce; overlapAttack.pushAwayForce = pushForce; overlapAttack.hitBoxGroup = ((BaseState)this).FindHitBoxGroup(hitBoxGroupName); overlapAttack.isCrit = ((BaseState)this).RollCrit(); overlapAttack.impactSound = impactSound; } protected abstract void PlayAttackAnimation(); public override void OnExit() { if (inHitPause) { RemoveHitstop(); } if (Object.op_Implicit((Object)(object)swingEffectInstance)) { EntityState.Destroy((Object)(object)swingEffectInstance); } swingEffectInstance = null; ((EntityState)this).OnExit(); } protected virtual void PlaySwingEffect() { Transform val = ((BaseState)this).FindModelChild(muzzleString); if (Object.op_Implicit((Object)(object)val)) { swingEffectInstance = Object.Instantiate(swingEffectPrefab, val); swingEffectParticleScaler = swingEffectInstance.GetComponent(); if (Object.op_Implicit((Object)(object)swingEffectParticleScaler)) { swingEffectParticleScaler.newDuration = swingEffectParticleScaler.initialDuration; } } } protected virtual void OnHitEnemyAuthority() { if (!hasHopped) { if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) && !((EntityState)this).characterMotor.isGrounded && hitHopVelocity > 0f) { ((BaseState)this).SmallHop(((EntityState)this).characterMotor, hitHopVelocity / (((BaseState)this).attackSpeedStat * ((BaseState)this).attackSpeedStat)); } 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; } if (Object.op_Implicit((Object)(object)swingEffectInstance) && Object.op_Implicit((Object)(object)swingEffectParticleScaler)) { swingEffectParticleScaler.newDuration = 100f; } } private void FireAttack() { if (((EntityState)this).isAuthority && overlapAttack.Fire((List)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.deltaTime; if (hitPauseTimer <= 0f && inHitPause) { RemoveHitstop(); } if (!inHitPause) { stopwatch += Time.deltaTime; } 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; if (Object.op_Implicit((Object)(object)swingEffectInstance) && Object.op_Implicit((Object)(object)swingEffectParticleScaler)) { swingEffectParticleScaler.newDuration = swingEffectParticleScaler.initialDuration; } } 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 abstract class BaseTimedSkillState : BaseSkillState { protected float duration; protected float castStartTime; protected float castEndTime; protected bool hasFired; protected bool isFiring; protected bool hasExited; public abstract float TimedBaseDuration { get; } public abstract float TimedBaseCastStartPercentTime { get; } public virtual float TimedBaseCastEndPercentTime => 1f; public override void OnEnter() { ((BaseState)this).OnEnter(); InitDurationValues(); } protected virtual void InitDurationValues() { duration = TimedBaseDuration / ((BaseState)this).attackSpeedStat; castStartTime = TimedBaseCastStartPercentTime * duration; castEndTime = TimedBaseCastEndPercentTime * duration; } protected virtual void OnCastEnter() { } protected virtual void OnCastFixedUpdate() { } protected virtual void OnCastUpdate() { } protected virtual void OnCastExit() { } public override void FixedUpdate() { ((EntityState)this).FixedUpdate(); bool flag = ((EntityState)this).fixedAge >= castStartTime; bool flag2 = ((EntityState)this).fixedAge >= castEndTime; isFiring = false; if ((flag && !flag2) || (flag && flag2 && !hasFired)) { isFiring = true; OnCastFixedUpdate(); if (!hasFired) { OnCastEnter(); hasFired = true; } } if (flag2 && !hasExited) { hasExited = true; OnCastExit(); } if (((EntityState)this).fixedAge > duration) { SetNextState(); } } protected virtual void SetNextState() { ((EntityState)this).outer.SetNextStateToMain(); } public override void Update() { ((EntityState)this).Update(); if (isFiring) { OnCastUpdate(); } } } public class ExampleTimedSkillState : BaseTimedSkillState { public override float TimedBaseDuration => 1.5f; public override float TimedBaseCastStartPercentTime => 0.2f; public override float TimedBaseCastEndPercentTime => 0.9f; protected override void OnCastEnter() { } protected override void OnCastFixedUpdate() { } protected override void OnCastExit() { } } public class ExampleDelayedSkillState : BaseTimedSkillState { public override float TimedBaseDuration => 1.5f; public override float TimedBaseCastStartPercentTime => 0.2f; protected override void OnCastEnter() { } } } namespace GorpMod.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 GorpMod.Enemies.Gorp.Content { public static class CharacterAI { public static void Init(GameObject bodyPrefab, string masterName) { Prefabs.CreateBlankMasterPrefabAsync(bodyPrefab, masterName, delegate(GameObject master) { SetupAI(master); }); } private static void SetupAI(GameObject master) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0072: 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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Unknown result type (might be due to invalid IL or missing references) //IL_03d6: Unknown result type (might be due to invalid IL or missing references) //IL_03ea: Unknown result type (might be due to invalid IL or missing references) //IL_03f2: Unknown result type (might be due to invalid IL or missing references) BaseAI component = master.GetComponent(); component.aimVectorDampTime = 0.1f; component.aimVectorMaxSpeed = 360f; AISkillDriver val = master.AddComponent(); val.customName = "match matches far"; val.skillSlot = (SkillSlot)3; val.requireSkillReady = true; val.minDistance = 0f; val.maxDistance = float.NegativeInfinity; val.selectionRequiresTargetLoS = false; val.selectionRequiresOnGround = false; val.selectionRequiresAimTarget = false; val.maxTimesSelected = -1; val.moveTargetType = (TargetType)0; val.activationRequiresTargetLoS = false; val.activationRequiresAimTargetLoS = false; val.activationRequiresAimConfirmation = false; val.movementType = (MovementType)2; val.moveInputScale = 1f; val.aimType = (AimType)1; val.buttonPressType = (ButtonPressType)0; AISkillDriver val2 = master.AddComponent(); val2.customName = "Use Primary Swing"; val2.skillSlot = (SkillSlot)0; val2.requiredSkill = null; val2.requireSkillReady = false; val2.requireEquipmentReady = false; val2.minUserHealthFraction = float.NegativeInfinity; val2.maxUserHealthFraction = float.PositiveInfinity; val2.minTargetHealthFraction = float.NegativeInfinity; val2.maxTargetHealthFraction = float.PositiveInfinity; val2.minDistance = 0f; val2.maxDistance = 8f; val2.selectionRequiresTargetLoS = false; val2.selectionRequiresOnGround = false; val2.selectionRequiresAimTarget = false; val2.maxTimesSelected = -1; val2.moveTargetType = (TargetType)0; val2.activationRequiresTargetLoS = false; val2.activationRequiresAimTargetLoS = false; val2.activationRequiresAimConfirmation = false; val2.movementType = (MovementType)1; val2.moveInputScale = 1f; val2.aimType = (AimType)1; val2.ignoreNodeGraph = false; val2.shouldSprint = false; val2.shouldFireEquipment = false; val2.buttonPressType = (ButtonPressType)0; val2.driverUpdateTimerOverride = -1f; val2.resetCurrentEnemyOnNextDriverSelection = false; val2.noRepeat = false; val2.nextHighPriorityOverride = null; AISkillDriver val3 = master.AddComponent(); val3.customName = "Use Secondary Shoot"; val3.skillSlot = (SkillSlot)1; val3.requireSkillReady = true; val3.minDistance = 0f; val3.maxDistance = 25f; val3.selectionRequiresTargetLoS = false; val3.selectionRequiresOnGround = false; val3.selectionRequiresAimTarget = false; val3.maxTimesSelected = -1; val3.moveTargetType = (TargetType)0; val3.activationRequiresTargetLoS = false; val3.activationRequiresAimTargetLoS = false; val3.activationRequiresAimConfirmation = true; val3.movementType = (MovementType)1; val3.moveInputScale = 1f; val3.aimType = (AimType)1; val3.buttonPressType = (ButtonPressType)0; AISkillDriver val4 = master.AddComponent(); val4.customName = "UtilityClose"; val4.skillSlot = (SkillSlot)2; val4.requireSkillReady = true; val4.minDistance = 10f; val4.maxDistance = 30f; val4.selectionRequiresTargetLoS = true; val4.selectionRequiresOnGround = false; val4.selectionRequiresAimTarget = false; val4.maxTimesSelected = -1; val4.moveTargetType = (TargetType)0; val4.activationRequiresTargetLoS = false; val4.activationRequiresAimTargetLoS = false; val4.activationRequiresAimConfirmation = false; val4.movementType = (MovementType)2; val4.moveInputScale = 1f; val4.aimType = (AimType)1; val4.buttonPressType = (ButtonPressType)0; AISkillDriver val5 = master.AddComponent(); val5.customName = "Chase and match"; val5.skillSlot = (SkillSlot)3; val5.requireSkillReady = false; val5.minDistance = 0f; val5.maxDistance = float.PositiveInfinity; val5.moveTargetType = (TargetType)0; val5.activationRequiresTargetLoS = false; val5.activationRequiresAimTargetLoS = false; val5.activationRequiresAimConfirmation = false; val5.movementType = (MovementType)1; val5.moveInputScale = 1f; val5.aimType = (AimType)1; val5.buttonPressType = (ButtonPressType)0; AISkillDriver val6 = master.AddComponent(); val6.customName = "UtilityCloseDistance"; val6.skillSlot = (SkillSlot)2; val6.requireSkillReady = true; val6.minDistance = 50f; val6.maxDistance = float.PositiveInfinity; val6.selectionRequiresTargetLoS = true; val6.selectionRequiresOnGround = false; val6.selectionRequiresAimTarget = false; val6.maxTimesSelected = -1; val6.moveTargetType = (TargetType)0; val6.activationRequiresTargetLoS = false; val6.activationRequiresAimTargetLoS = false; val6.activationRequiresAimConfirmation = false; val6.movementType = (MovementType)1; val6.moveInputScale = 1f; val6.aimType = (AimType)1; val6.buttonPressType = (ButtonPressType)0; } } public static class CharacterAssets { public static GameObject GipMaster; public static CharacterSpawnCard GipSpawnCard; public static void Init() { Asset.LoadAssetAsync(RoR2_DLC1_Gup.GipMaster_prefab, (Action)delegate(GameObject gipMaster) { GipMaster = gipMaster; }); Asset.LoadAssetAsync(RoR2_DLC1_Gup.cscGipBody_asset, (Action)delegate(CharacterSpawnCard gipSpawnCard) { GipSpawnCard = gipSpawnCard; }); } } public static class CharacterBuffs { public static BuffDef GorpThresholdBuff; public static void Init(AssetBundle assetBundle) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) GorpThresholdBuff = GorpMod.Modules.Content.CreateAndAddBuff("GorpBuff", LegacyResourcesAPI.Load("BuffDefs/HiddenInvincibility").iconSprite, Color.yellow, canStack: true, isDebuff: false, isHidden: true); } } public class CharacterConfig { public class StageSpawnInfo { private string stageName; private int minStages; public StageSpawnInfo(string stageName, int minStages) { this.stageName = stageName; this.minStages = minStages; } public string GetStageName() { return stageName; } public int GetMinStages() { return minStages; } } public const string SectionBody = "Body"; public const string SectionSkills = "Skills"; public const string SectionMisc = "Misc"; public const string SectionDebug = "Debug"; public static ConfigEntry Debug; [Configure("Debug", 10, max = 30f)] public static ConfigEntry HealthThresholds; [Configure("Debug", 1.3f, max = 30f)] public static ConfigEntry Size_MinHealth; [Configure("Debug", 2.25f, max = 30f)] public static ConfigEntry Size_MaxHealth; [Configure("Misc", 2.1f, max = 100f, name = "Max Absorption Health/Size", description = "The multiplier of starting max health that gorp is allowed to absorb")] public static ConfigEntry MaxAbsorbtionSize; [Configure("Misc", 5f, max = 30f, name = "Low Health Move Speed Gain", description = "How much move speed it gains as its health gets lower.")] public static ConfigEntry AdditionalMoveSpeed_MinHealth; [Configure("Misc", 3f, max = 30f)] public static ConfigEntry EarScale; [Configure("Debug", 7f, max = 30f)] public static ConfigEntry MonchDistance_MinHealth; [Configure("Debug", 16f, max = 30f)] public static ConfigEntry MonchDistance_MaxHealth; [Configure("Debug", 0.3f, max = 1f)] public static ConfigEntry MonchInterval; [Configure("Misc", 5, max = 30f, description = "How many gips are spawned when it dies")] public static ConfigEntry DeathGips; [Configure("Debug", 0.3f, name = "Spike State Damage")] public static ConfigEntry SpikeStateRepeatInterval; [Configure("Debug", 3)] public static ConfigEntry SpikeStateRepeats; [Configure("Skills", 3, description = "damage coefficient. ex: 2 = 200% damage")] public static ConfigEntry SpikeStateDamage; [Configure("Debug", 0.5f)] public static ConfigEntry Mortar_baseDuration; [Configure("Debug", 1f)] public static ConfigEntry Mortar_minimumTime; [Configure("Debug", 40f, max = 500f)] public static ConfigEntry Mortar_projectileHorizontalSpeed; [Configure("Debug", 4f)] public static ConfigEntry Mortar_animationTimeMulti; [Configure("Debug", 50f, max = 500f, description = "unused attack")] public static ConfigEntry Bound_HorizontalSpeedMultiplier; [Configure("Debug", 0.5f, max = 2f, description = "unused attack. 1 is perfect distance, 0 is none, 2 is twice the distance etc")] public static ConfigEntry Bound_predictionTime; [Configure("Misc", -1, min = -1f, name = "Minimum Stage Clear Count", description = "Number of stages that must be completed before this boss can spawn")] public static ConfigEntry minimumStageCount; [Configure("Misc", 600, name = "Spawn Credits Cost", description = "How many director credits does this boss cost to spawn")] public static ConfigEntry spawnCost; public static List StageList = new List(); public void Init() { Debug = ((BaseUnityPlugin)GorpPlugin.instance).Config.Bind("Debug", "Debug", false, "Enables development configs and logs"); if (!Debug.Value) { Config.DisableSection("Debug"); } Config.InitConfigAttributes(GetType()); ConfigEntry configEntry = Config.BindAndOptions("Misc", "Stage Spawn List", "lakes, lakesnight, dampcavesimple, rootjungle, skymeadow", "What stages the boss will show up on. Add a '- loop' after the stagename to make it only spawn after looping. List of stage names can be found at https://github.com/risk-of-thunder/R2Wiki/wiki/Mod-Creation_Developer-Reference_Scene-Names"); string text = new string((from c in configEntry.Value.ToCharArray() where !char.IsWhiteSpace(c) select c).ToArray()); string[] array = text.Split(','); string[] array2 = array; foreach (string text2 in array2) { string[] array3 = text2.Split('-'); string stageName = array3[0]; int minStages = 0; if (array3.Length > 1) { minStages = 5; } StageList.Add(new StageSpawnInfo(stageName, minStages)); } } } public class CharacterDamageTypes { public static void Init() { } } internal class CharacterDots { } public class CharacterItemDisplays : BaseItemDisplaysSetup { protected override void SetItemDisplayRules(List itemDisplayRules) { //IL_0037: 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_005f: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_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_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_032f: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Unknown result type (might be due to invalid IL or missing references) //IL_0393: Unknown result type (might be due to invalid IL or missing references) //IL_03a7: Unknown result type (might be due to invalid IL or missing references) //IL_03ac: Unknown result type (might be due to invalid IL or missing references) //IL_03b1: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Unknown result type (might be due to invalid IL or missing references) //IL_03f7: Unknown result type (might be due to invalid IL or missing references) //IL_040b: Unknown result type (might be due to invalid IL or missing references) //IL_041f: Unknown result type (might be due to invalid IL or missing references) //IL_0424: Unknown result type (might be due to invalid IL or missing references) //IL_0429: Unknown result type (might be due to invalid IL or missing references) //IL_042e: Unknown result type (might be due to invalid IL or missing references) //IL_046f: Unknown result type (might be due to invalid IL or missing references) //IL_0483: Unknown result type (might be due to invalid IL or missing references) //IL_0497: Unknown result type (might be due to invalid IL or missing references) //IL_049c: Unknown result type (might be due to invalid IL or missing references) //IL_04a1: Unknown result type (might be due to invalid IL or missing references) //IL_04a6: Unknown result type (might be due to invalid IL or missing references) //IL_04e7: Unknown result type (might be due to invalid IL or missing references) //IL_04fb: Unknown result type (might be due to invalid IL or missing references) //IL_050f: Unknown result type (might be due to invalid IL or missing references) //IL_0514: Unknown result type (might be due to invalid IL or missing references) //IL_0519: Unknown result type (might be due to invalid IL or missing references) //IL_051e: Unknown result type (might be due to invalid IL or missing references) //IL_055f: Unknown result type (might be due to invalid IL or missing references) //IL_0573: Unknown result type (might be due to invalid IL or missing references) //IL_0587: Unknown result type (might be due to invalid IL or missing references) //IL_058c: Unknown result type (might be due to invalid IL or missing references) //IL_0591: Unknown result type (might be due to invalid IL or missing references) //IL_0599: Unknown result type (might be due to invalid IL or missing references) //IL_059e: Unknown result type (might be due to invalid IL or missing references) //IL_05a3: Unknown result type (might be due to invalid IL or missing references) //IL_05e4: Unknown result type (might be due to invalid IL or missing references) //IL_05f8: Unknown result type (might be due to invalid IL or missing references) //IL_060c: Unknown result type (might be due to invalid IL or missing references) //IL_0611: Unknown result type (might be due to invalid IL or missing references) //IL_0616: Unknown result type (might be due to invalid IL or missing references) //IL_061b: Unknown result type (might be due to invalid IL or missing references) //IL_065c: Unknown result type (might be due to invalid IL or missing references) //IL_0670: Unknown result type (might be due to invalid IL or missing references) //IL_0684: Unknown result type (might be due to invalid IL or missing references) //IL_0689: Unknown result type (might be due to invalid IL or missing references) //IL_068e: Unknown result type (might be due to invalid IL or missing references) //IL_0693: Unknown result type (might be due to invalid IL or missing references) //IL_06d4: Unknown result type (might be due to invalid IL or missing references) //IL_06e8: Unknown result type (might be due to invalid IL or missing references) //IL_06fc: Unknown result type (might be due to invalid IL or missing references) //IL_0701: Unknown result type (might be due to invalid IL or missing references) //IL_0706: Unknown result type (might be due to invalid IL or missing references) //IL_070b: Unknown result type (might be due to invalid IL or missing references) //IL_074c: Unknown result type (might be due to invalid IL or missing references) //IL_0760: Unknown result type (might be due to invalid IL or missing references) //IL_0774: Unknown result type (might be due to invalid IL or missing references) //IL_0779: Unknown result type (might be due to invalid IL or missing references) //IL_077e: Unknown result type (might be due to invalid IL or missing references) //IL_0786: Unknown result type (might be due to invalid IL or missing references) //IL_078b: Unknown result type (might be due to invalid IL or missing references) //IL_0790: Unknown result type (might be due to invalid IL or missing references) //IL_07d1: Unknown result type (might be due to invalid IL or missing references) //IL_07e5: Unknown result type (might be due to invalid IL or missing references) //IL_07f9: Unknown result type (might be due to invalid IL or missing references) //IL_07fe: Unknown result type (might be due to invalid IL or missing references) //IL_0803: Unknown result type (might be due to invalid IL or missing references) //IL_0808: Unknown result type (might be due to invalid IL or missing references) itemDisplayRules.Add(ItemDisplays.CreateDisplayRuleGroupWithRules(ItemDisplays.KeyAssets["AlienHead"], ItemDisplays.CreateDisplayRule(ItemDisplays.LoadDisplay("DisplayAlienHead"), "Pelvis", new Vector3(0.29877f, -0.01725f, 0.03652f), new Vector3(67.75285f, 214.7422f, 273.8387f), new Vector3(1.25268f, 1.25268f, 1.25268f)))); itemDisplayRules.Add(ItemDisplays.CreateDisplayRuleGroupWithRules(ItemDisplays.KeyAssets["Bandolier"], ItemDisplays.CreateDisplayRule(ItemDisplays.LoadDisplay("DisplayBandolier"), "Chest", new Vector3(0.00382f, 0.20634f, -0.03476f), new Vector3(315.4701f, 81.7493f, 270.5959f), new Vector3(1.1096f, 1.1096f, 1.1096f)))); itemDisplayRules.Add(ItemDisplays.CreateDisplayRuleGroupWithRules(ItemDisplays.KeyAssets["ChainLightning"], ItemDisplays.CreateDisplayRule(ItemDisplays.LoadDisplay("DisplayUkulele"), "HandL", new Vector3(0.0705f, 0.06266f, -0.51638f), new Vector3(358.0011f, 73.26026f, 78.82687f), new Vector3(1f, 1f, 1f)))); itemDisplayRules.Add(ItemDisplays.CreateDisplayRuleGroupWithRules(ItemDisplays.KeyAssets["ChainLightningVoid"], ItemDisplays.CreateDisplayRule(ItemDisplays.LoadDisplay("DisplayUkuleleVoid"), "HandL", new Vector3(0.0705f, 0.06266f, -0.51638f), new Vector3(358.0011f, 73.26026f, 78.82687f), new Vector3(1f, 1f, 1f)))); itemDisplayRules.Add(ItemDisplays.CreateDisplayRuleGroupWithRules(ItemDisplays.KeyAssets["CritGlasses"], ItemDisplays.CreateDisplayRule(ItemDisplays.LoadDisplay("DisplayGlasses"), "Head", new Vector3(1E-05f, 0.22394f, 0.24897f), new Vector3(0f, 0f, 0f), new Vector3(0.39009f, 0.40062f, 0.38988f)))); itemDisplayRules.Add(ItemDisplays.CreateDisplayRuleGroupWithRules(ItemDisplays.KeyAssets["CritGlassesVoid"], ItemDisplays.CreateDisplayRule(ItemDisplays.LoadDisplay("DisplayGlassesVoid"), "Head", new Vector3(1E-05f, 0.22394f, 0.24897f), new Vector3(0f, 0f, 0f), new Vector3(0.39009f, 0.40062f, 0.38988f)))); itemDisplayRules.Add(ItemDisplays.CreateDisplayRuleGroupWithRules(ItemDisplays.KeyAssets["Crowbar"], ItemDisplays.CreateDisplayRule(ItemDisplays.LoadDisplay("DisplayCrowbar"), "Chest", new Vector3(-0.32618f, 0.40953f, -0.32192f), new Vector3(0.59728f, 172.7229f, 318.5467f), new Vector3(0.60761f, 0.60761f, 0.60761f)))); itemDisplayRules.Add(ItemDisplays.CreateDisplayRuleGroupWithRules(ItemDisplays.KeyAssets["ExtraLife"], ItemDisplays.CreateDisplayRule(ItemDisplays.LoadDisplay("DisplayHippo"), "Chest", new Vector3(0.03631f, 0.6646f, -0.22149f), new Vector3(0f, 172.5211f, 0f), new Vector3(0.41958f, 0.41958f, 0.41958f)))); itemDisplayRules.Add(ItemDisplays.CreateDisplayRuleGroupWithRules(ItemDisplays.KeyAssets["ExtraLifeVoid"], ItemDisplays.CreateDisplayRule(ItemDisplays.LoadDisplay("DisplayHippoVoid"), "Chest", new Vector3(0.03631f, 0.6646f, -0.22149f), new Vector3(0f, 172.5211f, 0f), new Vector3(0.41958f, 0.41958f, 0.41958f)))); itemDisplayRules.Add(ItemDisplays.CreateDisplayRuleGroupWithRules(ItemDisplays.KeyAssets["Mushroom"], ItemDisplays.CreateDisplayRule(ItemDisplays.LoadDisplay("DisplayMushroom"), "ThighR", new Vector3(0f, 0.71713f, -0.09652f), new Vector3(270.9421f, 180f, 180f), new Vector3(0.13509f, 0.13509f, 0.13509f)))); itemDisplayRules.Add(ItemDisplays.CreateDisplayRuleGroupWithRules(ItemDisplays.KeyAssets["MushroomVoid"], ItemDisplays.CreateDisplayRule(ItemDisplays.LoadDisplay("DisplayMushroomVoid"), "ThighR", new Vector3(0f, 0.71713f, -0.09652f), new Vector3(270.9421f, 180f, 180f), new Vector3(0.13509f, 0.13509f, 0.13509f)))); itemDisplayRules.Add(ItemDisplays.CreateDisplayRuleGroupWithRules(ItemDisplays.KeyAssets["Hoof"], ItemDisplays.CreateDisplayRule(ItemDisplays.LoadDisplay("DisplayHoof"), "CalfR", new Vector3(0.04954f, 0.55529f, -0.08189f), new Vector3(78.49638f, 322.1032f, 354.914f), new Vector3(0.13054f, 0.13054f, 0.13054f)), ItemDisplays.CreateLimbMaskDisplayRule((LimbFlags)8))); itemDisplayRules.Add(ItemDisplays.CreateDisplayRuleGroupWithRules(ItemDisplays.KeyAssets["IgniteOnKill"], ItemDisplays.CreateDisplayRule(ItemDisplays.LoadDisplay("DisplayGasoline"), "ThighL", new Vector3(-0.13382f, 0.55736f, -0.08276f), new Vector3(88.84649f, 162.7168f, 354.1212f), new Vector3(0.74054f, 0.74054f, 0.74054f)))); itemDisplayRules.Add(ItemDisplays.CreateDisplayRuleGroupWithRules(ItemDisplays.KeyAssets["IceRing"], ItemDisplays.CreateDisplayRule(ItemDisplays.LoadDisplay("DisplayIceRing"), "sword_handle", new Vector3(8E-05f, 0.29497f, 0.00055f), new Vector3(271.5363f, 0f, 0f), new Vector3(1f, 1f, 1f)))); itemDisplayRules.Add(ItemDisplays.CreateDisplayRuleGroupWithRules(ItemDisplays.KeyAssets["FireRing"], ItemDisplays.CreateDisplayRule(ItemDisplays.LoadDisplay("DisplayFireRing"), "staff", new Vector3(8E-05f, 0.29497f, 0.00055f), new Vector3(271.5363f, 0f, 0f), new Vector3(1f, 1f, 1f)))); itemDisplayRules.Add(ItemDisplays.CreateDisplayRuleGroupWithRules(ItemDisplays.KeyAssets["Lightning"], ItemDisplays.CreateDisplayRule(ItemDisplays.LoadDisplay("DisplayLightningArmRight"), "Chest", new Vector3(2f, 2f, 2f), new Vector3(0f, 0f, 0f), new Vector3(1f, 1f, 1f)), ItemDisplays.CreateLimbMaskDisplayRule((LimbFlags)2))); itemDisplayRules.Add(ItemDisplays.CreateDisplayRuleGroupWithRules(ItemDisplays.KeyAssets["Thorns"], ItemDisplays.CreateDisplayRule(ItemDisplays.LoadDisplay("DisplayRazorwireLeft"), "Chest", new Vector3(2f, 2f, 2f), new Vector3(0f, 0f, 0f), new Vector3(1f, 1f, 1f)))); } } public static class CharacterStates { public static void Init() { } } public static class CharacterTokens { public static void Init() { AddHenryTokens(); } public static void AddHenryTokens() { string text = "HABIBI_GORP_"; string text2 = "." + Environment.NewLine + Environment.NewLine + "< ! > ." + Environment.NewLine + Environment.NewLine + "< ! > ." + Environment.NewLine + Environment.NewLine + "< ! > ." + Environment.NewLine + Environment.NewLine + "< ! > ." + Environment.NewLine + Environment.NewLine; Language.Add(text + "NAME", "Gorp"); Language.Add(text + "DESCRIPTION", text2); Language.Add(text + "SUBTITLE", "End of the Slime"); Language.Add(text + "LORE", "Big."); Language.Add(text + "OUTRO_FLAVOR", "..and so it left, ."); Language.Add(text + "OUTRO_FAILURE", "..and so it vanished, ."); } } } namespace GorpMod.Characters.Enemies.Gorp { internal class GorpCharacter { public AssetBundle assetBundle; public GameObject BodyPrefab; public CharacterBody PrefabBody; public GameObject MasterPrefab; public static GameObject BossEncounter; public static SpawnCard SpawnCard; public const string TOKEN_PREFIX = "HABIBI_GORP_"; public static List gupNames = new List { "GorpBody", "GupBody", "GeepBody", "GipBody" }; public void Initialize() { new CharacterConfig().Init(); CharacterTokens.Init(); CharacterAssets.Init(); Asset.LoadAssetBundleAsync("boosgorpbundle", delegate(AssetBundle loadedAssetBundle) { assetBundle = loadedAssetBundle; OnBundleLoaded(); }); } private void OnBundleLoaded() { CharacterBuffs.Init(assetBundle); Asset.LoadAssetAsync("RoR2/DLC1/Gup/GupBody.prefab", (Action)delegate(GameObject gupPrefab) { OnGupLoaded(gupPrefab); Asset.LoadAssetAsync("RoR2/DLC1/Gup/GupMaster.prefab", (Action)delegate(GameObject gupMaster) { OnGupMasterLoaded(gupMaster); CreateSpawnCard(); CreateBossEncounter(); }); }); } private void OnGupLoaded(GameObject gupPrefab) { //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Expected O, but got Unknown //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) BodyPrefab = PrefabAPI.InstantiateClone(gupPrefab, "GorpBody", true); PrefabBody = BodyPrefab.GetComponent(); PrefabBody.baseNameToken = "HABIBI_GORP_NAME"; PrefabBody.subtitleNameToken = "HABIBI_GORP_SUBTITLE"; PrefabBody.portraitIcon = assetBundle.LoadAsset("texIconGorp"); PrefabBody.baseMaxHealth = 2500f; PrefabBody.baseMoveSpeed = 8f; PrefabBody.PerformAutoCalculateLevelStats(); PrefabBody.isChampion = true; PrefabBody.hullClassification = (HullClassification)2; Config.ConfigureBody(PrefabBody, "Body"); BodyPrefab.AddComponent(); BodyPrefab.AddComponent(); BodyPrefab.GetComponent().deathState = new SerializableEntityStateType(typeof(GorpSplitDeath)); BodyPrefab.GetComponent().canBeHitStunned = false; Asset.LoadAssetAsync(RoR2_Base_Common.ccpStandardHuge_asset, (Action)delegate(CharacterCameraParams loaded) { BodyPrefab.GetComponent().cameraParams = loaded; }); BodyPrefab.transform.Find("ModelBase/mdlGup").localScale = Vector3.one; ((Component)BodyPrefab.transform.Find("ModelBase/mdlGup/mdlGupArmature/ROOT/mainBody.1/mainBody.2/mainBody.3/mainBody.4/Ear.L")).gameObject.AddComponent(); ((Component)BodyPrefab.transform.Find("ModelBase/mdlGup/mdlGupArmature/ROOT/mainBody.1/mainBody.2/mainBody.3/mainBody.4/Ear.R")).gameObject.AddComponent(); Transform val = BodyPrefab.transform.Find("ModelBase/mdlGup/mdlGupArmature/ROOT/mainBody.1/StandableSurfacePosition"); ((Component)val).transform.localScale = new Vector3(0.8742901f, 0.8742901f, 0.5442675f); ((Component)val).transform.localPosition = new Vector3(0f, 0.54f, 0f); BodyPrefab.GetComponentInChildren().hitBoxes[0] = BodyPrefab.GetComponentInChildren().hitBoxes[1]; ((Component)BodyPrefab.GetComponentInChildren().hitBoxes[1]).transform.localScale = new Vector3(4f, 2.5f, 1.5f); ((Component)BodyPrefab.GetComponentInChildren().hitBoxes[2]).transform.localScale = new Vector3(2.5f, 4f, 1.5f); GameObject val2 = new GameObject("MortarMuzzle"); val2.transform.parent = BodyPrefab.transform.Find("ModelBase/mdlGup/mdlGupArmature"); val2.transform.localPosition = new Vector3(0f, 0f, 1.3f); ChildLocator componentInChildren = BodyPrefab.GetComponentInChildren(true); componentInChildren.transformPairs = componentInChildren.transformPairs.Append(new NameTransformPair { name = "MortarMuzzle", transform = val2.transform }).ToArray(); Content.AddCharacterBodyPrefab(BodyPrefab); DoHooks(); DoSkin(); DoSkill(); } private void DoHooks() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPI_GetStatCoefficients1); } private void RecalculateStatsAPI_GetStatCoefficients1(CharacterBody sender, StatHookEventArgs args) { int buffCount = sender.GetBuffCount(CharacterBuffs.GorpThresholdBuff); float num = (float)buffCount / (float)(int)CharacterConfig.HealthThresholds; if (buffCount > 0) { args.baseMoveSpeedAdd += Mathf.Lerp((float)CharacterConfig.AdditionalMoveSpeed_MinHealth, 0f, num); } } private void DoSkill() { //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_0330: Unknown result type (might be due to invalid IL or missing references) Content.AddEntityState(typeof(GorpSpikeAttack)); Content.AddEntityState(typeof(GorpBoundAttack)); Content.AddEntityState(typeof(GorpMortarAttack)); Content.AddEntityState(typeof(GorpSplitDeath)); Asset.LoadAssetAsync(RoR2_DLC1_Gup.EntityStates_Gup_GupSpikesState_asset, (Action)delegate(EntityStateConfiguration GupSpikeStateESC) { //IL_0014: 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) EntityStateConfiguration val4 = assetBundle.LoadAsset("escGorpSpike"); val4.serializedFieldsCollection = GupSpikeStateESC.serializedFieldsCollection; val4.targetType.assemblyQualifiedName = typeof(GorpSpikeAttack).AssemblyQualifiedName; for (int i = 0; i < val4.serializedFieldsCollection.serializedFields.Length; i++) { if (val4.serializedFieldsCollection.serializedFields[i].fieldName == "damageCoefficient") { val4.serializedFieldsCollection.serializedFields[i].fieldValue.stringValue = CharacterConfig.SpikeStateDamage.Value.ToString(); } } Content.AddEntityStateConfiguration(val4); }); Skills.ClearGenericSkills(BodyPrefab); Skills.CreateSkillFamilies(BodyPrefab, default(SkillSlot)); SkillDef val = ScriptableObject.CreateInstance(); ((Object)val).name = "GorpAttack1"; val.skillNameToken = "GorpAttack1"; val.skillDescriptionToken = ""; val.icon = null; val.activationStateMachineName = "Body"; val.activationState = new SerializableEntityStateType(typeof(GorpSpikeAttack)); val.baseRechargeInterval = 5f; val.baseMaxStock = 1; val.rechargeStock = 1; val.requiredStock = 1; val.stockToConsume = 1; val.attackSpeedBuffsRestockSpeed = true; val.attackSpeedBuffsRestockSpeed_Multiplier = 2f; val.resetCooldownTimerOnUse = false; val.fullRestockOnAssign = true; val.dontAllowPastMaxStocks = false; val.beginSkillCooldownOnSkillEnd = true; val.isCooldownBlockedUntilManuallyReset = false; val.cancelSprintingOnActivation = true; val.forceSprintDuringState = false; val.canceledFromSprinting = false; val.isCombatSkill = true; val.mustKeyPress = false; val.triggeredByPressRelease = false; val.autoHandleLuminousShot = true; val.suppressSkillActivation = false; val.hideStockCount = false; val.hideCooldown = false; Config.ConfigureSkillDef(val, "Skills", "Spike Attack"); Content.AddSkillDef(val); Skills.AddPrimarySkills(BodyPrefab, val); Skills.CreateSkillFamilies(BodyPrefab, (SkillSlot)1); SkillDef val2 = ScriptableObject.CreateInstance(); ((Object)val2).name = "GorpAttack2"; val2.skillNameToken = "GorpAttack2"; val2.skillDescriptionToken = ""; val2.icon = null; val2.activationStateMachineName = "Body"; val2.activationState = new SerializableEntityStateType(typeof(GorpMortarAttack)); val2.baseRechargeInterval = 20f; val2.baseMaxStock = 1; val2.rechargeStock = 1; val2.requiredStock = 1; val2.stockToConsume = 1; val2.attackSpeedBuffsRestockSpeed = true; val2.attackSpeedBuffsRestockSpeed_Multiplier = 2f; val2.resetCooldownTimerOnUse = false; val2.fullRestockOnAssign = true; val2.dontAllowPastMaxStocks = false; val2.beginSkillCooldownOnSkillEnd = true; val2.isCooldownBlockedUntilManuallyReset = false; val2.cancelSprintingOnActivation = true; val2.forceSprintDuringState = false; val2.canceledFromSprinting = false; val2.isCombatSkill = true; val2.mustKeyPress = false; val2.triggeredByPressRelease = false; val2.autoHandleLuminousShot = true; val2.suppressSkillActivation = false; val2.hideStockCount = false; val2.hideCooldown = false; Config.ConfigureSkillDef(val2, "Skills", "Mortar Skill"); Content.AddSkillDef(val2); Skills.AddSecondarySkills(BodyPrefab, val2); Skills.CreateSkillFamilies(BodyPrefab, (SkillSlot)2); SkillDef val3 = ScriptableObject.CreateInstance(); ((Object)val3).name = "GorpAttack3"; val3.skillNameToken = "GorpAttack3"; val3.skillDescriptionToken = ""; val3.icon = null; val3.activationStateMachineName = "Body"; val3.activationState = new SerializableEntityStateType(typeof(GorpBoundAttack)); val3.baseRechargeInterval = 10f; val3.baseMaxStock = 1; val3.rechargeStock = 1; val3.requiredStock = 1; val3.stockToConsume = 1; val3.attackSpeedBuffsRestockSpeed = true; val3.attackSpeedBuffsRestockSpeed_Multiplier = 2f; val3.resetCooldownTimerOnUse = false; val3.fullRestockOnAssign = true; val3.dontAllowPastMaxStocks = false; val3.beginSkillCooldownOnSkillEnd = true; val3.isCooldownBlockedUntilManuallyReset = false; val3.cancelSprintingOnActivation = true; val3.forceSprintDuringState = false; val3.canceledFromSprinting = false; val3.isCombatSkill = true; val3.mustKeyPress = false; val3.triggeredByPressRelease = false; val3.autoHandleLuminousShot = true; val3.suppressSkillActivation = false; val3.hideStockCount = false; val3.hideCooldown = false; Config.ConfigureSkillDef(val3, "Debug", "Bound Skill"); Content.AddSkillDef(val3); Skills.AddUtilitySkills(BodyPrefab, val3); } private void DoSkin() { ModelSkinController modelSkinController = BodyPrefab.GetComponentInChildren(); SkinDef origSkin = modelSkinController.skins[0]; Asset.LoadAssetAsync(((AssetReference)origSkin.skinDefParamsAddress).AssetGUID, (Action)delegate(SkinDefParams origSkindefParams) { modelSkinController.skins[0] = Object.Instantiate(origSkin); modelSkinController.skins[0].skinDefParamsAddress = new AssetReferenceT(""); modelSkinController.skins[0].skinDefParams = Object.Instantiate(origSkindefParams); Asset.LoadAssetAsync(((AssetReference)modelSkinController.skins[0].skinDefParams.rendererInfos[0].defaultMaterialAddress).AssetGUID, (Action)delegate(Material origMat) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown modelSkinController.skins[0].skinDefParams.rendererInfos[0].defaultMaterial = new Material(origMat); modelSkinController.skins[0].skinDefParams.rendererInfos[0].defaultMaterial.SetTexture("_MainTex", (Texture)(object)assetBundle.LoadAsset("texGorp")); modelSkinController.skins[0].skinDefParams.rendererInfos[0].defaultMaterialAddress = new AssetReferenceT(""); modelSkinController.skins[0].skinDefParams.rendererInfos[1].defaultMaterial = modelSkinController.skins[0].skinDefParams.rendererInfos[0].defaultMaterial; modelSkinController.skins[0].skinDefParams.rendererInfos[1].defaultMaterialAddress = new AssetReferenceT(""); }); }); } private void OnGupMasterLoaded(GameObject gupMaster) { //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) MasterPrefab = PrefabAPI.InstantiateClone(gupMaster, "GorpMaster", true); MasterPrefab.GetComponent().bodyPrefab = BodyPrefab; MasterPrefab.GetComponent().minDistance = 0f; MasterPrefab.GetComponent().maxDistance = 30f; Object.Destroy((Object)(object)MasterPrefab.GetComponents()[1]); AISkillDriver val = MasterPrefab.AddComponent(); val.customName = "Use Secondary Shoot"; val.skillSlot = (SkillSlot)1; val.requireSkillReady = true; val.minDistance = 0f; val.maxDistance = 160f; val.minUserHealthFraction = 0.3f; val.maxUserHealthFraction = 0.9f; val.selectionRequiresTargetLoS = false; val.selectionRequiresOnGround = false; val.selectionRequiresAimTarget = true; val.maxTimesSelected = -1; val.moveTargetType = (TargetType)0; val.activationRequiresTargetLoS = false; val.activationRequiresAimTargetLoS = false; val.activationRequiresAimConfirmation = true; val.movementType = (MovementType)0; val.moveInputScale = 1f; val.aimType = (AimType)1; val.buttonPressType = (ButtonPressType)0; AISkillDriver val2 = MasterPrefab.AddComponent(); val2.customName = "Chase"; val2.skillSlot = (SkillSlot)(-1); val2.requireSkillReady = true; val2.minDistance = 0f; val2.maxDistance = float.PositiveInfinity; val2.selectionRequiresTargetLoS = false; val2.selectionRequiresOnGround = false; val2.selectionRequiresAimTarget = false; val2.maxTimesSelected = -1; val2.moveTargetType = (TargetType)0; val2.activationRequiresTargetLoS = false; val2.activationRequiresAimTargetLoS = false; val2.activationRequiresAimConfirmation = false; val2.movementType = (MovementType)1; val2.moveInputScale = 1f; val2.aimType = (AimType)1; val2.buttonPressType = (ButtonPressType)0; Content.AddMasterPrefab(MasterPrefab); } private void CreateSpawnCard() { //IL_003c: 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) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Expected O, but got Unknown //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Expected O, but got Unknown //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Expected O, but got Unknown //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Expected O, but got Unknown //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) SpawnCard = (SpawnCard)(object)ScriptableObject.CreateInstance(); ((Object)SpawnCard).name = "cscGorp"; SpawnCard.prefab = MasterPrefab; SpawnCard.sendOverNetwork = true; SpawnCard.hullSize = (HullClassification)2; SpawnCard.directorCreditCost = CharacterConfig.spawnCost; SpawnCard spawnCard = SpawnCard; spawnCard.forbiddenFlags = (NodeFlags)(spawnCard.forbiddenFlags | 4); DirectorCard val = new DirectorCard { spawnCard = SpawnCard, selectionWeight = 1, preventOverhead = false, minimumStageCompletions = CharacterConfig.minimumStageCount, spawnDistance = (MonsterSpawnDistance)0 }; DirectorCardHolder val2 = new DirectorCardHolder { Card = val, MonsterCategory = (MonsterCategory)4 }; DirectorCard card = new DirectorCard { spawnCard = SpawnCard, selectionWeight = 1, preventOverhead = false, minimumStageCompletions = 5, spawnDistance = (MonsterSpawnDistance)0 }; DirectorCardHolder val3 = new DirectorCardHolder { Card = card, MonsterCategory = (MonsterCategory)4 }; DirectorCardCategorySelection val4 = Addressables.LoadAssetAsync((object)"RoR2/Base/MixEnemy/dccsMixEnemy.asset").WaitForCompletion(); val4.AddCard(0, val); foreach (CharacterConfig.StageSpawnInfo stage in CharacterConfig.StageList) { DirectorCardHolder val5 = ((stage.GetMinStages() == 0) ? val2 : val3); Log.Warning("adding to stage " + ((object)DirectorAPI.ParseInternalStageName(stage.GetStageName())/*cast due to .constrained prefix*/).ToString()); Helpers.AddNewMonsterToStage(val5, false, DirectorAPI.ParseInternalStageName(stage.GetStageName()), stage.GetStageName()); } } private void CreateBossEncounter() { //IL_0035: 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_0054: Unknown result type (might be due to invalid IL or missing references) BossEncounter = assetBundle.LoadAsset("GorpBossEncounter"); PrefabAPI.RegisterNetworkPrefab(BossEncounter); BossEncounter.GetComponent().spawns = (SpawnInfo[])(object)new SpawnInfo[1] { new SpawnInfo { spawnCard = SpawnCard, cullChance = 0f } }; Content.AddNetworkedObject(BossEncounter); } public static bool IsGup(CharacterBody characterBody) { //IL_0007: 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) for (int i = 0; i < gupNames.Count; i++) { if (characterBody.bodyIndex == BodyCatalog.FindBodyIndex(gupNames[i])) { return true; } } return false; } } } namespace GorpMod.Characters.Enemies.Gorp.States { public class GorpBoundAttack : GorpMortarAttack { protected override int firings => 1; protected override void FireProjectile() { //IL_0007: 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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00be: 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) Vector3 val = trackedTarget.position - ((EntityState)this).transform.position; val.y = 0f; float magnitude = ((Vector3)(ref val)).magnitude; float num = Mathf.Max(GorpMortarAttack.minimumTime, magnitude / (float)CharacterConfig.Bound_HorizontalSpeedMultiplier); Vector3 position = default(Vector3); if (!getTargetComponent.GetPredictionPosition(num * (float)CharacterConfig.Bound_predictionTime, ref position)) { position = trackedTarget.position; } Vector3 velocity = Trajectory.CalculateInitialVelocityFromTime(((EntityState)this).transform.position, position, num, Physics.gravity.y, DenialProjectile.minimumDistance, DenialProjectile.maximumDistance); ((BaseCharacterController)((EntityState)this).characterMotor).Motor.ForceUnground(0.1f); ((EntityState)this).characterMotor.velocity = velocity; } } public class GorpMortarAttack : BaseSkillState { protected float duration; protected Transform trackedTarget; private Transform muzzleTransform; protected TargetingAndPredictionController getTargetComponent; private int fired = 0; public static float baseDuration => CharacterConfig.Mortar_baseDuration; public static float minimumTime => CharacterConfig.Mortar_minimumTime; public static float projectileHorizontalSpeed => CharacterConfig.Mortar_projectileHorizontalSpeed; public static float animationTimeMulti => CharacterConfig.Mortar_animationTimeMulti; protected virtual int firings => 3; public override void OnEnter() { ((BaseState)this).OnEnter(); getTargetComponent = ((EntityState)this).GetComponent(); duration = baseDuration / ((BaseState)this).attackSpeedStat; if (Object.op_Implicit((Object)(object)getTargetComponent) && ((EntityState)this).isAuthority) { trackedTarget = getTargetComponent.StartPredictTarget((Action)OnTargetLost); } muzzleTransform = ((BaseState)this).FindModelChild("MortarMuzzle"); PlayTheOneAnimationWeGot(); } private void PlayTheOneAnimationWeGot() { ((EntityState)this).PlayAnimation("Body", "SpikeAttack", "SpikeAttack.playbackRate", duration * animationTimeMulti, 0f); } private void OnTargetLost() { trackedTarget = null; if (((EntityState)this).isAuthority) { ((EntityState)this).outer.SetNextStateToMain(); } } public override void FixedUpdate() { ((EntityState)this).FixedUpdate(); if (!Object.op_Implicit((Object)(object)trackedTarget) && ((EntityState)this).isAuthority) { ((EntityState)this).outer.SetNextStateToMain(); } else if (((EntityState)this).fixedAge >= duration) { if (fired < firings) { fired++; ((EntityState)this).fixedAge = 0f; FireProjectile(); } else if (((EntityState)this).isAuthority) { ((EntityState)this).outer.SetNextStateToMain(); } } } protected virtual void FireProjectile() { //IL_002d: 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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0044: 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_004e: 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) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008a: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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_00be: Expected O, but got Unknown if (Object.op_Implicit((Object)(object)trackedTarget)) { PlayTheOneAnimationWeGot(); if (NetworkServer.active) { MasterSummon val = new MasterSummon { masterPrefab = CharacterAssets.GipMaster, position = muzzleTransform.position, rotation = ((EntityState)this).transform.rotation, summonerBodyObject = null, teamIndexOverride = ((EntityState)this).teamComponent.teamIndex, ignoreTeamMemberLimit = true, propogateMinionOwnership = false, loadout = null, inventoryToCopy = null, inventoryItemCopyFilter = Inventory.defaultItemCopyFilterDelegate, inventorySetupCallback = null, preSpawnSetupCallback = null, useAmbientLevel = true }; CharacterMaster val2 = val.Perform(); val2.onBodyStart += CharacterMaster_onBodyStart; } } } private void CharacterMaster_onBodyStart(CharacterBody spawnedBody) { //IL_0007: 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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_008f: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: 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_00d2: 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_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0121: 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_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Expected O, but got Unknown Vector3 val = trackedTarget.position - muzzleTransform.position; val.y = 0f; float magnitude = ((Vector3)(ref val)).magnitude; float num = Mathf.Max(minimumTime, magnitude / projectileHorizontalSpeed); Vector3 position = default(Vector3); if (!getTargetComponent.GetPredictionPosition(num, ref position)) { position = trackedTarget.position; } Vector3 val2 = Trajectory.CalculateInitialVelocityFromTime(((EntityState)this).transform.position, position, num, Physics.gravity.y * 2.2f, DenialProjectile.minimumDistance, DenialProjectile.maximumDistance); FireProjectileInfo val3 = new FireProjectileInfo { projectilePrefab = EntityStateGameObject.op_Implicit(DeathState.throwPrefab), owner = ((EntityState)this).gameObject, position = muzzleTransform.position, rotation = Util.QuaternionSafeLookRotation(((Vector3)(ref val2)).normalized), damage = DenialProjectile.damageCoefficient * ((BaseState)this).damageStat, crit = ((BaseState)this).RollCrit() }; ((FireProjectileInfo)(ref val3)).speedOverride = ((Vector3)(ref val2)).magnitude; val3.useSpeedOverride = true; FireProjectileInfo val4 = val3; ThrownObjectProjectileController component = ProjectileManager.instance.FireProjectileImmediateServer(val4, (NetworkConnection)null, (ushort)0, 0.0).GetComponent(); if ((Object)(object)component != (Object)null) { component.SetPassengerServer(((Component)spawnedBody).gameObject); } if (!((Object)(object)component == (Object)null)) { component.DisableCollision(0.1f); DamageInfo val5 = new DamageInfo { damage = spawnedBody.healthComponent.health }; ((EntityState)this).healthComponent.TakeDamage(val5); } } } public class GorpSpikeAttack : GupSpikesState { private int repeats = CharacterConfig.SpikeStateRepeats; public override void OnEnter() { ((GupSpikesState)this).OnEnter(); } public override void FixedUpdate() { ((GupSpikesState)this).FixedUpdate(); if (repeats > 0 && ((EntityState)this).fixedAge > (float)CharacterConfig.SpikeStateRepeatInterval) { ((EntityState)this).fixedAge = 0f; repeats--; ((BasicMeleeAttack)this).PlayAnimation(); } } } public class GorpSplitDeath : BaseSplitDeath { public override void OnEnter() { base.characterSpawnCard = CharacterAssets.GipSpawnCard; base.spawnCount = CharacterConfig.DeathGips; base.deathDelay = 0.1f; base.moneyMultiplier = 0f; ((BaseSplitDeath)this).OnEnter(); } } } namespace GorpMod.Characters.Enemies.Gorp.Comopnents { public class FunnyScale : MonoBehaviour { private void LateUpdate() { //IL_0007: 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) ((Component)this).transform.localScale = Vector3.one * (float)CharacterConfig.EarScale; } } public class GorpController : NetworkBehaviour, IOnTakeDamageServerReceiver { private Transform _armatureTransform; private CharacterBody _body; private int currentThreshold; private float _monchTimer; private float startHealth; private static int kRpcRpcUpdateScale; private int Thresholds => CharacterConfig.HealthThresholds; private float monchInterval => CharacterConfig.MonchInterval; private float currentHealthFraction => _body.healthComponent.combinedHealth / startHealth; private void Start() { _armatureTransform = ((Component)this).GetComponent().modelTransform.Find("mdlGupArmature"); _body = ((Component)this).GetComponent(); startHealth = _body.healthComponent.fullCombinedHealth; if (NetworkServer.active) { HealthComponent.onCharacterHealServer += HealthComponent_onCharacterHealServer; CheckCurrentHealthThresholdServer(); } UpdateScaleInternal(Thresholds - 1); } private void OnDestroy() { HealthComponent.onCharacterHealServer -= HealthComponent_onCharacterHealServer; } private void HealthComponent_onCharacterHealServer(HealthComponent arg1, float arg2, ProcChainMask arg3) { if (!((Object)(object)arg1 != (Object)(object)_body.healthComponent)) { CheckCurrentHealthThresholdServer(); CallRpcUpdateScale(currentThreshold); } } public void OnTakeDamageServer(DamageReport damageReport) { CheckCurrentHealthThresholdServer(); CallRpcUpdateScale(currentThreshold); } private void CheckCurrentHealthThresholdServer() { float num = currentThreshold; while (currentHealthFraction > (float)(currentThreshold + 1) / (float)Thresholds) { currentThreshold++; } while (currentHealthFraction < (float)currentThreshold / (float)Thresholds) { currentThreshold--; } if ((float)currentThreshold != num && NetworkServer.active) { UpdateThresholdServer(); } } private void UpdateThresholdServer() { Log.Warning("reached threshold " + currentThreshold); int num = _body.GetBuffCount(CharacterBuffs.GorpThresholdBuff); while (num < currentThreshold) { num++; _body.AddBuff(CharacterBuffs.GorpThresholdBuff); } while (num > currentThreshold) { num--; _body.RemoveBuff(CharacterBuffs.GorpThresholdBuff); } } [ClientRpc] private void RpcUpdateScale(int currentThreshold) { UpdateScaleInternal(currentThreshold); } private void UpdateScaleInternal(int currentThreshold) { //IL_0042: 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) float num = (float)currentThreshold / (float)Thresholds; if (num > 1f) { num = Mathf.Sqrt(num); } float num2 = Mathf.LerpUnclamped((float)CharacterConfig.Size_MinHealth, (float)CharacterConfig.Size_MaxHealth, num); _armatureTransform.localScale = Vector3.one * num2; } public static void SyncItemCount(Inventory inventory, ItemDef itemDef, int currentCount, int desiredCount) { if (currentCount < desiredCount) { inventory.GiveItemPermanent(itemDef, desiredCount - currentCount); } if (currentCount > desiredCount) { inventory.RemoveItemPermanent(itemDef, currentCount - desiredCount); } } private void FixedUpdate() { //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active || !_body.healthComponent.alive) { return; } _monchTimer += Time.deltaTime; if (_monchTimer <= monchInterval) { return; } _monchTimer = 0f; ReadOnlyCollection readOnlyInstancesList = CharacterBody.readOnlyInstancesList; for (int num = readOnlyInstancesList.Count - 1; num >= 0; num--) { if (GorpCharacter.IsGup(readOnlyInstancesList[num]) && !((Object)(object)readOnlyInstancesList[num] == (Object)(object)_body)) { float num2 = Mathf.LerpUnclamped((float)CharacterConfig.MonchDistance_MinHealth, (float)CharacterConfig.MonchDistance_MaxHealth, (float)(currentThreshold / Thresholds)); if (Vector3.SqrMagnitude(readOnlyInstancesList[num].transform.position - ((Component)this).transform.position) < num2 * num2) { float combinedHealth = _body.healthComponent.combinedHealth; float health = readOnlyInstancesList[num].healthComponent.health; if (combinedHealth + health > startHealth * (float)CharacterConfig.MaxAbsorbtionSize) { CheckCurrentHealthThresholdServer(); CallRpcUpdateScale(currentThreshold); } else { float num3 = _body.healthComponent.combinedHealth + health - _body.healthComponent.fullCombinedHealth; _body.healthComponent.Heal(health, default(ProcChainMask), true); _body.inventory.GiveItemPermanent(Items.BoostHp, Mathf.RoundToInt(num3 / (startHealth * 0.1f))); ((Component)readOnlyInstancesList[num]).GetComponent().deathState = new SerializableEntityStateType(typeof(GipDeath)); readOnlyInstancesList[num].master.TrueKill(); CheckCurrentHealthThresholdServer(); CallRpcUpdateScale(currentThreshold); } } } } } private void UNetVersion() { } protected static void InvokeRpcRpcUpdateScale(NetworkBehaviour obj, NetworkReader reader) { if (!NetworkClient.active) { Debug.LogError((object)"RPC RpcUpdateScale called on server."); } else { ((GorpController)(object)obj).RpcUpdateScale((int)reader.ReadPackedUInt32()); } } public void CallRpcUpdateScale(int currentThreshold) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { Debug.LogError((object)"RPC Function RpcUpdateScale called on client."); return; } NetworkWriter val = new NetworkWriter(); val.Write((short)0); val.Write((short)2); val.WritePackedUInt32((uint)kRpcRpcUpdateScale); val.Write(((Component)this).GetComponent().netId); val.WritePackedUInt32((uint)currentThreshold); ((NetworkBehaviour)this).SendRPCInternal(val, 0, "RpcUpdateScale"); } static GorpController() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown kRpcRpcUpdateScale = -333481399; NetworkBehaviour.RegisterRpcDelegate(typeof(GorpController), kRpcRpcUpdateScale, new CmdDelegate(InvokeRpcRpcUpdateScale)); NetworkCRC.RegisterBehaviour("GorpController", 0); } public override bool OnSerialize(NetworkWriter writer, bool forceAll) { bool result = default(bool); return result; } public override void OnDeserialize(NetworkReader reader, bool initialState) { } } }