Decompiled source of UltraFunGuns v1.3.5
plugins/UltraFunGuns.dll
Decompiled 6 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.CodeDom.Compiler; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.Serialization.Formatters.Binary; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Threading.Tasks; using BepInEx; using BepInEx.Bootstrap; using Configgy; using Configgy.UI; using GameConsole; using HarmonyLib; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using ULTRAKILL.Cheats; using UltraFunGuns; using UltraFunGuns.Components; using UltraFunGuns.Components.Entity; using UltraFunGuns.CustomPlacedObjects; using UltraFunGuns.Datas; using UltraFunGuns.Patches; using UltraFunGuns.Properties; using UltraFunGuns.Util; using UnityEngine; using UnityEngine.AI; using UnityEngine.AddressableAssets; using UnityEngine.AddressableAssets.ResourceLocators; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.Rendering; using UnityEngine.ResourceManagement.ResourceLocations; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")] [assembly: AssemblyCompany("Hydraxous")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("A mod with fun guns!")] [assembly: AssemblyFileVersion("1.3.5.0")] [assembly: AssemblyInformationalVersion("1.3.5+62187d1288b86188d376e0118dbbe4086eac6189")] [assembly: AssemblyProduct("UltraFunGuns")] [assembly: AssemblyTitle("UltraFunGuns")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.3.5.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } [UFGWeapon("RocketDagger", "Rocket Dagger", 2, false, WeaponIconColor.Red, false, false)] [WeaponAbility("Dagger", "Press Fire 1 to throw a dagger", 0, RichTextColors.aqua)] [WeaponAbility("Daggers", "Press Fire 2 to throw multiple daggers", 0, RichTextColors.aqua)] public class RocketDagger : UltraFunGunBase { [UFGAsset("RocketDaggerProjectile")] public static GameObject RocketDaggerProjectilePrefab; private ActionCooldown primaryFireCooldown = new ActionCooldown(0.15f); private ActionCooldown secondaryFireCooldown = new ActionCooldown(0.6f); public int PelletsPerSecond = 12; public float maxShotgunTime = 5f; private float shotgunTime = 0f; public override void GetInput() { if (MonoSingleton<InputManager>.Instance.InputSource.Fire1.IsPressed && primaryFireCooldown.CanFire() && !om.paused) { primaryFireCooldown.AddCooldown(); Fire(); } if (MonoSingleton<InputManager>.Instance.InputSource.Fire2.IsPressed) { if (secondaryFireCooldown.CanFire() && !om.paused) { shotgunTime += Time.deltaTime; shotgunTime = Mathf.Min(maxShotgunTime, shotgunTime); if (shotgunTime >= maxShotgunTime) { Shotgun(); } } } else if (shotgunTime > 0f) { Shotgun(); } } private void Fire() { //IL_0008: 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) FirePellet(mainCam.position, mainCam.forward); } private void Shotgun() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_0065: 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_0067: 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_005c: 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_00de: Unknown result type (might be due to invalid IL or missing references) int pelletCount = GetPelletCount(); Vector3 position = mainCam.position; Quaternion rotation = mainCam.rotation; if (shotgunTime == maxShotgunTime) { } for (int i = 0; i < pelletCount; i++) { Vector3 val = Vector3.forward; if (i != 0) { val = MathTools.GetProjectileSpreadVector(shotgunTime / 20f); } GameObject val2 = FirePellet(position, rotation * val); if (val2.TryFindComponent<RayBasedProjectile>(out var component)) { component.sourceWeapon = ((Component)this).gameObject; if (shotgunTime == maxShotgunTime) { component.damage *= 10f; component.ricochet = true; component.projectileSpeed *= 10f; } } val2.transform.Rotate(Vector3.forward, (float)Random.Range(0, 360), (Space)1); } secondaryFireCooldown.AddCooldown(shotgunTime / 2f); shotgunTime = 0f; } private GameObject FirePellet(Vector3 position, Vector3 direction) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) return Object.Instantiate<GameObject>(RocketDaggerProjectilePrefab, position, Quaternion.LookRotation(direction, Vector3.up)); } private int GetPelletCount() { float num = shotgunTime * (float)PelletsPerSecond; num = Mathf.CeilToInt(num); return (int)num; } } public class RayBasedProjectile : MonoBehaviour, ICleanable { public delegate void OnProjectileDeathHandler(ProjectileDeathEvent projectileDeathEvent); public float projectileSpeed; public float projectileSize; public float imortalTime = 0.001f; public bool affectedByGravity; public float gravityMultiplier = 1f; public bool ricochet; public bool hitTriggers; public LayerMask hitMask; public float damage; public float critMultiplier; public bool tryForExplode; public GameObject spawnAtImpact; public GameObject sourceWeapon; public string[] eventDataTags; private float imortalTimeRemaining; private bool dieNextFrame; private float distanceToSurface; public OnProjectileDeathHandler OnProjectileDeath; private ProjectileDeathEvent deathParamters = default(ProjectileDeathEvent); private RaycastHit hit; private void Start() { imortalTimeRemaining = imortalTime; } private void Update() { //IL_0039: 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_0044: Unknown result type (might be due to invalid IL or missing references) if (dieNextFrame) { Impact(); } dieNextFrame = CheckImpact(); imortalTimeRemaining -= Time.deltaTime; Transform transform = ((Component)this).transform; transform.position += GetNextPositionStep(); } private Vector3 GetNextPositionStep() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: 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_001e: 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_002d: 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_0042: Unknown result type (might be due to invalid IL or missing references) //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) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: 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_0113: 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_0126: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_018f: 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_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.zero; Vector3 val2 = ((Component)this).transform.forward; Vector3 val3 = ((Component)this).transform.position; if (affectedByGravity) { val += Physics.gravity * gravityMultiplier * Time.deltaTime; } bool flag = false; if ((Object)(object)((RaycastHit)(ref hit)).collider != (Object)null) { flag = ((Component)((RaycastHit)(ref hit)).collider).tag == "Armor"; } if ((ricochet || flag) && dieNextFrame) { float num = projectileSpeed * Time.deltaTime; RaycastHit val4 = default(RaycastHit); while (num > 0f && Physics.Raycast(val3, val2, ref val4, num, LayerMask.op_Implicit(hitMask))) { SurfaceHitInformation surfaceHitInformation = default(SurfaceHitInformation); surfaceHitInformation.hitCollider = ((RaycastHit)(ref val4)).collider; surfaceHitInformation.hittingObject = ((Component)this).gameObject; surfaceHitInformation.normal = ((RaycastHit)(ref val4)).normal; surfaceHitInformation.position = ((RaycastHit)(ref val4)).point; surfaceHitInformation.velocity = val2 * projectileSpeed; SurfaceHitInformation surfaceHitInformation2 = surfaceHitInformation; num -= ((RaycastHit)(ref val4)).distance; val3 = ((RaycastHit)(ref val4)).point; val2 = Vector3.Reflect(val2, ((RaycastHit)(ref val4)).normal); HitCollider(((RaycastHit)(ref hit)).collider); } if (num > 0f) { val3 += val2 * num; } ((Component)this).transform.forward = val2; val += val3 - ((Component)this).transform.position; dieNextFrame = false; } else { val += val2 * (dieNextFrame ? distanceToSurface : (projectileSpeed * Time.deltaTime)); } return val; } private bool CheckImpact() { //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_0022: 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_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_0038: 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_00b7: 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_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0079: 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_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)this).transform.forward * projectileSpeed; if (affectedByGravity) { val += Physics.gravity * gravityMultiplier; } float num = ((Vector3)(ref val)).magnitude * Time.deltaTime; if (projectileSize > 0f) { if (!Physics.SphereCast(((Component)this).transform.position, projectileSize, ((Vector3)(ref val)).normalized, ref hit, num, LayerMask.op_Implicit(hitMask))) { return false; } } else if (!Physics.Raycast(((Component)this).transform.position, ((Vector3)(ref val)).normalized, ref hit, num, LayerMask.op_Implicit(hitMask))) { return false; } if (!hitTriggers && ((RaycastHit)(ref hit)).collider.isTrigger) { return false; } deathParamters.normal = ((RaycastHit)(ref hit)).normal; deathParamters.velocity = ((Component)this).transform.forward * projectileSpeed; if (imortalTimeRemaining < 0f) { Vector3 val2 = ((RaycastHit)(ref hit)).point - ((Component)this).transform.position; distanceToSurface = ((Vector3)(ref val2)).magnitude; return true; } return false; } private void Impact() { //IL_0023: 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_0035: 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_0054: 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_0090: 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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: 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_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0105: 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_010f: Unknown result type (might be due to invalid IL or missing references) SurfaceHitInformation surfaceHitInformation = default(SurfaceHitInformation); surfaceHitInformation.hitCollider = ((RaycastHit)(ref hit)).collider; surfaceHitInformation.normal = ((RaycastHit)(ref hit)).normal; surfaceHitInformation.position = ((RaycastHit)(ref hit)).point; surfaceHitInformation.hittingObject = ((Component)this).gameObject; surfaceHitInformation.velocity = ((Component)this).transform.forward * projectileSpeed; SurfaceHitInformation surfaceHitInformation2 = surfaceHitInformation; if (!HitCollider(((RaycastHit)(ref hit)).collider)) { ((Component)this).transform.forward = Vector3.Reflect(((Component)this).transform.forward, ((RaycastHit)(ref hit)).normal); return; } if ((Object)(object)spawnAtImpact != (Object)null && (Object)(object)((RaycastHit)(ref hit)).collider != (Object)null) { GameObject val = Object.Instantiate<GameObject>(spawnAtImpact, ((RaycastHit)(ref hit)).point + ((RaycastHit)(ref hit)).normal * 0.01f, Quaternion.LookRotation(((RaycastHit)(ref hit)).normal, Vector3.up)); } Object.Destroy((Object)(object)((Component)this).gameObject); } private bool HitCollider(Collider col) { //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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: 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_0040: 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) if ((Object)(object)col == (Object)null) { return false; } if (col.IsColliderEnemy(out var enemy) && enemy != null) { enemy.DeliverDamage(((Component)enemy).gameObject, ((Component)this).transform.forward * projectileSpeed, ((RaycastHit)(ref hit)).point, damage, tryForExplode, critMultiplier, sourceWeapon, false, false); } if (col.TryFindComponent<IUFGInteractionReceiver>(out var component)) { UFGInteractionEventData interaction = default(UFGInteractionEventData); interaction.power = damage; interaction.direction = ((Component)this).transform.forward; interaction.interactorPosition = ((Component)this).transform.position; interaction.tags = ((eventDataTags == null) ? new string[0] : eventDataTags); component.Interact(interaction); } return true; } private void OnDrawGizmosSelected() { //IL_0001: 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_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_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_004e: Unknown result type (might be due to invalid IL or missing references) Gizmos.color = Color.red; Gizmos.DrawRay(((Component)this).transform.position, ((Component)this).transform.forward * projectileSpeed * (1f / 60f)); Gizmos.color = Color.green; Gizmos.DrawWireSphere(((Component)this).transform.position, projectileSize); } private void OnDestroy() { //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_0023: 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) deathParamters.direction = ((Component)this).transform.forward; deathParamters.position = ((Component)this).transform.position; OnProjectileDeath?.Invoke(deathParamters); } public void Cleanup() { Object.Destroy((Object)(object)((Component)this).gameObject); } } public struct SurfaceHitInformation { public Vector3 position; public Vector3 normal; public Vector3 velocity; public Collider hitCollider; public GameObject hittingObject; } public struct ProjectileDeathEvent { public Vector3 position; public Vector3 direction; public Vector3 normal; public Vector3 velocity; } public class RayProjectile : MonoBehaviour { public float StepDistance; public Action<RaycastHit, RayProjectile> OnHit; public LayerMask Hitmask; private void Update() { MoveProjectile(); } private void MoveProjectile() { //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_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0023: 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_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) Vector3 val = ((Component)this).transform.forward * StepDistance * Time.deltaTime; if (!CheckStep(val, out var hit)) { Transform transform = ((Component)this).transform; transform.position += val; } else { OnHit(hit, this); } } private bool CheckStep(Vector3 travel, out RaycastHit hit) { //IL_0007: 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_001c: Unknown result type (might be due to invalid IL or missing references) return Physics.Raycast(((Component)this).transform.position, ((Vector3)(ref travel)).normalized, ref hit, ((Vector3)(ref travel)).magnitude, LayerMask.op_Implicit(Hitmask)); } } namespace UltraFunGuns { public class AnimationAudioInterface : MonoBehaviour { [SerializeField] private AudioClip[] clips; public void PlayClip(int clipIndex) { if (clipIndex >= clips.Length || clipIndex < 0) { HydraLogger.Log($"Audio clip index ({clipIndex}) out of range on {((Object)((Component)this).gameObject).name}", DebugChannel.Error); } else { PlayClip(clips[clipIndex]); } } public void PlayClip(string name) { if (clips != null) { AudioClip clip = clips.Where((AudioClip x) => ((Object)x).name == name).First(); PlayClip(clip); } } private void PlayClip(AudioClip clip) { if ((Object)(object)clip == (Object)null) { HydraLogger.Log("Warning audio clip attempted to be played on " + ((Object)((Component)this).gameObject).name + " through animation. The provided clip was null.", DebugChannel.Error); return; } Transform transform = ((Component)clip.PlayAudioClip(Random.Range(0.9f, 1.1f))).transform; transform.parent = ((Component)this).transform; } } public class AudioSourceRandomizer : MonoBehaviour { public float minPitch = 0.85f; public float maxPitch = 1.15f; public float minVolume = 1f; public float maxVolume = 1f; private AudioSource audioSrc; private void Awake() { audioSrc = ((Component)this).GetComponent<AudioSource>(); if ((Object)(object)audioSrc == (Object)null) { Object.Destroy((Object)(object)this); } else { RandomizeAudio(); } } private void RandomizeAudio() { if (Object.op_Implicit((Object)(object)audioSrc)) { float pitch = Random.Range(minPitch, maxPitch); float volume = Random.Range(minVolume, maxVolume); audioSrc.pitch = pitch; audioSrc.volume = volume; } } } public class BehaviourRelay : MonoBehaviour { public Action<GameObject> OnAwake; public Action<GameObject> OnStart; public Action<GameObject> OnUpdate; public Action<GameObject> OnLateUpdate; public Action<GameObject> OnFixedUpdate; public Action<GameObject> OnOnEnable; public Action<GameObject> OnOnDisable; public Action<GameObject> OnOnDestroy; private void Awake() { OnAwake?.Invoke(((Component)this).gameObject); } private void Start() { OnStart?.Invoke(((Component)this).gameObject); } private void Update() { OnUpdate?.Invoke(((Component)this).gameObject); } private void LateUpdate() { OnLateUpdate?.Invoke(((Component)this).gameObject); } private void FixedUpdate() { OnFixedUpdate?.Invoke(((Component)this).gameObject); } private void OnEnable() { OnOnEnable?.Invoke(((Component)this).gameObject); } private void OnDisable() { OnOnDisable?.Invoke(((Component)this).gameObject); } private void OnDestroy() { OnOnDestroy?.Invoke(((Component)this).gameObject); } } public class CoroutineRunner : MonoBehaviour { private bool coroutineStarted; private bool coroutineRunning; private void Update() { if (coroutineStarted && !coroutineRunning) { Object.Destroy((Object)(object)((Component)this).gameObject); } } public Coroutine RunCoroutine(IEnumerator coroutine) { Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; return ((MonoBehaviour)this).StartCoroutine(RunExternalCoroutine(coroutine)); } private IEnumerator RunExternalCoroutine(IEnumerator coroutine) { coroutineStarted = true; coroutineRunning = true; yield return coroutine; coroutineRunning = false; } } public static class StaticCoroutine { public static Coroutine RunCoroutine(IEnumerator coroutine) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) CoroutineRunner coroutineRunner = new GameObject("New Rebinder").AddComponent<CoroutineRunner>(); return coroutineRunner.RunCoroutine(coroutine); } public static void DelayedExecute(Action action, float delayInSeconds) { RunCoroutine(DelayedExecution(action, delayInSeconds)); } private static IEnumerator DelayedExecution(Action action, float timeInSeconds) { yield return (object)new WaitForSecondsRealtime(timeInSeconds); action?.Invoke(); } } public class DebuggingDummy : MonoBehaviour { private void Awake() { } private void Update() { //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_003e: 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_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_004b: 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_00b7: 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) //IL_00cd: 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) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: 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) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0125: 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_007b: 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) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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_00a6: Unknown result type (might be due to invalid IL or missing references) if (!UltraFunGuns.DebugMode) { return; } if (Input.GetKeyDown((KeyCode)256)) { Vector3 position = ((Component)MonoSingleton<NewMovement>.Instance).transform.position; Vector3 position2 = ((Component)MonoSingleton<CameraController>.Instance).transform.position; Vector3 val = Vector3.zero; if (HydraUtils.SphereCastMacro(position2, 0.001f, ((Component)MonoSingleton<CameraController>.Instance).transform.forward, float.PositiveInfinity, out var hit)) { val = ((RaycastHit)(ref hit)).point; Visualizer.DrawSphere(val, 0.25f, 5f); Visualizer.DrawLine(5f, position2, val); } string message = $"Player: {position.x}|{position.y}|{position.z}\n" + $"Camera: {position2.x}|{position2.y}|{position2.z}\n" + $"HitPos: {val.x}|{val.y}|{val.z}"; HydraLogger.Log(message, DebugChannel.Warning); } if (!Input.GetKeyDown((KeyCode)260)) { return; } List<IResourceLocation> list = new List<IResourceLocation>(); foreach (IResourceLocator resourceLocator in Addressables.ResourceLocators) { ResourceLocationMap val2 = (ResourceLocationMap)(object)((resourceLocator is ResourceLocationMap) ? resourceLocator : null); if (val2 == null) { continue; } foreach (IList<IResourceLocation> value in val2.Locations.Values) { list.AddRange(value); } } string text = ""; foreach (IResourceLocation item in list) { text += FormatResourceLocation(item); } } private string FormatResourceLocation(IResourceLocation rlocation) { string text = "=================================\n"; text = text + "PKEY: " + rlocation.PrimaryKey + "\n"; text = text + "INTID: " + rlocation.InternalId + "\n"; return text + "RTYPE: " + rlocation.ResourceType.Name + "\n"; } } public class DebugLine : MonoBehaviour { private LineRenderer lr; private bool initialized; private void Awake() { lr = ((Component)this).GetComponent<LineRenderer>(); } public void SetLine(Vector3[] points) { if (!initialized) { initialized = true; lr.positionCount = points.Length; lr.SetPositions(points); } } } public class DebugTextPopup : MonoBehaviour { [SerializeField] private Text text; [SerializeField] private DestroyAfterTime destroyAfterTime; private void Awake() { if ((Object)(object)text == (Object)null) { text = ((Component)this).GetComponentInChildren<Text>(); } } public void SetText(string newText, Color color) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)text != (Object)null) { text.text = newText; ((Graphic)text).color = color; } } public void SetKillTime(float newTime) { if ((Object)(object)destroyAfterTime != (Object)null) { destroyAfterTime.TimeLeft = newTime; } } public void OnDestroy() { Visualizer.ClearDebugText(this); } } public class HLErrorNotifier : MonoBehaviour { private void Start() { HydraLogger.Log(((Object)((Component)this).gameObject).name + " was created, but it was not loaded properly from the assetbundle.", DebugChannel.Error); } } public class DeleteAfterTime : MonoBehaviour { public float TimeLeft = 10f; private void Update() { if (TimeLeft <= 0f) { Object.Destroy((Object)(object)((Component)this).gameObject); } else { TimeLeft -= Time.deltaTime; } } } public class DestroyAfterTime : MonoBehaviour, ICleanable { public float TimeLeft = 2f; private void Start() { CheckComponents(); } private void CheckComponents() { //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_007a: 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_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) AudioSource val = default(AudioSource); if (((Component)this).TryGetComponent<AudioSource>(ref val)) { float maxTime = val.clip.length - val.time; SetMaxTime(maxTime); } TrailRenderer val2 = default(TrailRenderer); if (((Component)this).TryGetComponent<TrailRenderer>(ref val2)) { SetMaxTime(val2.time); ((MonoBehaviour)this).StartCoroutine(FadeOutTrail(val2)); } ParticleSystem val3 = default(ParticleSystem); if (((Component)this).TryGetComponent<ParticleSystem>(ref val3)) { EmissionModule emission = val3.emission; ((EmissionModule)(ref emission)).enabled = false; MinMaxCurve rateOverTime = ((EmissionModule)(ref emission)).rateOverTime; SetMaxTime(((MinMaxCurve)(ref rateOverTime)).constant); MainModule main = val3.main; SetMaxTime(((MainModule)(ref main)).duration); } } private IEnumerator FadeOutTrail(TrailRenderer trail) { float startTime = trail.time; float startWidth = trail.widthMultiplier; while (trail.time > 0f) { trail.time -= Time.deltaTime; trail.widthMultiplier = Mathf.Lerp(startWidth, 0f, Mathf.InverseLerp(startTime, 0f, trail.time)); yield return (object)new WaitForEndOfFrame(); } } public void SetMaxTime(float newMaxTime) { TimeLeft = Mathf.Max(TimeLeft, newMaxTime); } private void Update() { if (TimeLeft <= 0f) { Object.Destroy((Object)(object)((Component)this).gameObject); } TimeLeft -= Time.deltaTime; } public static void PreserveComponents(Transform transf) { AudioSource[] componentsInChildren = ((Component)transf).GetComponentsInChildren<AudioSource>(); TrailRenderer[] componentsInChildren2 = ((Component)transf).GetComponentsInChildren<TrailRenderer>(); ParticleSystem[] componentsInChildren3 = ((Component)transf).GetComponentsInChildren<ParticleSystem>(); for (int i = 0; i < componentsInChildren.Length; i++) { PreserveComponent(((Component)componentsInChildren[i]).transform); } for (int j = 0; j < componentsInChildren2.Length; j++) { PreserveComponent(((Component)componentsInChildren2[j]).transform); } for (int k = 0; k < componentsInChildren3.Length; k++) { PreserveComponent(((Component)componentsInChildren3[k]).transform); } } private static void PreserveComponent(Transform tf, bool changeParent = true) { if ((Object)(object)tf != (Object)null) { ((Component)tf).gameObject.AddComponent<DestroyAfterTime>(); if (changeParent) { tf.parent = null; } } } public void Cleanup() { Object.Destroy((Object)(object)((Component)this).gameObject); } } public class EnemyOverride : MonoBehaviour { private NavMeshAgent navMeshAgent; private Animator animator; private Drone drone; private Zombie zombie; private Machine machine; private Statue statue; private SpiderBody spiderBody; private Rigidbody[] childRigidbodies; private Collider primaryCollider; private Rigidbody primaryRigidbody; private List<Action<Collision>> onCollisionEvents = new List<Action<Collision>>(); private List<Action> onDeathEvents = new List<Action>(); private Dictionary<Renderer, Material[]> startMaterials = new Dictionary<Renderer, Material[]>(); private Renderer[] renderers; private List<StyleEntry> styleEntries = new List<StyleEntry>(); private bool initialized; public EnemyIdentifier Enemy { get; private set; } public bool RagdollEnabled { get; private set; } public bool Frozen { get; private set; } private void Awake() { if (!initialized) { ForceInitialize(); } } public void ForceInitialize() { //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Expected O, but got Unknown if (!initialized) { initialized = true; Enemy = ((Component)this).GetComponent<EnemyIdentifier>(); navMeshAgent = ((Component)this).GetComponent<NavMeshAgent>(); animator = ((Component)this).GetComponent<Animator>(); drone = ((Component)this).GetComponent<Drone>(); zombie = ((Component)this).GetComponent<Zombie>(); machine = ((Component)this).GetComponent<Machine>(); spiderBody = ((Component)this).GetComponent<SpiderBody>(); statue = ((Component)this).GetComponent<Statue>(); Enemy.onDeath.AddListener(new UnityAction(ExecuteOnDeathEvents)); GetPhysicsComponents(); GetRenderComponents(); } } private void GetPhysicsComponents() { primaryCollider = ((Component)this).GetComponent<Collider>(); childRigidbodies = ((Component)this).GetComponentsInChildren<Rigidbody>(); } private void GetRenderComponents() { renderers = ((Component)this).GetComponentsInChildren<Renderer>(true); Renderer[] array = renderers; foreach (Renderer val in array) { if (!startMaterials.ContainsKey(val)) { startMaterials.Add(val, val.materials); } } } public void ResetMaterials() { Renderer[] array = renderers; foreach (Renderer val in array) { if (!((Object)(object)val == (Object)null) && startMaterials.ContainsKey(val)) { val.materials = startMaterials[val]; } } } public void SetFrozen(bool frozen) { Frozen = frozen; SetComponents(!frozen); if (RagdollEnabled && frozen) { SetKinematic(frozen); } } public void SetAllMaterials(Material[] newMaterials) { foreach (KeyValuePair<Renderer, Material[]> startMaterial in startMaterials) { if (!((Object)(object)startMaterial.Key == (Object)null)) { startMaterial.Key.materials = newMaterials; } } } public void SetAllMaterial(Material material) { foreach (KeyValuePair<Renderer, Material[]> startMaterial in startMaterials) { if (!((Object)(object)startMaterial.Key == (Object)null)) { startMaterial.Key.material = material; } } } public void Knockback(Vector3 force) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) if (!RagdollEnabled) { return; } Rigidbody[] array = childRigidbodies; foreach (Rigidbody val in array) { if ((Object)(object)val != (Object)null) { val.velocity = force; } } } public void AddStyleEntryOnDeath(StyleEntry entry, bool allowMultiple = false) { if ((Object)(object)Enemy != (Object)null) { entry.EnemyIdentifier = Enemy; } if (!allowMultiple && styleEntries.Where((StyleEntry x) => x.Key == entry.Key).ToList().Count > 0) { styleEntries[0].LifeTime += entry.LifeTime; } else { styleEntries.Add(entry); } } private void ExecuteStyleEntries() { styleEntries = styleEntries.Where((StyleEntry x) => x.valid).ToList(); foreach (StyleEntry entry in styleEntries) { if (entry.AlreadyCounted) { continue; } List<StyleEntry> list = styleEntries.Where((StyleEntry x) => x.Key == entry.Key && x != entry).ToList(); for (int i = 0; i < list.Count; i++) { if (list[i] != entry) { entry.Points += list[i].Points; int num = ((list[i].Count < 1) ? 1 : list[i].Count); entry.Count = ((entry.Count >= 1) ? (entry.Count + num) : (1 + num)); list[i].AlreadyCounted = true; } } if (list.Count > 0) { Debug.LogWarning((object)"Combined similar entries"); } WeaponManager.AddStyle(entry); } } public void AddDeathCallback(Action action) { if (!onDeathEvents.Contains(action)) { onDeathEvents.Add(action); } } private void ExecuteOnDeathEvents() { foreach (Action onDeathEvent in onDeathEvents) { onDeathEvent?.Invoke(); } ExecuteStyleEntries(); } public void EnableKnockback() { } public void DisableKnockback() { } public void SetRagdoll(bool active) { RagdollEnabled = active; SetComponents(!active); SetKinematic(!active); } public void SetComponents(bool active) { if (!((Object)(object)Enemy == (Object)null) && !Enemy.dead) { if ((Object)(object)navMeshAgent != (Object)null) { ((Behaviour)navMeshAgent).enabled = active; } if ((Object)(object)drone != (Object)null) { ((Behaviour)drone).enabled = active; } if ((Object)(object)machine != (Object)null) { ((Behaviour)machine).enabled = active; } if ((Object)(object)spiderBody != (Object)null) { ((Behaviour)spiderBody).enabled = active; } if ((Object)(object)statue != (Object)null) { ((Behaviour)statue).enabled = active; } if ((Object)(object)zombie != (Object)null) { ((Behaviour)zombie).enabled = active; } if ((Object)(object)animator != (Object)null) { ((Behaviour)animator).enabled = active; } } } public void SetKinematic(bool active) { if ((Object)(object)primaryCollider != (Object)null) { primaryCollider.enabled = active; } Rigidbody[] array = childRigidbodies; foreach (Rigidbody val in array) { if ((Object)(object)val != (Object)null) { val.isKinematic = active; val.useGravity = !active; } } } public bool AddCollisionEvent(Action<Collision> collisionCallback) { if (collisionCallback == null || onCollisionEvents.Contains(collisionCallback)) { return false; } onCollisionEvents.Add(collisionCallback); return true; } private void OnCollisionEnter(Collision col) { foreach (Action<Collision> onCollisionEvent in onCollisionEvents) { onCollisionEvent?.Invoke(col); } } public float GetHealth() { if ((Object)(object)spiderBody != (Object)null) { return spiderBody.health; } if ((Object)(object)drone != (Object)null) { return drone.health; } if ((Object)(object)zombie != (Object)null) { return zombie.health; } if ((Object)(object)machine != (Object)null) { return machine.health; } if ((Object)(object)statue != (Object)null) { return statue.health; } return Enemy.health; } } public static class EnemyUtil { public static EnemyOverride Override(this EnemyIdentifier eid) { EnemyOverride enemyOverride = ((Component)eid).gameObject.EnsureComponent<EnemyOverride>(); enemyOverride.ForceInitialize(); return enemyOverride; } } public class StyleEntry { public string Key; public string Prefix; public string Postfix; public int Points; public float LifeTime; public GameObject SourceWeapon; public EnemyIdentifier EnemyIdentifier; public int Count; public bool AlreadyCounted; private float timeCreated; public bool valid => Time.time - timeCreated < LifeTime; public StyleEntry(int points, string key, float lifeTime = 5f, GameObject sourceWeapon = null, EnemyIdentifier eid = null, int count = -1, string prefix = "", string postfix = "") { Key = key; Points = points; LifeTime = lifeTime; timeCreated = Time.time; Count = count; SourceWeapon = sourceWeapon; EnemyIdentifier = eid; Count = count; Prefix = prefix; Postfix = postfix; } public StyleEntry() { timeCreated = Time.time; } } public class EntityStatusEffectHolder : MonoBehaviour, IStatusEffectReceiver { private List<IStatusEffect> currentEffects = new List<IStatusEffect>(); public GameObject GetAffectedObject() { return ((Component)this).gameObject; } public void AddStatusEffect(IStatusEffect effect) { currentEffects.Add(effect); } public IEnumerable<IStatusEffect> GetStatusEffects() { return currentEffects; } public void RemoveStatusEffect(IStatusEffect effect) { currentEffects.Remove(effect); } } public class HydraPlushie : MonoBehaviour { [SerializeField] private MeshRenderer screen; [SerializeField] private Texture2D blueScreenTex; [SerializeField] private Texture2D blueScreenFaceMask; [SerializeField] private AudioClip blueScreenClip; [SerializeField] private AudioSource toChange; [SerializeField] private GameObject breakFX; private bool damaged; private void WaterDamage() { if (!((Object)(object)screen == (Object)null) && !((Object)(object)blueScreenTex == (Object)null) && !((Object)(object)blueScreenFaceMask == (Object)null) && !damaged) { damaged = true; if (((Renderer)screen).material.HasProperty("_MainTex")) { ((Renderer)screen).material.SetTexture("_MainTex", (Texture)(object)blueScreenTex); } if (((Renderer)screen).material.HasProperty("_FaceMask")) { ((Renderer)screen).material.SetTexture("_FaceMask", (Texture)(object)blueScreenFaceMask); } if ((Object)(object)toChange != (Object)null) { toChange.clip = blueScreenClip; } AudioSource[] componentsInChildren = ((Component)((Component)this).transform).GetComponentsInChildren<AudioSource>(); foreach (AudioSource val in componentsInChildren) { val.pitch -= val.pitch * 0.23f; } if ((Object)(object)breakFX != (Object)null) { Object.Instantiate<GameObject>(breakFX, ((Component)this).transform); } WeaponManager.SetWeaponUnlocked("FizzyGun", unlocked: true); WeaponManager.SetWeaponUnlocked("GrabbityGun", unlocked: true); WeaponManager.SetWeaponUnlocked("PlushieCannon", unlocked: true); } } private void OnTriggerEnter(Collider col) { Water val = default(Water); if (((Component)col).gameObject.layer == 4 || ((Component)col).tag.ToLower().Contains("water") || ((Component)col).gameObject.TryGetComponent<Water>(ref val)) { WaterDamage(); } } private void OnDestroy() { WaterDamage(); } } public interface IStatusEffect { void OnEffectStart(); void OnEffectUpdate(); void OnEffectStop(); } public interface IStatusEffectReceiver { void AddStatusEffect(IStatusEffect effect); void RemoveStatusEffect(IStatusEffect effect); IEnumerable<IStatusEffect> GetStatusEffects(); GameObject GetAffectedObject(); } public class TrainingBot : MonoBehaviour { } public class Explodable : MonoBehaviour, IExplodable { public Action<Explosion> OnExplode; public UnityEvent<Explosion> OnExploded; public void Explode(Explosion explosion) { ExplodeCore(explosion); } protected virtual void ExplodeCore(Explosion explosion) { OnExplode?.Invoke(explosion); OnExploded?.Invoke(explosion); } } public interface ICleanable { void Cleanup(); } public class InventoryControllerDeployer : MonoBehaviour { private RectTransform canvas; private Transform configHelpMessage; private Transform versionHelpMessage; private OptionsManager om; private InventoryController invController; private Button invControllerButton; private Button configHelpButton; private GameObject pauseMenu; public bool inventoryManagerOpen = false; [Configgable("Binds", "Open UFG Inventory", 0, null)] public static ConfigKeybind inventoryKey = new ConfigKeybind((KeyCode)105); private static bool sentVersionMessage = false; private bool displayingHelpMessage = false; [UFGAsset("UFGInventoryUI")] private static GameObject UFGInventoryUI; [UFGAsset("UFGInventoryButton")] private static GameObject UFGInventoryButton; [UFGAsset("UFGKeybindsMenu")] private static GameObject UFGKeybindsUI; [Configgable("Advanced", "Show Update Notifications", 0, null)] private static ConfigToggle showUpdateNotifications = new ConfigToggle(true); private static bool showedUpdateNotification; [UFGAsset("WMUINode")] public static GameObject UFGInventoryNode { get; private set; } private void Awake() { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Expected O, but got Unknown om = MonoSingleton<OptionsManager>.Instance; canvas = ((Component)this).GetComponent<RectTransform>(); pauseMenu = ((Component)((Component)this).transform.Find("PauseMenu")).gameObject; invControllerButton = Object.Instantiate<GameObject>(UFGInventoryButton, (Transform)(object)canvas).GetComponent<Button>(); ((UnityEvent)invControllerButton.onClick).AddListener(new UnityAction(OpenInventory)); invController = Object.Instantiate<GameObject>(UFGInventoryUI, (Transform)(object)canvas).GetComponent<InventoryController>(); ((Component)invController).gameObject.SetActive(false); ((Component)invControllerButton).gameObject.SetActive(false); configHelpMessage = ((Component)invController).transform.Find("ConfigMessage"); versionHelpMessage = ((Component)invController).transform.Find("VersionMessage"); ((Component)versionHelpMessage).GetComponentInChildren<Text>().text = string.Format(((Component)versionHelpMessage).GetComponentInChildren<Text>().text, UltraFunGuns.LatestVersion); configHelpButton = ((Component)((Component)invController).transform.Find("MenuBorder/SlotNames")).GetComponent<Button>(); ((UnityEvent)configHelpButton.onClick).AddListener((UnityAction)delegate { CloseInventory(); ConfigurationMenu.OpenAtPath("UltraFunGuns/Binds"); }); } private void Update() { CheckStatus(); } private void CheckStatus() { //IL_0081: 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) if (inventoryManagerOpen) { if (!UltraFunGuns.UsingLatestVersion && ((ConfigValueElement<bool>)(object)showUpdateNotifications).Value && !showedUpdateNotification) { showedUpdateNotification = true; NotifyUpdateAvailable(); } if (Input.GetKeyDown((KeyCode)27)) { CloseInventory(); } } else { displayingHelpMessage = false; if (Data.SaveInfo.Data.firstTimeModLoaded) { HudMessageReceiver instance = MonoSingleton<HudMessageReceiver>.Instance; KeyCode value = ((ConfigValueElement<KeyCode>)(object)inventoryKey).Value; instance.SendHudMessage($"UFG: Set a custom loadout for UFG weapons with [<color=orange>{((object)(KeyCode)(ref value)).ToString()}</color>] or in the pause menu.", "", "", 2, false); Data.SaveInfo.Data.firstTimeModLoaded = false; Data.SaveInfo.Save(); } } bool flag = GameStateManager.Instance.IsStateActive("pause"); ((Component)invControllerButton).gameObject.SetActive(flag && !inventoryManagerOpen); if (inventoryKey.WasPeformed() && !om.paused) { OpenInventory(); } } private void NotifyUpdateAvailable() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //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_0050: 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_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_00c9: 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_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: 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_0117: 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) ModalDialogueEvent val = new ModalDialogueEvent(); val.Title = "Outdated"; val.Message = "You are using an outdated version of UltraFunGuns: (<color=red>Release-1.3.5</color>). Please consider updating to the latest version: (<color=green>" + UltraFunGuns.LatestVersion + "</color>)"; val.Options = (DialogueBoxOption[])(object)new DialogueBoxOption[3] { new DialogueBoxOption { Name = "Open Browser", Color = Color.white, OnClick = delegate { Application.OpenURL("https://github.com/Hydraxous/UltraFunGuns/releases/latest"); } }, new DialogueBoxOption { Name = "Later", Color = Color.white, OnClick = delegate { } }, new DialogueBoxOption { Name = "Don't Ask Again.", Color = Color.red, OnClick = delegate { ((ConfigValueElement<bool>)(object)showUpdateNotifications).SetValue(false); } } }; ModalDialogue.ShowDialogue(val); } public void CloseInventory() { inventoryManagerOpen = false; om.paused = false; invController.SetCardActive(enabled: false); ((Component)configHelpMessage).gameObject.SetActive(false); ((Component)versionHelpMessage).gameObject.SetActive(false); displayingHelpMessage = false; ((Component)invController).gameObject.SetActive(false); } public void OpenInventory() { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_0068: 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_0076: Unknown result type (might be due to invalid IL or missing references) if (!((Component)invController).gameObject.activeInHierarchy) { if (om.paused) { om.UnPause(); } om.paused = true; invController.RefreshSlotKeyDisplays(); GameState val = new GameState("ufg_inv", ((Component)invController).gameObject); val.cursorLock = (LockMode)2; val.playerInputLock = (LockMode)1; val.cameraInputLock = (LockMode)1; val.priority = 2; GameStateManager.Instance.RegisterState(val); if (Data.SaveInfo.Data.firstTimeUsingInventory) { Data.SaveInfo.Data.firstTimeUsingInventory = false; Data.SaveInfo.Save(); } ((Component)invControllerButton).gameObject.SetActive(false); ((Component)invController).gameObject.SetActive(true); inventoryManagerOpen = true; } } public void SendConfigHelpMessage() { if (om.paused && !displayingHelpMessage) { ((MonoBehaviour)this).StartCoroutine(DisplayHelpMessage(configHelpMessage)); } } public void SendVersionHelpMessage() { if (!sentVersionMessage && om.paused && !displayingHelpMessage && !Data.Config.Data.DisableVersionMessages) { sentVersionMessage = true; ((MonoBehaviour)this).StartCoroutine(DisplayHelpMessage(versionHelpMessage)); } } private IEnumerator DisplayHelpMessage(Transform message) { displayingHelpMessage = true; ((Component)message).gameObject.SetActive(true); yield return (object)new WaitForSecondsRealtime(4f); ((Component)message).gameObject.SetActive(false); displayingHelpMessage = false; } } public interface IUFGInteractionReceiver { bool Interact(UFGInteractionEventData interaction); bool Targetable(TargetQuery query); Vector3 GetPosition(); } public struct UFGInteractionEventData { public Vector3 interactorPosition; public Vector3 direction; public float power; public string data; public Type invokeType; public string[] tags; public bool ContainsTag(string tag) { if (tags == null) { return false; } for (int i = 0; i < tags.Length; i++) { if (!Utility.IsNullOrWhiteSpace(tags[i]) && tags[i].Contains(tag)) { return true; } } return false; } public bool ContainsAnyTag(params string[] checkTags) { for (int i = 0; i < checkTags.Length; i++) { if (ContainsTag(checkTags[i])) { return true; } } return false; } public bool ContainsAllTags(params string[] checkTags) { for (int i = 0; i < checkTags.Length; i++) { if (!ContainsTag(checkTags[i])) { return false; } } return true; } } public struct TargetQuery { public Vector3 queryOrigin; public Vector3 queryDirection; public bool checkLineOfSight; public float maxRange; public float lineOfSightErrorMargin; public Collider lineOfSightCollider; public TargetQuery() { //IL_0007: 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) queryOrigin = default(Vector3); queryDirection = default(Vector3); checkLineOfSight = false; lineOfSightCollider = null; maxRange = -1f; lineOfSightErrorMargin = 1.5f; } public bool HasLineOfSight(Vector3 targetablePosition) { //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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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_0081: 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_0067: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_0079: 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) if (!checkLineOfSight) { return true; } float num = ((maxRange >= 0f) ? maxRange : float.PositiveInfinity); Vector3 point = queryOrigin; Ray val = default(Ray); ((Ray)(ref val))..ctor(targetablePosition, queryOrigin - targetablePosition); RaycastHit val2 = default(RaycastHit); if ((Object)(object)lineOfSightCollider != (Object)null && lineOfSightCollider.Raycast(val, ref val2, num)) { point = ((RaycastHit)(ref val2)).point; } RaycastHit val3 = default(RaycastHit); if (Physics.Raycast(val, ref val3, num, LayerMask.op_Implicit(LayerMaskDefaults.Get((LMD)1)))) { if (Vector3.Distance(((RaycastHit)(ref val3)).point, point) < lineOfSightErrorMargin) { return true; } return false; } return true; } public bool InRange(Vector3 targetablePosition) { //IL_0001: 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) return Vector3.Distance(targetablePosition, queryOrigin) < ((maxRange >= 0f) ? maxRange : float.PositiveInfinity); } public bool CheckTargetable(Vector3 targetablePosition) { //IL_0002: 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 InRange(targetablePosition) && HasLineOfSight(targetablePosition); } } public class Parriable : MonoBehaviour, IParriable { public Func<Vector3, Vector3, bool> OnParryCheck; public Action<Vector3, Vector3> OnParry; public UnityEvent OnParried; public bool Parry(Vector3 position, Vector3 direction) { //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) return ParryCore(position, direction); } protected virtual bool ParryCore(Vector3 position, Vector3 direction) { //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_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) OnParry(position, direction); UnityEvent onParried = OnParried; if (onParried != null) { onParried.Invoke(); } if (OnParryCheck == null) { return true; } return OnParryCheck(position, direction); } } public class AnimatedPart : MonoBehaviour { [SerializeField] private float baseRotateSpeed; [SerializeField] private Vector3 rotateAxis; private float speedMultiplier = 1f; private Vector3 currentRotation; private void Awake() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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) Quaternion localRotation = ((Component)this).transform.localRotation; currentRotation = ((Quaternion)(ref localRotation)).eulerAngles; } public void SetRotationSpeed(float rotationSpeed) { speedMultiplier = rotationSpeed; } private void Update() { Rotate(); } private void Rotate() { //IL_0003: 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_0014: 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_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_0033: 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_0044: Unknown result type (might be due to invalid IL or missing references) currentRotation += rotateAxis * baseRotateSpeed * speedMultiplier * Time.deltaTime; ((Component)this).transform.localRotation = Quaternion.Euler(currentRotation); } } public class GyroRotator : MonoBehaviour { [SerializeField] private float baseSpeedMultiplier = 1f; [SerializeField] private Vector3 rotateAxis; [SerializeField] private float dragRate = 1f; [SerializeField] private float maxRotationSpeed = 500f; [SerializeField] private float startRotation = 0f; private float angularVelocity = 0f; private float currentRot = 0f; public bool Spin; public float Speed = 0f; private void Start() { currentRot = startRotation; } private void Update() { //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) if (Spin) { angularVelocity = Mathf.Clamp(angularVelocity + Speed * baseSpeedMultiplier, 0f, maxRotationSpeed); } else { angularVelocity = Mathf.Clamp(angularVelocity - dragRate, 0f, maxRotationSpeed); } currentRot += angularVelocity * Time.timeScale; ((Component)this).transform.localRotation = Quaternion.AngleAxis(currentRot, rotateAxis); } public void AddAngularVelocity(float velocity) { angularVelocity += velocity; } } public class Vibrator : MonoBehaviour { private Vector3 startPositon; private Vector3 vibrationAxes; private float vibrationTime; private float automaticVibrationTimer; public float CurrentVibration { get; private set; } public float MaxDistance { get; private set; } private void Start() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) startPositon = ((Component)this).transform.localPosition; } private void Update() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) if (CurrentVibration > 0f) { ((Component)this).transform.localPosition = GetNewPosition(); } CheckVibrationTime(); } public void AddTime(float t) { vibrationTime += t; } private void CheckVibrationTime() { vibrationTime -= Time.deltaTime; vibrationTime = Mathf.Max(vibrationTime, 0f); CurrentVibration = vibrationTime * 0.016666f; } public void SetVibrationAxes(Vector3 localAxes) { //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_0008: Unknown result type (might be due to invalid IL or missing references) vibrationAxes = localAxes.Abs(); } public void SetVibrationValue(float t) { CurrentVibration = Mathf.Clamp01(t); } public void SetMaxDistance(float distance) { MaxDistance = Mathf.Abs(distance); } public Vector3 GetNewPosition() { //IL_000f: 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_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_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_0028: 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_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_0037: Unknown result type (might be due to invalid IL or missing references) float num = CurrentVibration * MaxDistance; Vector3 val = Vector3.Scale(Random.insideUnitSphere, vibrationAxes); val *= num; return val + startPositon; } public void VibrateFor(float seconds, float transitionPaddingNormalized = 0f) { if (automaticVibrationTimer >= 0f) { automaticVibrationTimer += seconds; return; } automaticVibrationTimer = seconds; transitionPaddingNormalized = ((transitionPaddingNormalized > 0.5f) ? 0.5f : ((transitionPaddingNormalized < 0f) ? 0f : transitionPaddingNormalized)); ((MonoBehaviour)this).StartCoroutine(AutomaticVibration(transitionPaddingNormalized)); } public void ForceStop() { automaticVibrationTimer = 0f; SetVibrationValue(0f); } private IEnumerator AutomaticVibration(float transitionPaddingNormalized) { float cachedAutoTime = automaticVibrationTimer; float paddingTime = automaticVibrationTimer * transitionPaddingNormalized; float vibrateTime = automaticVibrationTimer - paddingTime * 2f; while (automaticVibrationTimer > GetCachedTime() - paddingTime) { yield return (object)new WaitForEndOfFrame(); automaticVibrationTimer -= Time.deltaTime; SetVibrationValue(Mathf.InverseLerp(GetCachedTime(), GetCachedTime() - paddingTime, automaticVibrationTimer)); } SetVibrationValue(1f); while (automaticVibrationTimer > GetCachedTime() - vibrateTime) { yield return (object)new WaitForEndOfFrame(); automaticVibrationTimer -= Time.deltaTime; automaticVibrationTimer = Mathf.Max(automaticVibrationTimer, 0f); } while (automaticVibrationTimer > 0f) { yield return (object)new WaitForEndOfFrame(); automaticVibrationTimer -= Time.deltaTime; SetVibrationValue(Mathf.InverseLerp(GetCachedTime(), 0f, automaticVibrationTimer)); } SetVibrationValue(0f); float GetCachedTime() { if (cachedAutoTime <= automaticVibrationTimer) { cachedAutoTime = automaticVibrationTimer; } return cachedAutoTime; } } private void OnDisable() { ForceStop(); } public Vibrator() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0009: 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) Vector3 one = Vector3.one; vibrationAxes = ((Vector3)(ref one)).normalized; vibrationTime = 0f; ((MonoBehaviour)this)..ctor(); } } public class SimpleBreakable : MonoBehaviour, IBreakable { public Action OnBreak; public UnityEvent OnBreakEvent; public void Break() { BreakCore(); } protected virtual void BreakCore() { OnBreak?.Invoke(); UnityEvent onBreakEvent = OnBreakEvent; if (onBreakEvent != null) { onBreakEvent.Invoke(); } } } public class InventoryController : MonoBehaviour { private OptionsManager om; private WeaponInfoCard infoCard; private ConfigKeybind[] slotKeys; private static int maxSlots = 4; private List<InventorySlot> slots = new List<InventorySlot>(); private List<Text> slotKeyNames = new List<Text>(); private GunControl gc; private static InventoryController invController; private void Awake() { slotKeys = (ConfigKeybind[])(object)new ConfigKeybind[4] { UFGInput.Slot7Key, UFGInput.Slot8Key, UFGInput.Slot9Key, UFGInput.Slot10Key }; om = MonoSingleton<OptionsManager>.Instance; gc = MonoSingleton<GunControl>.Instance; infoCard = ((Component)((Component)this).transform.Find("InfoCard")).gameObject.AddComponent<WeaponInfoCard>(); } private void Start() { CreateNewSlots(); SetSlotKeyDisplays(); } private void CreateNewSlots() { for (int i = 0; i < maxSlots; i++) { InventorySlot item = ((Component)((Component)this).transform.Find($"MenuBorder/WeaponSlots/Slot{i}Wrapper")).gameObject.AddComponent<InventorySlot>(); slots.Add(item); } for (int j = 0; j < slots.Count; j++) { slots[j].Initialize(Data.Loadout.Data.slots[j], j, this); } } private void SetSlotKeyDisplays() { List<Text> list = new List<Text>(); for (int i = 0; i < slots.Count; i++) { slotKeyNames.Add(((Component)((Component)this).transform.Find($"MenuBorder/SlotNames/Slot{i}Name")).GetComponent<Text>()); } RefreshSlotKeyDisplays(); } public void RefreshSlotKeyDisplays() { //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) if (slotKeyNames.Count > 0) { for (int i = 0; i < slotKeyNames.Count; i++) { Text obj = slotKeyNames[i]; object arg = 7 + i; KeyCode value = ((ConfigValueElement<KeyCode>)(object)slotKeys[i]).Value; obj.text = $"Slot {arg} [<color=orange>{((object)(KeyCode)(ref value)).ToString()}</color>]"; } } } public void ButtonPressed(InventoryNode node, InventorySlot slot, string buttonPressed) { switch (buttonPressed) { case "Icon": node.data.weaponEnabled = !node.data.weaponEnabled; node.Refresh(); break; case "Up": slot.ChangeNodeOrder(node, -1); break; case "Down": slot.ChangeNodeOrder(node, 1); break; case "Right": { slot.RemoveNode(node); int num2 = slot.ID + 1; if (num2 >= slots.Count) { num2 = 0; } else if (num2 < 0) { num2 = Mathf.Clamp(slots.Count, 0, slots.Count - 1); } slots[num2].InsertNode(node); slot.Refresh(); break; } case "Left": { slot.RemoveNode(node); int num = slot.ID - 1; if (num >= slots.Count) { num = 0; } else if (num < 0) { num = Mathf.Clamp(slots.Count, 0, slots.Count - 1); } slots[num].InsertNode(node); slot.Refresh(); break; } } SaveInventoryData(); Refresh(); RedeployAllWeapons(); } private void RedeployAllWeapons() { if ((Object)(object)MonoSingleton<GunSetter>.Instance == (Object)null) { WeaponManager.DeployWeapons(); } else { MonoSingleton<GunSetter>.Instance.ResetWeapons(false); } } public void Refresh() { foreach (InventorySlot slot in slots) { slot.Refresh(); } } public void SaveInventoryData() { Data.Loadout.Data.slots = GetInventoryLoadout(); Data.Loadout.Save(); HydraLogger.Log("Inventory saved."); } public InventorySlotData[] GetInventoryLoadout() { List<InventorySlotData> list = new List<InventorySlotData>(); for (int i = 0; i < slots.Count; i++) { list.Add(slots[i].GetSlotData()); } return list.ToArray(); } public void SetCardWeaponInfo(UFGWeapon info) { if ((Object)(object)infoCard != (Object)null) { infoCard.SetWeaponInfo(info); } } public void SetCardActive(bool enabled) { if (!((Object)(object)infoCard == (Object)null) && enabled != ((Component)infoCard).gameObject.activeInHierarchy) { ((Component)infoCard).gameObject.SetActive(enabled); } } public static void RefreshInventory() { if ((Object)(object)invController == (Object)null) { invController = Object.FindObjectOfType<InventoryController>(); } invController?.Refresh(); } } [Serializable] public class InventoryControllerData { public string modVersion; public bool firstTimeModLoaded; public bool firstTimeUsingInventory; public InventorySlotData[] slots; public InventoryControllerData(InventorySlotData[] slots, string modVersion, bool firstTimeUse = false, bool firstTimeModLoaded = false) { this.firstTimeModLoaded = firstTimeModLoaded; firstTimeUsingInventory = firstTimeUse; this.slots = slots; this.modVersion = modVersion; } public InventoryControllerData() { } } public class InventoryNode : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler { public RectTransform nodeTransform; public InventorySlot slot; public InventoryNodeData data; private InventoryController controller; public WeaponInfoCard card; private UFGWeapon nodeInfo; public int slotIndexPosition; public Sprite weaponIcon; public Button b_up; public Button b_down; public Button b_left; public Button b_right; public Button b_icon; public Color weaponIcon_Enabled; public Color weaponIcon_Disabled; public Color nodeBg_Enabled; public Color nodeBg_Disabled; private bool mousedOver = false; public void Initialize(InventoryNodeData data, InventorySlot slot, int slotIndex) { //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_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_0060: 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_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_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Expected O, but got Unknown //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Expected O, but got Unknown //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Expected O, but got Unknown //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Expected O, but got Unknown //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Expected O, but got Unknown //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Expected O, but got Unknown //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Expected O, but got Unknown controller = ((Component)this).GetComponentInParent<InventoryController>(); weaponIcon_Enabled = new Color(255f, 255f, 255f, 255f); weaponIcon_Disabled = new Color(73f, 73f, 73f, 255f); nodeBg_Enabled = new Color(185f, 185f, 185f, 110f); nodeBg_Disabled = new Color(49f, 49f, 49f, 110f); HydraLogger.Log(data.weaponKey + " NODE INIT!"); slotIndexPosition = slotIndex; this.data = data; this.slot = slot; if (!WeaponManager.Weapons.TryGetValue(data.weaponKey, out nodeInfo)) { HydraLogger.Log("Inventory node could not get weapon info from key " + data.weaponKey); } nodeTransform = ((Component)this).GetComponent<RectTransform>(); HydraLoader.dataRegistry.TryGetValue(this.data.weaponKey + "_weaponIcon", out var value); weaponIcon = (Sprite)value; if ((Object)(object)weaponIcon == (Object)null) { HydraLoader.dataRegistry.TryGetValue("debug_weaponIcon", out var value2); weaponIcon = (Sprite)value2; } ((Object)((Component)this).gameObject).name = this.data.weaponKey + ".Node"; b_icon = ((Component)((Component)this).transform.Find("Icon")).GetComponent<Button>(); ((UnityEvent)b_icon.onClick).AddListener((UnityAction)delegate { ButtonPressed("Icon"); }); b_up = ((Component)((Component)this).transform.Find("UpButton")).GetComponent<Button>(); ((UnityEvent)b_up.onClick).AddListener((UnityAction)delegate { ButtonPressed("Up"); }); b_right = ((Component)((Component)this).transform.Find("RightButton")).GetComponent<Button>(); ((UnityEvent)b_right.onClick).AddListener((UnityAction)delegate { ButtonPressed("Right"); }); b_down = ((Component)((Component)this).transform.Find("DownButton")).GetComponent<Button>(); ((UnityEvent)b_down.onClick).AddListener((UnityAction)delegate { ButtonPressed("Down"); }); b_left = ((Component)((Component)this).transform.Find("LeftButton")).GetComponent<Button>(); ((UnityEvent)b_left.onClick).AddListener((UnityAction)delegate { ButtonPressed("Left"); }); Refresh(); } public void RefreshPosition() { } public void ChangeSlot(InventorySlot newSlot, int newSlotIndex) { slot = newSlot; slotIndexPosition = newSlotIndex; Refresh(); } public void Refresh() { //IL_0023: 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_003c: 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_0066: Unknown result type (might be due to invalid IL or missing references) ((Component)b_icon).GetComponent<Image>().sprite = weaponIcon; ColorBlock colors = ((Selectable)((Component)b_icon).GetComponent<Button>()).colors; ((ColorBlock)(ref colors)).normalColor = GetElementColor(); ((ColorBlock)(ref colors)).selectedColor = GetElementColor(); ((Selectable)((Component)b_icon).GetComponent<Button>()).colors = colors; ((Graphic)((Component)this).gameObject.GetComponent<Image>()).color = GetElementColor(icon: false); if (slotIndexPosition == 0 && slot.nodes.Count == 1) { ((Component)b_up).gameObject.SetActive(false); ((Component)b_down).gameObject.SetActive(false); } else { ((Component)b_up).gameObject.SetActive(true); ((Component)b_down).gameObject.SetActive(true); } ((Component)this).gameObject.SetActive(data.weaponUnlocked); if (UltraFunGuns.DebugMode) { ((Component)this).gameObject.SetActive(true); } RefreshPosition(); } public void ButtonPressed(string button) { slot.ButtonPressed(this, button); } private Color GetElementColor(bool icon = true) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0079: 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_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_0092: 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_009d: 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_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_00ac: 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) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) Color white = Color.white; if (icon) { white = MonoSingleton<ColorBlindSettings>.Instance.variationColors[(int)nodeInfo.IconColor]; if (!data.weaponEnabled) { white *= 0.5f; } white.a = 255f; } else { white = MonoSingleton<ColorBlindSettings>.Instance.variationColors[(int)nodeInfo.IconColor]; white *= 0.5f; if (!data.weaponEnabled) { white *= 0.4f; } white.a = 110f; } return white; } public void Disappear() { Object.Destroy((Object)(object)((Component)this).gameObject); } public override string ToString() { string arg = (data.weaponEnabled ? "(x)" : "( )"); return string.Format("{2} [{0}] {1}", slot.ID, data.weaponKey, arg); } public void OnPointerEnter(PointerEventData eventData) { if (!mousedOver) { mousedOver = true; controller.SetCardWeaponInfo(nodeInfo); ((MonoBehaviour)this).StartCoroutine(MouseHeldSequence()); } } public void OnPointerExit(PointerEventData eventData) { mousedOver = false; ((MonoBehaviour)this).StopAllCoroutines(); if ((Object)(object)controller != (Object)null) { controller.SetCardActive(enabled: false); } } private IEnumerator MouseHeldSequence() { yield return (object)new WaitForSecondsRealtime(Data.Config.Data.MouseOverNodeTime); while (mousedOver) { if ((Object)(object)controller != (Object)null) { controller.SetCardActive(enabled: true); } yield return (object)new WaitForEndOfFrame(); } } private void OnDisable() { mousedOver = false; } } [Serializable] public class InventoryNodeData { public string weaponKey; public bool weaponEnabled; public bool weaponUnlocked; public InventoryNodeData(string weaponKey, bool enabled = true, bool weaponUnlocked = true) { this.weaponKey = weaponKey; weaponEnabled = enabled; this.weaponUnlocked = weaponUnlocked; } public InventoryNodeData() { } } public class InventorySlot : MonoBehaviour { private InventoryController inventoryController; public int ID; public List<InventoryNode> nodes = new List<InventoryNode>(); public RectTransform r_transform; public int ActiveNodeCount => nodes.Where((InventoryNode x) => x.data.weaponUnlocked).Count(); public void Initialize(InventorySlotData slotData, int ID, InventoryController inventoryController) { this.inventoryController = inventoryController; r_transform = ((Component)((Component)this).transform.Find("Slot")).GetComponent<RectTransform>(); this.ID = ID; SetupNodes(slotData.slotNodes); } public void ChangeNodeOrder(InventoryNode node, int slotsToMove) { List<InventoryNode> list = nodes; int num = node.slotIndexPosition + slotsToMove; list.Remove(node); if (num > list.Count) { list.Insert(0, node); } else if (num < 0) { list.Add(node); } else { list.Insert(num, node); } nodes = list; Refresh(); } public void InsertNode(InventoryNode node) { RectTransform component = ((Component)node).GetComponent<RectTransform>(); ((Transform)component).SetParent((Transform)(object)r_transform); int count = nodes.Count; int newSlotIndex = node.slotIndexPosition; if (node.slotIndexPosition >= count) { nodes.Add(node); newSlotIndex = count; } else { nodes.Insert(node.slotIndexPosition, node); } node.ChangeSlot(this, newSlotIndex); } public void RemoveNode(InventoryNode node) { nodes.Remove(node); } private void CreateNewNode(InventoryNodeData nodeData, int slotIndex) { InventoryNode component = Object.Instantiate<GameObject>(InventoryControllerDeployer.UFGInventoryNode, (Transform)(object)r_transform).GetComponent<InventoryNode>(); nodes.Add(component); component.Initialize(nodeData, this, slotIndex); } public void ButtonPressed(InventoryNode node, string button) { inventoryController.ButtonPressed(node, this, button); } private void SetupNodes(InventoryNodeData[] nodeDatas) { if (nodes.Count > 0) { foreach (InventoryNode node in nodes) { nodes.Remove(node); node.Disappear(); } nodes.Clear(); } for (int i = 0; i < nodeDatas.Length; i++) { CreateNewNode(nodeDatas[i], i); } Refresh(); } public void Refresh() { for (int i = 0; i < nodes.Count; i++) { int siblingIndex = ((Component)nodes[i]).transform.GetSiblingIndex(); if (siblingIndex != i) { ((Transform)r_transform).GetChild(i).SetSiblingIndex(siblingIndex); ((Component)nodes[i]).transform.SetSiblingIndex(i); } nodes[i].slotIndexPosition = i; nodes[i].Refresh(); } } public InventorySlotData GetSlotData() { List<InventoryNodeData> list = new List<InventoryNodeData>(); foreach (InventoryNode node in nodes) { InventoryNodeData data = node.data; list.Add(data); } return new InventorySlotData(list.ToArray()); } public override string ToString() { return $"SLOT{ID} [{nodes.Count}]"; } } [Serializable] public class InventorySlotData { public InventoryNodeData[] slotNodes; public InventorySlotData(InventoryNodeData[] slotNodes) { this.slotNodes = slotNodes; } public InventorySlotData() { slotNodes = new InventoryNodeData[0]; } } public class WeaponInfoCard : MonoBehaviour { private Canvas canvas; public bool useCanvasScaler = true; public bool scaleWithDisplaySize = false; private Text header; private Text body; private Image background; private Shadow headerShadow; private UFGWeapon info; private static Vector2 mousePos; private const int referenceDpi = 96; public RectTransform RectTransform { get; private set; } public void Awake() { canvas = ((Component)this).GetComponentInParent<Canvas>(); RectTransform = ((Component)this).GetComponent<RectTransform>(); ((Component)this).gameObject.AddComponent<HudOpenEffect>(); background = ((Component)((Component)this).transform.Find("Container/HeaderBackground")).GetComponent<Image>(); header = ((Component)((Component)background).transform.Find("HeaderText")).GetComponent<Text>(); body = ((Component)((Component)this).transform.Find("Container/BodyBackground/BodyText")).GetComponent<Text>(); headerShadow = ((Component)header).GetComponent<Shadow>(); ((Component)this).gameObject.SetActive(false); } public void SetWeaponInfo(UFGWeapon info) { this.info = info; Refresh(); } private void Refresh() { //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_0046: 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_0059: 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_0065: 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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) header.text = info.DisplayName; body.text = info.GetCodexText(); Color val = info.IconColor.ToColor(); ((Graphic)header).color = val; headerShadow.effectColor = new Color(val.r, val.g, val.b, val.a * 0.3803f); ((Graphic)background).color = new Color(val.r, val.g, val.b, val.a * 0.3568f); } private void Update() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: 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) mousePos = Vector2.op_Implicit(Input.mousePosition); if ((Object)(object)RectTransform != (Object)null) { UpdatePosition(mousePos); } } private void UpdatePosition(Vector2 mousePos) { //IL_0021: 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_0049: 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_005c: Unknown result type (might be due to invalid IL or missing references) float scaleFactor = canvas.scaleFactor; float num = Screen.height; float num2 = Screen.width; float num3 = Mathf.InverseLerp(0f, num2, mousePos.x); float num4 = Mathf.InverseLerp(0f, num, mousePos.y); RectTransform.pivot = new Vector2(num3, num4); RectTransform.anchoredPosition = mousePos / scaleFactor; } private void OnEnable() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)RectTransform != (Object)null) { float inventoryInfoCardScale = Data.Config.Data.InventoryInfoCardScale; ((Transform)RectTransform).localScale = new Vector3(inventoryInfoCardScale, inventoryInfoCardScale, inventoryInfoCardScale); } } } public class AbilityMeter : MonoBehaviour { [SerializeField] private Image fillImage; [SerializeField] private Gradient fillGradient; public float AnimateSpeed = 0.34f; private float displayedAmount; public float Amount { get; private set; } public void SetAmount(float newAmount) { Amount = Mathf.Clamp01(newAmount); } private void Update() { //IL_0086: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)fillImage == (Object)null) && (displayedAmount != Amount || fillImage.fillAmount != displayedAmount)) { displayedAmount = Mathf.MoveTowards(displayedAmount, Amount, AnimateSpeed * Time.deltaTime); fillImage.fillAmount = displayedAmount; ((Graphic)fillImage).color = fillGradient.Evaluate(displayedAmount); } } private void OnEnable() { displayedAmount = Amount; } private void OnDsiable() { displayedAmount = Amount; } } public class UFGInformationPage : MonoBehaviour { private Button bugReportButton; private Button githubButton; private Button kofiButton; private Button thunderstoreButton; private Button discordButton; private Button twitterButton; private Button youtubeButton; private Image pfpImage; private Text changelogHeaderText; private Text changelogBodyText; private static Sprite pfpSprite; private void Start() { pfpImage = ((Component)this).transform.LocateComponent<Image>("Image_Profile"); LoadPFP(); changelogHeaderText = ((Component)this).transform.LocateComponent<Text>("Text_ChangelogHeader"); changelogHeaderText.text = "Changelog (1.3.5)"; changelogBodyText = ((Component)this).transform.LocateComponent<Text>("Text_ChangelogBody"); changelogBodyText.text = "- Fix Version mistake causing incorrect out of date pop-up\n\n-- 1.3.4 --\n- Recompile mod for Patch 15d\n\n-- 1.3.3 --\n- Fixed directory error preventing load.\n\n-- 1.3.2 --\n- Updated for Patch 15\n- Fixed Colossal Hammer default settings to function\n- Fixed style formatting errors\n- Moved data folder into BepInEx/config/UltraFunGuns"; bugReportButton = ((Component)this).transform.LocateComponent<Button>("Button_BugReport"); bugReportButton.SetClickAction(delegate { Application.OpenURL("https://github.com/Hydraxous/UltraFunGuns/issues/new/choose"); }); githubButton = ((Component)this).transform.LocateComponent<Button>("Button_Github"); githubButton.SetClickAction(delegate { Application.OpenURL("https://github.com/Hydraxous/UltraFunGuns"); }); kofiButton = ((Component)this).transform.LocateComponent<Button>("Button_Kofi"); kofiButton.SetClickAction(delegate { Application.OpenURL("https://ko-fi.com/Hydraxous/"); }); thunderstoreButton = ((Component)this).transform.LocateComponent<Button>("Button_Thunderstore"); thunderstoreButton.SetClickAction(delegate { Application.OpenURL("https://thunderstore.io/c/ultrakill/p/Hydraxous/"); }); discordButton = ((Component)this).transform.LocateComponent<Button>("Button_Discord"); discordButton.SetClickAction(delegate { Application.OpenURL("https://discord.gg/kCHnwMDPt4"); }); twitterButton = ((Component)this).transform.LocateComponent<Button>("Button_Twitter"); twitterButton.SetClickAction(delegate { Application.OpenURL("https://twitter.com/Hydraxous"); }); youtubeButton = ((Component)this).transform.LocateComponent<Button>("Button_Youtube"); youtubeButton.SetClickAction(delegate { Application.OpenURL("https://youtube.com/@Hydraxouz"); }); } private void LoadPFP() { if ((Object)(object)pfpSprite != (Object)null) { if ((Object)(object)pfpImage != (Object)null) { pfpImage.sprite = pfpSprite; } return; } TextureLoader.DownloadTexture("https://avatars.githubusercontent.com/hydraxous", delegate(TextureLoader.TextureDownloadResult r) { //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) if (r.Success) { pfpSprite = Sprite.Create(r.Texture, new Rect(0f, 0f, (float)((Texture)r.Texture).width, (float)((Texture)r.Texture).height), Vector2.zero); if ((Object)(object)pfpImage != (Object)null) { pfpImage.sprite = pfpSprite; } } else { Debug.LogError((object)"Error retrieving picture..."); } }); } } public class WeaponDeployer : MonoBehaviour { private static ConfigKeybind[] slotKeys = (ConfigKeybind[])(object)new ConfigKeybind[4] { UFGInput.Slot7Key, UFGInput.Slot8Key, UFGInput.Slot9Key, UFGInput.Slot10Key }; private GunControl gc; private List<List<string>> weaponKeySlots = new List<List<string>>(); private List<List<GameObject>> customSlots = new List<List<GameObject>> { new List<GameObject>(), new List<GameObject>(), new List<GameObject>(), new List<GameObject>() }; public int WeaponsDeployed { get; private set; } private void Awake() { gc = ((Component)this).GetComponent<GunControl>(); } public List<List<string>> CreateWeaponKeyset(Loadout invControllerData) { List<List<string>> list = new List<List<string>>(); for (int i = 0; i < invControllerData.slots.Length; i++) { List<string> list2 = new List<string>(); for (int j = 0; j < invControllerData.slots[i].slotNodes.Length; j++) { if (invControllerData.slots[i].slotNodes[j].weaponEnabled && (invControllerData.slots[i].slotNodes[j].weaponUnlocked || UltraFunGuns.DebugMode)) { list2.Add(invControllerData.slots[i].slotNodes[j].weaponKey); } } list.Add(list2); } return list; } public void DisposeWeapons() { for (int i = 0; i < customSlots.Count; i++) { for (int j = 0; j < customSlots[i].Count; j++) { GameObject val = customSlots[i][j]; customSlots[i][j] = null; Object.Destroy((Object)(object)val); } customSlots[i].Clear(); } } public void DeployWeapons() { DisposeWeapons(); weaponKeySlots = CreateWeaponKeyset(Data.Loadout.Data); if (weaponKeySlots.Count <= 0) { return; } WeaponsDeployed = 0; List<UFGWeapon> list = new List<UFGWeapon>(); string text = ""; for (int i = 0; i < weaponKeySlots.Count; i++) { if (weaponKeySlots[i].Count <= 0) { continue; } foreach (string item in weaponKeySlots[i]) { if (!WeaponManager.Weapons.TryGetValue(item, out var value)) { HydraLogger.Log("Weaponkey " + item + " doesn't exist. Someone seriously screwed up (it was Hydra).", DebugChannel.Fatal); ((Behaviour)this).enabled = false; return; } if (!HydraLoader.prefabRegistry.TryGetValue(item, out var value2)) { HydraLogger.Log("Weapon Manager could not retrieve " + item + " from prefab registry. Skipping...", DebugChannel.Error); continue; } value2.layer = 13; Transform[] componentsInChildren = value2.GetComponentsInChildren<Transform>(); Transform[] array = componentsInChildren; foreach (Transform val in array) { ((Component)val).gameObject.layer = 13; } GameObject val2 = Object.Instantiate<GameObject>(value2, ((Component)this).transform); val2.AddComponent(value.Type); val2.S