Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of SniperRevived v0.1.4
SniperRevived.dll
Decompiled a day ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using EntityStates; using HG; using HG.BlendableTypes; using HarmonyLib; using JetBrains.Annotations; using KinematicCharacterController; using Microsoft.CodeAnalysis; using R2API; using RoR2; using RoR2.CharacterAI; using RoR2.Orbs; using RoR2.Projectile; using RoR2.Skills; using RoR2.UI; using SniperRevived.Assets; using SniperRevived.Audio; using SniperRevived.Compat; using SniperRevived.Components; using SniperRevived.Content; using SniperRevived.Orbs; using SniperRevived.Skills; using SniperRevived.States; using SniperRevived.UI; using TMPro; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.Rendering; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("SniperRevived")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.1.0.0")] [assembly: AssemblyInformationalVersion("0.1.0+53d5e2a1dd151d1669dd80a671675adad8336acf")] [assembly: AssemblyProduct("SniperRevived")] [assembly: AssemblyTitle("SniperRevived")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.1.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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; } } } namespace SniperRevived { [BepInPlugin("com.DarkSky.SniperRevived", "SniperRevived", "0.1.4")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class SniperRevivedPlugin : BaseUnityPlugin { public const string Guid = "com.DarkSky.SniperRevived"; public const string Name = "SniperRevived"; public const string Version = "0.1.4"; internal static ManualLogSource Log; internal static SniperRevivedPlugin Instance { get; private set; } private void Awake() { Instance = this; Log = ((BaseUnityPlugin)this).Logger; try { MissingShaderGuard.Apply(); SniperSounds.Init(((BaseUnityPlugin)this).Config); SniperAssets.Load(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location)); Tokens.Register(); SniperMaterials.Build(); FireSnipe.LoadEffects(); DecoyDeath.LoadEffects(); ShockOrb.LoadEffects(); SporeCloud.LoadVisual(); SniperSkills.Create(); SniperCrosshair.Create(((BaseUnityPlugin)this).Config); ScopeOverlay.Init(); SniperItemDisplays.Create(); SniperBody.Create(); SniperSurvivor.Create(); SniperDecoy.Create(); SniperEclipse.Create(((BaseUnityPlugin)this).Config); Log.LogInfo((object)"SniperRevived 0.1.4 content created"); RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(SniperItemDisplays.Populate)); RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(ReportCatalogState)); HUD.onHudTargetChangedGlobal += ReloadBar.OnHudTargetChanged; } catch (Exception arg) { Log.LogError((object)string.Format("{0} failed to initialize: {1}", "SniperRevived", arg)); } } private void Update() { SniperSounds.Tick(); } private static void ReportCatalogState() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected I4, but got Unknown //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected I4, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) BodyIndex val = BodyCatalog.FindBodyIndex(SniperBody.bodyPrefab); BodyIndex val2 = BodyCatalog.FindBodyIndex(SniperDecoy.bodyPrefab); SurvivorDef val3 = SurvivorCatalog.FindSurvivorDefFromBody(SniperBody.bodyPrefab); SkillLocator component = SniperBody.bodyPrefab.GetComponent<SkillLocator>(); Log.LogInfo((object)($"Catalogs ready: body index {(int)val}, decoy body index {(int)val2}, " + string.Format("survivor {0} (index {1}), ", Object.op_Implicit((Object)(object)val3) ? val3.cachedName : "MISSING", (!Object.op_Implicit((Object)(object)val3)) ? (-1) : ((int)val3.survivorIndex)) + $"decoy master index {(int)SniperDecoy.masterPrefab.GetComponent<CharacterMaster>().masterIndex}, " + $"skill slots {component.skillSlotCount}")); } } } namespace SniperRevived.UI { public class ReloadBar : MonoBehaviour { private const string ClusterPath = "MainContainer/MainUIArea/SpringCanvas/BottomCenterCluster"; private static readonly Color BarBorderColor = new Color(0f, 0f, 0f, 0.7f); private static readonly Color BarBackgroundColor = new Color(0.05f, 0.05f, 0.05f, 0.6f); private static readonly Color BarPerfectColor = new Color(0.7f, 0.9f, 0.8f, 0.8f); private static readonly Color BarGoodColor = new Color(0.5f, 0.5f, 0.5f, 0.7f); private static readonly Dictionary<ReloadParams, Sprite> backgrounds = new Dictionary<ReloadParams, Sprite>(); private static Sprite handleSprite; private HUD hud; private GameObject barHolder; private Image background; private RectTransform handle; private GameObject trackedObject; private CharacterBody body; private SniperController controller; private ReloadParams shownParams; internal static void OnHudTargetChanged(HUD hud) { if (Object.op_Implicit((Object)(object)hud)) { GameObject targetBodyObject = hud.targetBodyObject; if (Object.op_Implicit((Object)(object)targetBodyObject) && Object.op_Implicit((Object)(object)targetBodyObject.GetComponent<SniperController>()) && !Object.op_Implicit((Object)(object)((Component)hud).GetComponentInChildren<ReloadBar>(true))) { Create(hud); } } } private static void Create(HUD hud) { //IL_0035: 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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) Transform val = ((Component)hud).transform.Find("MainContainer/MainUIArea/SpringCanvas/BottomCenterCluster"); if (!Object.op_Implicit((Object)(object)val)) { SniperRevivedPlugin.Log.LogWarning((object)"HUD has no MainContainer/MainUIArea/SpringCanvas/BottomCenterCluster; reload bar placed on the HUD root"); val = ((Component)hud).transform; } RectTransform obj = Ui.Rect(val, "SniperRevivedReloadBar", Vector2.zero, new Vector2(512f, 64f)); ((Transform)obj).localPosition = new Vector3(0f, 256f, 0f); ((Transform)obj).localScale = new Vector3(0.5f, 0.5f, 1f); RectTransform val2 = Ui.Stretch((Transform)(object)obj, "BarHolder", Vector2.zero, Vector2.one, Vector2.zero); ((Transform)val2).localPosition = new Vector3(0f, 330f, 0f); Image val3 = Ui.Image(Ui.Stretch((Transform)(object)val2, "Background", new Vector2(0f, 0.1f), new Vector2(1f, 0.9f), Vector2.zero), null, Color.white); RectTransform rt = Ui.Stretch((Transform)(object)Ui.Stretch((Transform)(object)val2, "Handle Slide Area", Vector2.zero, Vector2.one, Vector2.zero), "Handle", Vector2.zero, new Vector2(0f, 1f), new Vector2(16f, 0f)); Ui.Image(rt, HandleSprite(), Color.white); ((Component)val2).gameObject.SetActive(false); ReloadBar reloadBar = ((Component)obj).gameObject.AddComponent<ReloadBar>(); reloadBar.hud = hud; reloadBar.barHolder = ((Component)val2).gameObject; reloadBar.background = val3; reloadBar.handle = rt; } private void LateUpdate() { //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) GameObject val = (Object.op_Implicit((Object)(object)hud) ? hud.targetBodyObject : null); if ((Object)(object)val != (Object)(object)trackedObject) { trackedObject = val; body = (Object.op_Implicit((Object)(object)val) ? val.GetComponent<CharacterBody>() : null); controller = (Object.op_Implicit((Object)(object)val) ? val.GetComponent<SniperController>() : null); } bool flag = Object.op_Implicit((Object)(object)controller) && Object.op_Implicit((Object)(object)body) && body.hasEffectiveAuthority && controller.BarVisible; Ui.SetActive(barHolder, flag); if (flag) { if (controller.reload != shownParams) { shownParams = controller.reload; background.sprite = BackgroundSprite(shownParams); } float num = Mathf.Clamp01(controller.BarFraction); handle.anchorMin = new Vector2(num, 0f); handle.anchorMax = new Vector2(num, 1f); } } private static Sprite BackgroundSprite(ReloadParams reload) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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) if (!backgrounds.TryGetValue(reload, out var value)) { value = Ui.Sprite(Ui.BarTexture(512, 64, 8, 5, BarBorderColor, BarBackgroundColor, 4, new Ui.ColorRegion(reload.perfectStart, reload.perfectEnd, BarPerfectColor), new Ui.ColorRegion(reload.goodStart, reload.goodEnd, BarGoodColor))); backgrounds[reload] = value; } return value; } private static Sprite HandleSprite() { //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) if (!Object.op_Implicit((Object)(object)handleSprite)) { handleSprite = Ui.Sprite(Ui.BarTexture(128, 640, 64, 16, Color.black, Color.white, 4)); } return handleSprite; } } internal class ScopeOverlay : MonoBehaviour { private const string ComputeKey = "assets/__export/shaders/computerefractblur.compute"; private const string MaskKey = "assets/__export/icons/ui/image 25.png"; private static bool hooked; private static bool loadFailed; private static ComputeShader shader; private static Texture maskTexture; private static int kernelId = -1; private RenderTexture renderTexture; private bool ready; internal static void Init() { if (hooked || loadFailed) { return; } shader = SniperAssets.bundle.LoadAsset<ComputeShader>("assets/__export/shaders/computerefractblur.compute"); maskTexture = SniperAssets.bundle.LoadAsset<Texture>("assets/__export/icons/ui/image 25.png"); if (!Object.op_Implicit((Object)(object)shader) || !Object.op_Implicit((Object)(object)maskTexture)) { loadFailed = true; SniperRevivedPlugin.Log.LogWarning((object)"Scope refraction assets missing; keeping vignette-only scope"); return; } kernelId = shader.FindKernel("RefractionBlur"); if (kernelId < 0) { loadFailed = true; SniperRevivedPlugin.Log.LogWarning((object)"Scope refraction kernel missing; keeping vignette-only scope"); } else { CameraRigController.onCameraTargetChanged += OnCameraTargetChanged; hooked = true; } } private static void OnCameraTargetChanged(CameraRigController rig, GameObject target) { if (Object.op_Implicit((Object)(object)rig) && Object.op_Implicit((Object)(object)rig.sceneCam) && !Object.op_Implicit((Object)(object)((Component)rig.sceneCam).GetComponent<ScopeOverlay>())) { ((Component)rig.sceneCam).gameObject.AddComponent<ScopeOverlay>(); } } private void Awake() { //IL_0036: 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_0047: Expected O, but got Unknown if (loadFailed || !Object.op_Implicit((Object)(object)shader) || !Object.op_Implicit((Object)(object)maskTexture)) { ((Behaviour)this).enabled = false; return; } renderTexture = new RenderTexture(Screen.width, Screen.height, 0, (RenderTextureFormat)11, (RenderTextureReadWrite)1) { enableRandomWrite = true }; renderTexture.Create(); ready = true; } private void OnDestroy() { if (Object.op_Implicit((Object)(object)renderTexture)) { renderTexture.Release(); renderTexture = null; } } private void OnRenderImage(RenderTexture source, RenderTexture destination) { if (!ready || !ShouldBlur()) { Graphics.Blit((Texture)(object)source, destination); return; } EnsureSize(); shader.SetTexture(kernelId, "_Input", (Texture)(object)source); shader.SetTexture(kernelId, "_Map", maskTexture); shader.SetTexture(kernelId, "_Output", (Texture)(object)renderTexture); shader.Dispatch(kernelId, Mathf.CeilToInt((float)((Texture)renderTexture).width / 8f), Mathf.CeilToInt((float)((Texture)renderTexture).height / 8f), 1); Graphics.Blit((Texture)(object)renderTexture, destination); } private void EnsureSize() { //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) //IL_0050: Expected O, but got Unknown if (((Texture)renderTexture).width != Screen.width || ((Texture)renderTexture).height != Screen.height) { renderTexture.Release(); renderTexture = new RenderTexture(Screen.width, Screen.height, 0, (RenderTextureFormat)11, (RenderTextureReadWrite)1) { enableRandomWrite = true }; renderTexture.Create(); } } private static bool ShouldBlur() { LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser(); CharacterBody val = ((firstLocalUser != null) ? firstLocalUser.cachedBody : null); if (!Object.op_Implicit((Object)(object)val)) { return false; } EntityStateMachine[] components = ((Component)val).GetComponents<EntityStateMachine>(); foreach (EntityStateMachine val2 in components) { if (!(val2.customName != "Scope")) { if (!(val2.state is SteadyAim)) { return val2.state is QuickScope; } return true; } } return false; } } internal enum NibType { ArrowShort, ArrowLong, Bar, None } internal static class SniperCrosshair { internal static GameObject prefab; private static ConfigEntry<NibType> topNib; private static ConfigEntry<NibType> leftNib; private static ConfigEntry<NibType> rightNib; private static ConfigEntry<bool> flip; private static ConfigEntry<bool> showDot; private static ConfigEntry<float> scale; private static ConfigEntry<float> emptyAlpha; private static ConfigEntry<float> badAlpha; private static ConfigEntry<float> goodAlpha; private static ConfigEntry<float> perfectAlpha; private static ConfigEntry<float> reloadIndScale; private static ConfigEntry<float> reloadIndXOffset; private static ConfigEntry<float> reloadIndYOffset; private static ConfigEntry<float> zoomSpeed; private static ConfigEntry<bool> zoomNoPersist; private static Sprite white; internal static float EmptyAlpha => emptyAlpha.Value; internal static float BadAlpha => badAlpha.Value; internal static float GoodAlpha => goodAlpha.Value; internal static float PerfectAlpha => perfectAlpha.Value; internal static float ReloadIndicatorScale => reloadIndScale.Value; internal static float ReloadIndicatorX => reloadIndXOffset.Value; internal static float ReloadIndicatorY => reloadIndYOffset.Value; internal static float ZoomSpeed => zoomSpeed.Value; internal static bool ZoomNoPersist => zoomNoPersist.Value; internal static Sprite PipSprite => SniperAssets.Icon("ui/image 4.png"); internal static Sprite HolderSprite => SniperAssets.Icon("ui/image 2.png"); internal static Sprite BulletSprite => SniperAssets.Icon("ui/image 13.png"); internal static void Create(ConfigFile config) { //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Expected O, but got Unknown //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) topNib = config.Bind<NibType>("Crosshair", "Top nib type", NibType.Bar, "The shape of the upper crosshair nib"); leftNib = config.Bind<NibType>("Crosshair", "Left nib type", NibType.Bar, "The shape of the left crosshair nib"); rightNib = config.Bind<NibType>("Crosshair", "Right nib type", NibType.Bar, "The shape of the right crosshair nib"); flip = config.Bind<bool>("Crosshair", "Flip Vertical", false, "Should the crosshair be inverted vertically?"); showDot = config.Bind<bool>("Crosshair", "Dot in center", true, "Should the center dot be shown?"); scale = config.Bind<float>("Crosshair", "Size", 1f, "The overall size of the crosshair"); emptyAlpha = config.Bind<float>("Crosshair", "Empty Opacity", 1f, "0.0 - 1.0, the opacity of the empty reload indicator"); badAlpha = config.Bind<float>("Crosshair", "Bad Opacity", 1f, "0.0 - 1.0, the opacity of the bad reload indicator"); goodAlpha = config.Bind<float>("Crosshair", "Good Opacity", 1f, "0.0 - 1.0, the opacity of the good reload indicator"); perfectAlpha = config.Bind<float>("Crosshair", "Perfect Opacity", 1f, "0.0 - 1.0, the opacity of the perfect reload indicator"); reloadIndScale = config.Bind<float>("Crosshair", "Reload Indicator size", 1f, "The overall size of the reload indicator"); reloadIndXOffset = config.Bind<float>("Crosshair", "Reload Indicator X offset", 0f, "The position of the reload indicator on the X axis"); reloadIndYOffset = config.Bind<float>("Crosshair", "Reload Indicator Y offset", 45f, "The position of the reload indicator on the Y axis"); zoomSpeed = config.Bind<float>("Scope", "Zoom speed", 1f, "The speed that zoom changes"); zoomNoPersist = config.Bind<bool>("Scope", "Reset zoom on scope", true, "Should scope reset to default zoom on each use?"); GameObject val = new GameObject("SniperRevivedUiPrefabs"); val.SetActive(false); Object.DontDestroyOnLoad((Object)val); RectTransform obj = Ui.Rect(val.transform, "SniperRevivedCrosshair", Vector2.zero, Vector2.zero); ((Component)obj).gameObject.AddComponent<HudElement>(); CrosshairController obj2 = ((Component)obj).gameObject.AddComponent<CrosshairController>(); obj2.spriteSpreadPositions = (SpritePosition[])(object)new SpritePosition[0]; obj2.skillStockSpriteDisplays = (SkillStockSpriteDisplay[])(object)new SkillStockSpriteDisplay[0]; obj2.remapSprites = (RawImage[])(object)new RawImage[0]; obj2.maxSpreadAngle = 1f; BuildScope(obj); BuildMain(obj); GridLayoutGroup obj3 = ((Component)Ui.Rect((Transform)(object)obj, "ReloadIndHolder", new Vector2(0f, 45f), new Vector2(20f, 20f))).gameObject.AddComponent<GridLayoutGroup>(); obj3.cellSize = new Vector2(25f, 25f); ((LayoutGroup)obj3).childAlignment = (TextAnchor)7; obj3.startCorner = (Corner)1; obj3.startAxis = (Axis)0; obj3.constraint = (Constraint)2; obj3.constraintCount = 1; BuildPartialScope(obj); ((Component)obj).gameObject.AddComponent<SniperCrosshairController>(); prefab = ((Component)obj).gameObject; } private static void BuildMain(RectTransform root) { //IL_0006: 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_0039: 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_00d1: 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_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) RectTransform val = Ui.Rect((Transform)(object)root, "Main", Vector2.zero, new Vector2(100f, 100f)); float num = 0.6f * scale.Value; ((Transform)val).localScale = new Vector3(num, num, 1f); ((Transform)val).localEulerAngles = new Vector3(0f, 0f, flip.Value ? 180f : 0f); Nib(val, "NibT", 0f, topNib.Value); Nib(val, "NibR", -120f, rightNib.Value); Nib(val, "NibL", 120f, leftNib.Value); if (showDot.Value) { RectTransform parent = Ui.Rect((Transform)(object)val, "Dot", Vector2.zero, new Vector2(100f, 100f)); Circle(parent, "BG", 25f, Color.black); Circle(parent, "Fill", 15f, Color.white); } } private static void Nib(RectTransform main, string name, float angle, NibType type) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00de: 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_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_012e: 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_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_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) RectTransform val = Ui.Rect((Transform)(object)main, name, Vector2.zero, new Vector2(100f, 100f)); ((Transform)val).localEulerAngles = new Vector3(0f, 0f, angle); Rect uv = default(Rect); ((Rect)(ref uv))..ctor(0.177f, 0.044f, 0.646f, 0.933f); switch (type) { case NibType.ArrowShort: { RectTransform obj3 = Ui.Rect((Transform)(object)val, "ArrowShort", new Vector2(0f, 39.87f), new Vector2(32.7f, 58.7f)); ((Transform)obj3).localScale = new Vector3(1f, 0.6f, 1f); Ui.RawImage(obj3, (Texture)(object)SniperAssets.Icon("ui/image.png").texture, uv, Color.white); break; } case NibType.ArrowLong: { RectTransform obj2 = Ui.Rect((Transform)(object)val, "ArrowLong", new Vector2(0f, 34.7f), new Vector2(32.7f, 58.7f)); ((Transform)obj2).localScale = new Vector3(0.5f, 0.8f, 1f); Ui.RawImage(obj2, (Texture)(object)SniperAssets.Icon("ui/image.png").texture, uv, Color.white); break; } case NibType.Bar: { RectTransform obj = Ui.Rect((Transform)(object)val, "Bar", new Vector2(0f, 32.8f), new Vector2(56.1f, 19.4f)); ((Transform)obj).localEulerAngles = new Vector3(0f, 0f, 90f); ((Transform)obj).localScale = new Vector3(0.6f, 0.5f, 1f); Ui.RawImage(obj, (Texture)(object)SniperAssets.Icon("ui/image 1.png").texture, new Rect(0.02f, 0.37f, 0.96f, 0.26f), Color.white); break; } } } private static void Circle(RectTransform parent, string name, float diameter, Color color) { //IL_0002: 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_002e: 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_005c: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) RectTransform parent2 = Ui.Rect((Transform)(object)parent, name, Vector2.zero, new Vector2(diameter, diameter)); Sprite sprite = SniperAssets.Icon("ui/image 12.png"); RectTransform obj = Ui.Stretch((Transform)(object)parent2, "HalfCirc", new Vector2(0.25f, 0f), new Vector2(0.75f, 0.5f), Vector2.zero); ((Transform)obj).localEulerAngles = new Vector3(0f, 0f, 180f); Ui.Image(obj, sprite, color); Ui.Image(Ui.Stretch((Transform)(object)parent2, "HalfCirc", new Vector2(0.25f, 0.5f), new Vector2(0.75f, 1f), Vector2.zero), sprite, color); } private static void BuildPartialScope(RectTransform root) { //IL_0006: 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_0025: 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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_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_0089: 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_00de: 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_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Expected O, but got Unknown //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) RectTransform parent = Ui.Rect((Transform)(object)root, "PartialScope", Vector2.zero, new Vector2(100f, 100f)); RectTransform obj = Ui.Rect((Transform)(object)parent, "ChargeAndReadyHolder", Vector2.zero, new Vector2(100f, 100f)); Sprite sprite = SniperAssets.Icon("ui/image 21.png"); RectTransform obj2 = Ui.Stretch((Transform)(object)obj, "HexCompositeIndicator", Vector2.zero, Vector2.one, new Vector2(512f, 600f)); Ui.Image(obj2, sprite, Color.white); Image obj3 = Ui.Image(Ui.Stretch((Transform)(object)obj2, "CompositeIndicatorFill", Vector2.zero, Vector2.one, Vector2.zero), sprite, Color.green); obj3.type = (Type)3; obj3.fillMethod = (FillMethod)4; obj3.fillOrigin = 0; obj3.fillClockwise = true; obj3.fillAmount = 0f; ((Component)obj).gameObject.SetActive(false); RectTransform obj4 = Ui.Rect((Transform)(object)parent, "StockHolder", new Vector2(540f, 0f), new Vector2(500f, 200f)); ((Transform)obj4).localEulerAngles = new Vector3(0f, 0f, 90f); GridLayoutGroup obj5 = ((Component)obj4).gameObject.AddComponent<GridLayoutGroup>(); ((LayoutGroup)obj5).padding = new RectOffset(-30, -30, 0, 0); obj5.cellSize = new Vector2(100f, 100f); obj5.spacing = new Vector2(-60f, 0f); ((LayoutGroup)obj5).childAlignment = (TextAnchor)4; obj5.startCorner = (Corner)2; obj5.startAxis = (Axis)0; obj5.constraint = (Constraint)2; obj5.constraintCount = 2; ((Component)obj4).gameObject.SetActive(false); } private static void BuildScope(RectTransform root) { //IL_0000: 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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_013c: 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_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0175: 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_0190: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: 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_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Unknown result type (might be due to invalid IL or missing references) //IL_0354: Unknown result type (might be due to invalid IL or missing references) //IL_036f: Unknown result type (might be due to invalid IL or missing references) //IL_0393: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) white = Ui.Sprite(UiTexture(Color.white)); RectTransform val = Ui.Rect((Transform)(object)root, "Overlay", Vector2.zero, Vector2.zero); CanvasGroup obj = ((Component)val).gameObject.AddComponent<CanvasGroup>(); obj.alpha = 0f; obj.blocksRaycasts = false; obj.interactable = false; Color color = default(Color); ((Color)(ref color))..ctor(0f, 0f, 0f, 0.94f); Bar(val, "ShadeL", color); Bar(val, "ShadeR", color); Bar(val, "ShadeT", color); Bar(val, "ShadeB", color); RectTransform obj2 = Ui.Rect((Transform)(object)val, "Lens", Vector2.zero, new Vector2(512f, 512f)); Ui.RawImage(obj2, (Texture)(object)LensTexture(), new Rect(0f, 0f, 1f, 1f), Color.white); RectTransform parent = Ui.Rect((Transform)(object)obj2, "Reticle", Vector2.zero, Vector2.zero); Color val2 = default(Color); ((Color)(ref val2))..ctor(0.78f, 0.93f, 0.82f, 0.9f); Color val3 = default(Color); ((Color)(ref val3))..ctor(0.78f, 0.93f, 0.82f, 0.45f); Mark(parent, "HL", new Vector2(-80f, 0f), new Vector2(150f, 1.5f), val2); Mark(parent, "HR", new Vector2(80f, 0f), new Vector2(150f, 1.5f), val2); Mark(parent, "VT", new Vector2(0f, 80f), new Vector2(1.5f, 150f), val2); Mark(parent, "VB", new Vector2(0f, -80f), new Vector2(1.5f, 150f), val2); Mark(parent, "Dot", Vector2.zero, new Vector2(3f, 3f), val2); for (int i = 1; i <= 4; i++) { float num = 10f + (float)i * 36f; Color color2 = ((i % 2 == 0) ? val2 : val3); float num2 = ((i % 2 == 0) ? 11f : 6f); Mark(parent, "TL" + i, new Vector2(0f - num, 0f), new Vector2(1.5f, num2), color2); Mark(parent, "TR" + i, new Vector2(num, 0f), new Vector2(1.5f, num2), color2); } RectTransform obj3 = Ui.Rect((Transform)(object)parent, "Charge", new Vector2(0f, -36f), new Vector2(120f, 2f)); Ui.Image(obj3, white, new Color(1f, 1f, 1f, 0.18f)); RectTransform obj4 = Ui.Stretch((Transform)(object)obj3, "Fill", Vector2.zero, new Vector2(0f, 1f), Vector2.zero); obj4.pivot = new Vector2(0f, 0.5f); obj4.offsetMin = Vector2.zero; obj4.offsetMax = Vector2.zero; Ui.Image(obj4, white, new Color(0.55f, 0.95f, 0.62f, 0.95f)); ScopeText(parent, "Range", new Vector2(0f, -58f), 18f, "0 m"); ScopeText(parent, "Magnification", new Vector2(168f, 0f), 16f, "1x"); ((Component)val).gameObject.SetActive(false); } private static void Bar(RectTransform parent, string name, Color color) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) Ui.Image(Ui.Rect((Transform)(object)parent, name, Vector2.zero, Vector2.zero), white, color); } private static void Mark(RectTransform parent, string name, Vector2 position, Vector2 size, Color color) { //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_000e: Unknown result type (might be due to invalid IL or missing references) Ui.Image(Ui.Rect((Transform)(object)parent, name, position, size), white, color); } private static void ScopeText(RectTransform parent, string name, Vector2 position, float size, string text) { //IL_0002: 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_0050: Unknown result type (might be due to invalid IL or missing references) HGTextMeshProUGUI obj = ((Component)Ui.Rect((Transform)(object)parent, name, position, new Vector2(160f, 28f))).gameObject.AddComponent<HGTextMeshProUGUI>(); ((TMP_Text)obj).text = text; ((TMP_Text)obj).fontSize = size; ((TMP_Text)obj).alignment = (TextAlignmentOptions)514; ((Graphic)obj).color = new Color(0.78f, 0.93f, 0.82f, 0.8f); ((TMP_Text)obj).enableWordWrapping = false; ((Graphic)obj).raycastTarget = false; } private static Texture2D LensTexture() { //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Expected O, but got Unknown //IL_00bc: 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_010d: 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_011c: Unknown result type (might be due to invalid IL or missing references) //IL_011e: 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_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) Color val = default(Color); ((Color)(ref val))..ctor(0f, 0f, 0f, 0f); Color val2 = default(Color); ((Color)(ref val2))..ctor(0f, 0f, 0f, 0.94f); Color val3 = default(Color); ((Color)(ref val3))..ctor(0.78f, 0.93f, 0.82f, 0.95f); Color[] array = (Color[])(object)new Color[262144]; for (int i = 0; i < 512; i++) { for (int j = 0; j < 512; j++) { float num = ((float)j + 0.5f) / 512f * 2f - 1f; float num2 = ((float)i + 0.5f) / 512f * 2f - 1f; float num3 = Mathf.Sqrt(num * num + num2 * num2); Color val4; if (num3 < 0.86499995f) { val4 = val; } else if (num3 < 0.9f) { float num4 = (num3 - 0.86499995f) / 0.035f; val4 = ((num4 < 0.35f) ? Color.Lerp(val, val3, num4 / 0.35f) : Color.Lerp(val3, val2, (num4 - 0.35f) / 0.65f)); } else { val4 = val2; } array[i * 512 + j] = val4; } } Texture2D val5 = new Texture2D(512, 512, (TextureFormat)4, false) { wrapMode = (TextureWrapMode)1, filterMode = (FilterMode)1 }; val5.SetPixels(array); val5.Apply(false, true); return val5; } private static Texture2D UiTexture(Color color) { //IL_0004: 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_000c: 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_001b: Expected O, but got Unknown Texture2D val = new Texture2D(1, 1, (TextureFormat)4, false); val.SetPixel(0, 0, color); val.Apply(false, false); return val; } } public class SniperCrosshairController : MonoBehaviour { private class Stock { internal GameObject root; internal GameObject bullet; internal Image fill; } private static readonly Color EmptyColor = new Color(0.1f, 0.1f, 0.1f, 1f); private static readonly Color BadColor = new Color(1f, 0f, 0f, 1f); private static readonly Color GoodColor = new Color(1f, 1f, 0f, 1f); private static readonly Color PerfectColor = new Color(0f, 1f, 0f, 1f); private static readonly Color HexStartColor = new Color(0f, 0f, 0f, 0.5f); private static readonly Color HexReadyColor = Color.white; private const float HexStartRotation = 90f; private const float HexEndRotation = 0f; private const float UnreadyFillAlpha = 0.35f; private const float MaxRange = 10000f; private const int MaxStocksDisplayed = 20; private const float PipSize = 25f; private HudElement hudElement; private RectTransform reloadHolder; private readonly List<Image> pips = new List<Image>(); private GameObject hexHolder; private RectTransform hex; private Image hexBackground; private Image hexFill; private RectTransform stockHolder; private readonly List<Stock> stocks = new List<Stock>(); private RectTransform main; private RectTransform overlay; private CanvasGroup scopeGroup; private RectTransform lens; private readonly RectTransform[] shades = (RectTransform[])(object)new RectTransform[4]; private RectTransform chargeFill; private TextMeshProUGUI rangeText; private TextMeshProUGUI magnificationText; private CharacterBody trackedBody; private SniperController controller; private void Awake() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Expected O, but got Unknown //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Expected O, but got Unknown //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Expected O, but got Unknown //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Expected O, but got Unknown //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Expected O, but got Unknown //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Expected O, but got Unknown //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Expected O, but got Unknown //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Expected O, but got Unknown //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Expected O, but got Unknown hudElement = ((Component)this).GetComponent<HudElement>(); main = (RectTransform)((Component)this).transform.Find("Main"); reloadHolder = (RectTransform)((Component)this).transform.Find("ReloadIndHolder"); hexHolder = ((Component)((Component)this).transform.Find("PartialScope/ChargeAndReadyHolder")).gameObject; hex = (RectTransform)hexHolder.transform.Find("HexCompositeIndicator"); hexBackground = ((Component)hex).GetComponent<Image>(); hexFill = ((Component)((Transform)hex).Find("CompositeIndicatorFill")).GetComponent<Image>(); stockHolder = (RectTransform)((Component)this).transform.Find("PartialScope/StockHolder"); overlay = (RectTransform)((Component)this).transform.Find("Overlay"); scopeGroup = ((Component)overlay).GetComponent<CanvasGroup>(); lens = (RectTransform)((Transform)overlay).Find("Lens"); shades[0] = (RectTransform)((Transform)overlay).Find("ShadeL"); shades[1] = (RectTransform)((Transform)overlay).Find("ShadeR"); shades[2] = (RectTransform)((Transform)overlay).Find("ShadeT"); shades[3] = (RectTransform)((Transform)overlay).Find("ShadeB"); chargeFill = (RectTransform)((Transform)overlay).Find("Lens/Reticle/Charge/Fill"); Transform val = ((Transform)overlay).Find("Lens/Reticle"); rangeText = ((Component)val.Find("Range")).GetComponent<TextMeshProUGUI>(); magnificationText = ((Component)val.Find("Magnification")).GetComponent<TextMeshProUGUI>(); } private void LateUpdate() { CharacterBody val = (Object.op_Implicit((Object)(object)hudElement) ? hudElement.targetCharacterBody : null); if ((Object)(object)val != (Object)(object)trackedBody) { trackedBody = val; controller = (Object.op_Implicit((Object)(object)val) ? ((Component)val).GetComponent<SniperController>() : null); } bool flag = Object.op_Implicit((Object)(object)controller) && val.hasEffectiveAuthority; UpdateReload(flag); SteadyAim scope = (flag ? controller.activeScope : null); UpdatePartialScope(scope, val); UpdateFullScope(scope, val); } private void UpdateReload(bool own) { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: 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_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0151: 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_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_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_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) bool flag = own && controller.activeScope != null && controller.activeScope.InScope; Ui.SetActive(((Component)reloadHolder).gameObject, own && !flag); if (Object.op_Implicit((Object)(object)main)) { Ui.SetActive(((Component)main).gameObject, !flag); } if (own) { int num = Mathf.Max(1, controller.magazineSize); while (pips.Count < num) { RectTransform rt = Ui.Rect((Transform)(object)reloadHolder, "ReloadIndicator", Vector2.zero, Vector2.zero); pips.Add(Ui.Image(rt, SniperCrosshair.PipSprite, EmptyColor)); } while (pips.Count > num) { Object.Destroy((Object)(object)((Component)pips[pips.Count - 1]).gameObject); pips.RemoveAt(pips.Count - 1); } reloadHolder.sizeDelta = new Vector2(25f * (float)num, 25f); float reloadIndicatorScale = SniperCrosshair.ReloadIndicatorScale; ((Transform)reloadHolder).localScale = new Vector3(reloadIndicatorScale, reloadIndicatorScale, 1f); reloadHolder.anchoredPosition = new Vector2(SniperCrosshair.ReloadIndicatorX, SniperCrosshair.ReloadIndicatorY); int num2 = (controller.RoundChambered ? controller.rounds : 0); Color val = WithAlpha(TierColor(controller.loadedTier), TierAlpha(controller.loadedTier)); Color val2 = WithAlpha(EmptyColor, SniperCrosshair.EmptyAlpha); for (int i = 0; i < pips.Count; i++) { ((Graphic)pips[i]).color = ((i < num2) ? val : val2); } } } private void UpdatePartialScope(SteadyAim scope, CharacterBody body) { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) bool flag = scope != null && !scope.InScope; Ui.SetActive(hexHolder, flag); Ui.SetActive(((Component)stockHolder).gameObject, flag); if (flag) { bool isReady = scope.IsReady; ((Transform)hex).localEulerAngles = new Vector3(0f, 0f, Mathf.Lerp(90f, 0f, scope.ReadyFraction)); ((Graphic)hexBackground).color = (isReady ? HexReadyColor : HexStartColor); hexFill.fillAmount = Mathf.Clamp01(scope.ChargeFraction); Color color = ((Graphic)hexFill).color; color.a = (isReady ? 1f : 0.35f); ((Graphic)hexFill).color = color; UpdateStocks(Object.op_Implicit((Object)(object)body.skillLocator) ? body.skillLocator.secondary : null); } } private void UpdateStocks(GenericSkill slot) { int num = (Object.op_Implicit((Object)(object)slot) ? Mathf.Min(20, slot.maxStock) : 0); int num2 = (Object.op_Implicit((Object)(object)slot) ? Mathf.Min(num, slot.stock) : 0); float num3 = ((Object.op_Implicit((Object)(object)slot) && num2 < num && slot.finalRechargeInterval > 0f) ? Mathf.Clamp01(slot.rechargeStopwatch / slot.finalRechargeInterval) : 0f); while (stocks.Count < num) { stocks.Add(CreateStock(stockHolder)); } while (stocks.Count > num) { Object.Destroy((Object)(object)stocks[stocks.Count - 1].root); stocks.RemoveAt(stocks.Count - 1); } for (int i = 0; i < stocks.Count; i++) { Stock stock = stocks[i]; Ui.SetActive(stock.bullet, i < num2 || (i == num2 && num3 > 0f)); stock.fill.fillAmount = ((i < num2) ? 1f : num3); } } private static Stock CreateStock(RectTransform parent) { //IL_0006: 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_0026: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) RectTransform val = Ui.Rect((Transform)(object)parent, "StockIndicator", Vector2.zero, new Vector2(100f, 100f)); Ui.Image(Ui.Rect((Transform)(object)val, "Holder", Vector2.zero, new Vector2(100f, 100f)), SniperCrosshair.HolderSprite, Color.white); RectTransform val2 = Ui.Rect((Transform)(object)val, "Bullet", Vector2.zero, new Vector2(100f, 100f)); Ui.Image(Ui.Stretch((Transform)(object)val2, "Background", Vector2.zero, Vector2.one, Vector2.zero), SniperCrosshair.BulletSprite, Color.black); Image val3 = Ui.Image(Ui.Stretch((Transform)(object)val2, "Fill", Vector2.zero, Vector2.one, Vector2.zero), SniperCrosshair.BulletSprite, Color.white); val3.type = (Type)3; val3.fillMethod = (FillMethod)1; val3.fillOrigin = 0; val3.preserveAspect = true; return new Stock { root = ((Component)val).gameObject, bullet = ((Component)val2).gameObject, fill = val3 }; } private void UpdateFullScope(SteadyAim scope, CharacterBody body) { //IL_0085: Unknown result type (might be due to invalid IL or missing references) bool flag = scope?.InScope ?? false; float num = Mathf.MoveTowards(scopeGroup.alpha, flag ? 1f : 0f, Time.deltaTime * 7f); scopeGroup.alpha = num; Ui.SetActive(((Component)overlay).gameObject, num > 0.001f); if (num <= 0.001f) { return; } FitOverlay(); if (flag) { chargeFill.anchorMax = new Vector2(Mathf.Clamp01(scope.ChargeFraction), 1f); float num2 = 10000f; RaycastHit val = default(RaycastHit); if (Object.op_Implicit((Object)(object)body.inputBank) && body.inputBank.GetAimRaycast(10000f, ref val)) { num2 = ((RaycastHit)(ref val)).distance; } ((TMP_Text)rangeText).SetText("{0:0} m", num2); ((TMP_Text)magnificationText).SetText("{0:0.0}x", scope.Magnification); } } private void FitOverlay() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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_0046: 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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0072: 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_0083: 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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) Canvas componentInParent = ((Component)overlay).GetComponentInParent<Canvas>(); if (Object.op_Implicit((Object)(object)componentInParent)) { RectTransform val = (RectTransform)((Component)componentInParent.rootCanvas).transform; Vector3 lossyScale = ((Transform)overlay).parent.lossyScale; Vector3 lossyScale2 = ((Transform)val).lossyScale; RectTransform obj = overlay; Rect rect = val.rect; ((Transform)obj).position = ((Transform)val).TransformPoint(Vector2.op_Implicit(((Rect)(ref rect)).center)); rect = val.rect; float num = ((Rect)(ref rect)).width * lossyScale2.x / lossyScale.x; rect = val.rect; float num2 = ((Rect)(ref rect)).height * lossyScale2.y / lossyScale.y; overlay.sizeDelta = new Vector2(num, num2); float num3 = Mathf.Min(num, num2) * 0.84f; lens.sizeDelta = new Vector2(num3, num3); float num4 = (num - num3) * 0.5f; float num5 = (num2 - num3) * 0.5f; PlaceShade(shades[0], new Vector2((0f - num) * 0.5f + num4 * 0.5f, 0f), new Vector2(num4, num2)); PlaceShade(shades[1], new Vector2(num * 0.5f - num4 * 0.5f, 0f), new Vector2(num4, num2)); PlaceShade(shades[2], new Vector2(0f, num2 * 0.5f - num5 * 0.5f), new Vector2(num3, num5)); PlaceShade(shades[3], new Vector2(0f, (0f - num2) * 0.5f + num5 * 0.5f), new Vector2(num3, num5)); } } private static void PlaceShade(RectTransform shade, Vector2 position, Vector2 size) { //IL_0001: 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) shade.anchoredPosition = position; shade.sizeDelta = size; } private static Color TierColor(ReloadTier tier) { //IL_000e: 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_0008: Unknown result type (might be due to invalid IL or missing references) return (Color)(tier switch { ReloadTier.Perfect => PerfectColor, ReloadTier.Good => GoodColor, _ => BadColor, }); } private static float TierAlpha(ReloadTier tier) { return tier switch { ReloadTier.Perfect => SniperCrosshair.PerfectAlpha, ReloadTier.Good => SniperCrosshair.GoodAlpha, _ => SniperCrosshair.BadAlpha, }; } private static Color WithAlpha(Color color, float alpha) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) color.a = alpha; return color; } } internal static class Ui { internal struct ColorRegion { internal float start; internal float end; internal Color color; internal ColorRegion(float start, float end, Color color) { //IL_000f: 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) this.start = start; this.end = end; this.color = color; } } internal static RectTransform Rect(Transform parent, string name, Vector2 position, Vector2 size) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //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_003b: 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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown RectTransform val = (RectTransform)new GameObject(name, new Type[1] { typeof(RectTransform) }) { layer = LayerIndex.ui.intVal }.transform; ((Transform)val).SetParent(parent, false); Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(0.5f, 0.5f); val.pivot = val2; Vector2 anchorMin = (val.anchorMax = val2); val.anchorMin = anchorMin; val.anchoredPosition = position; val.sizeDelta = size; return val; } internal static RectTransform Stretch(Transform parent, string name, Vector2 anchorMin, Vector2 anchorMax, Vector2 sizeDelta) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) RectTransform obj = Rect(parent, name, Vector2.zero, sizeDelta); obj.anchorMin = anchorMin; obj.anchorMax = anchorMax; return obj; } internal static Image Image(RectTransform rt, Sprite sprite, Color color) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) Image obj = ((Component)rt).gameObject.AddComponent<Image>(); obj.sprite = sprite; ((Graphic)obj).color = color; ((Graphic)obj).raycastTarget = false; return obj; } internal static RawImage RawImage(RectTransform rt, Texture texture, Rect uv, Color color) { //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) RawImage obj = ((Component)rt).gameObject.AddComponent<RawImage>(); obj.texture = texture; obj.uvRect = uv; ((Graphic)obj).color = color; ((Graphic)obj).raycastTarget = false; return obj; } internal static void SetActive(GameObject go, bool active) { if (go.activeSelf != active) { go.SetActive(active); } } internal static Sprite Sprite(Texture2D tex) { //IL_0019: 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) return Sprite.Create(tex, new Rect(0f, 0f, (float)((Texture)tex).width, (float)((Texture)tex).height), new Vector2(0.5f, 0.5f)); } internal static Texture2D BarTexture(int width, int height, int cornerRadius, int borderWidth, Color borderColor, Color bgColor, int samples, params ColorRegion[] regions) { //IL_002d: 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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Expected O, but got Unknown //IL_006d: 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_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: 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_00a8: 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_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: 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_013f: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) int num = width * samples; int num2 = height * samples; int num3 = borderWidth * samples; int num4 = cornerRadius * samples; int num5 = num - num3 - num3; int num6 = num - num4; int num7 = num2 - num4; Color val = ((num3 > 0) ? borderColor : bgColor); val.a = 0f; float num8 = 1f / (float)(samples * samples); Color[] array = (Color[])(object)new Color[width * height]; for (int i = 0; i < num; i++) { Color val2 = bgColor; if (i < num3 || i >= num - num3) { val2 = borderColor; } else { float num9 = (float)i / (float)num5; for (int j = 0; j < regions.Length; j++) { ColorRegion colorRegion = regions[j]; if (num9 >= colorRegion.start && num9 <= colorRegion.end) { val2 = colorRegion.color; break; } } } for (int k = 0; k < num2; k++) { Color val3 = ((k < num3 || k >= num2 - num3) ? borderColor : val2); bool num10 = i <= num4 || i >= num6; bool flag = k <= num4 || k >= num7; if (num10 && flag) { float num11 = i - ((i <= num4) ? num4 : num6); float num12 = k - ((k <= num4) ? num4 : num7); float num13 = Mathf.Sqrt(num11 * num11 + num12 * num12) - (float)num4; if (num13 >= 0f) { val3 = val; } else if (num13 >= (float)(-num3)) { val3 = borderColor; } } ref Color reference = ref array[k / samples * width + i / samples]; reference += val3 * num8; } } Texture2D val4 = new Texture2D(width, height, (TextureFormat)4, false) { wrapMode = (TextureWrapMode)1, filterMode = (FilterMode)1 }; val4.SetPixels(array); val4.Apply(false, true); return val4; } } } namespace SniperRevived.States { public class Backflip : GenericCharacterMain { private static readonly AnimationCurve SpeedCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[6] { new Keyframe(0f, 0f), new Keyframe(0.05f, 0f), new Keyframe(0.15f, 1f), new Keyframe(0.3f, 0.9f), new Keyframe(0.9f, 0.3f), new Keyframe(1f, 0.1f) }); private const float BaseDuration = 0.5f; private const float SpeedMultiplier = 8f; private const float UpwardsBoost = 5f; private const float DamageCoefficient = 1f; private const float BlastForce = 50f; private const float MaxVerticalSpeedJump = 10f; private const float BlastRadius = 5f; private float prevVerticalSpeed = float.NaN; private float duration; private Vector3 direction; private bool launched; private float CurrentSpeed => 8f * ((BaseState)this).moveSpeedStat / (((EntityState)this).characterBody.isSprinting ? ((EntityState)this).characterBody.sprintingSpeedMultiplier : 1f) * SpeedCurve.Evaluate(((EntityState)this).fixedAge / duration); public override void OnEnter() { //IL_0036: 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_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) //IL_0046: 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_0068: 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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: 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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: 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_00ce: 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_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0112: 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_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_028b: 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_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0177: 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) //IL_0192: Expected O, but got Unknown //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) ((GenericCharacterMain)this).OnEnter(); duration = 0.5f / (((BaseState)this).moveSpeedStat / 7f); ((EntityState)this).characterBody.isSprinting = true; if (((EntityState)this).isAuthority) { Ray aimRay = ((BaseState)this).GetAimRay(); Vector3 val = ((Ray)(ref aimRay)).direction; direction = -val; direction.y = 0f; direction = ((Vector3)(ref direction)).normalized; new BlastAttack { attacker = ((EntityState)this).gameObject, attackerFiltering = (AttackerFiltering)2, baseDamage = ((BaseState)this).damageStat * 1f, baseForce = 0f, bonusForce = val * 50f, crit = false, damageColorIndex = (DamageColorIndex)0, damageType = DamageTypeCombo.op_Implicit((DamageType)32), falloffModel = (FalloffModel)0, losType = (LoSType)0, position = ((EntityState)this).transform.position + Vector3.up, procCoefficient = 1f, radius = 5f, teamIndex = ((EntityState)this).teamComponent.teamIndex }.Fire(); GameObject val2 = KnifeProjectile.slashEffect; if (!Object.op_Implicit((Object)(object)val2)) { val2 = GameAssets.Load<GameObject>("466472f41b222f0449819418a23e7d78"); } if (Object.op_Implicit((Object)(object)val2)) { EffectManager.SpawnEffect(val2, new EffectData { origin = ((EntityState)this).transform.position + Vector3.up, scale = 5f, rotation = Util.QuaternionSafeLookRotation(Vector3.up, direction) }, true); } SniperController component = ((EntityState)this).GetComponent<SniperController>(); if (Object.op_Implicit((Object)(object)component)) { component.ForceReload(ReloadTier.Perfect); } } ((EntityState)this).PlayAnimation("Gesture, Override", "Backflip", "rateBackflip", duration, 0f); Util.PlaySound("Play_merc_m1_hard_swing", ((EntityState)this).gameObject); if (float.IsNaN(direction.x) || ((Vector3)(ref direction)).sqrMagnitude < 0.001f) { Vector3 val3 = (Object.op_Implicit((Object)(object)((EntityState)this).characterDirection) ? ((EntityState)this).characterDirection.forward : ((EntityState)this).transform.forward); val3.y = 0f; direction = ((((Vector3)(ref val3)).sqrMagnitude > 0.001f) ? (-((Vector3)(ref val3)).normalized) : Vector3.back); } ((BaseCharacterController)((EntityState)this).characterMotor).Motor.ForceUnground(0.1f); Vector3 velocity = ((EntityState)this).characterMotor.velocity; velocity.y = 5f; ((EntityState)this).characterMotor.velocity = velocity; ((BaseState)this).StartAimMode(2f, false); } public override void FixedUpdate() { //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: 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) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) ((GenericCharacterMain)this).FixedUpdate(); ((EntityState)this).characterBody.isSprinting = true; float y = ((EntityState)this).characterMotor.velocity.y; if (!float.IsNaN(prevVerticalSpeed) && y - prevVerticalSpeed > 10f) { launched = true; if (((EntityState)this).isAuthority) { ((EntityState)this).outer.SetNextStateToMain(); } } prevVerticalSpeed = y; if (launched) { ((EntityState)this).characterMotor.velocity = Vector3.zero; ((EntityState)this).characterMotor.rootMotion = Vector3.zero; } else { ((EntityState)this).characterMotor.moveDirection = Vector3.zero; ((EntityState)this).characterMotor.velocity = new Vector3(0f, y, 0f); CharacterMotor characterMotor = ((EntityState)this).characterMotor; characterMotor.rootMotion += direction * (CurrentSpeed * ((EntityState)this).GetDeltaTime()); } if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge > duration) { ((EntityState)this).outer.SetNextStateToMain(); } } public override InterruptPriority GetMinimumInterruptPriority() { return (InterruptPriority)2; } public override void OnSerialize(NetworkWriter writer) { //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) ((EntityState)this).OnSerialize(writer); NetworkExtensions.Write(writer, new PackedUnitVector3(direction)); } public override void OnDeserialize(NetworkReader reader) { //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) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) ((EntityState)this).OnDeserialize(reader); PackedUnitVector3 val = NetworkExtensions.ReadPackedUnitVector3(reader); direction = ((PackedUnitVector3)(ref val)).Unpack(); } } public class DecoyActivation : BaseSkillState { private const float CloakDuration = 3f; private Vector3 position; private Quaternion rotation; public override void OnEnter() { //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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) ((BaseState)this).OnEnter(); if (((EntityState)this).isAuthority) { position = ((EntityState)this).transform.position; rotation = (Object.op_Implicit((Object)(object)((EntityState)this).characterDirection) ? Quaternion.LookRotation(((EntityState)this).characterDirection.forward) : ((EntityState)this).transform.rotation); } if (NetworkServer.active) { ((EntityState)this).characterBody.AddTimedBuff(SniperDecoy.cloakBuff, 3f); ((EntityState)this).characterBody.AddTimedBuff(SniperDecoy.cloakSpeedBuff, 3f); SniperDecoy.Summon(((EntityState)this).characterBody, position, rotation); } if (((EntityState)this).isAuthority) { ((EntityState)this).outer.SetNextStateToMain(); } } public override InterruptPriority GetMinimumInterruptPriority() { return (InterruptPriority)2; } public override void OnSerialize(NetworkWriter writer) { //IL_0009: 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) ((BaseSkillState)this).OnSerialize(writer); writer.Write(position); writer.Write(rotation); } public override void OnDeserialize(NetworkReader reader) { //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) //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) ((BaseSkillState)this).OnDeserialize(reader); position = reader.ReadVector3(); rotation = reader.ReadQuaternion(); } } public class DecoyDetonate : BaseSkillState { public override void OnEnter() { ((BaseState)this).OnEnter(); if (NetworkServer.active) { SniperDecoy.Detonate(((EntityState)this).characterBody.master); } if (((EntityState)this).isAuthority) { ((EntityState)this).outer.SetNextStateToMain(); } } public override InterruptPriority GetMinimumInterruptPriority() { return (InterruptPriority)2; } } public class DecoyDeath : GenericCharacterDeath { private const float Radius = 10f; private const float DamageCoefficient = 5f; internal static GameObject explosionEffect; public override void OnEnter() { //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0097: 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_00a5: 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_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: 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_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: 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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: 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_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011f: 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_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_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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown ((GenericCharacterDeath)this).OnEnter(); if (!NetworkServer.active) { return; } CharacterBody characterBody = ((EntityState)this).characterBody; object obj; if (characterBody == null) { obj = null; } else { CharacterMaster master = characterBody.master; if (master == null) { obj = null; } else { MinionOwnership minionOwnership = master.minionOwnership; if (minionOwnership == null) { obj = null; } else { CharacterMaster ownerMaster = minionOwnership.ownerMaster; obj = ((ownerMaster != null) ? ownerMaster.GetBody() : null); } } } CharacterBody val = (CharacterBody)obj; if (Object.op_Implicit((Object)(object)val)) { if (Object.op_Implicit((Object)(object)explosionEffect)) { EffectManager.SpawnEffect(explosionEffect, new EffectData { origin = ((EntityState)this).transform.position, scale = 10f }, true); } new BlastAttack { attacker = ((Component)val).gameObject, inflictor = ((EntityState)this).gameObject, attackerFiltering = (AttackerFiltering)0, baseDamage = val.damage * 5f, baseForce = 50f, crit = val.RollCrit(), damageColorIndex = (DamageColorIndex)3, damageType = DamageTypeCombo.op_Implicit((DamageType)147488), falloffModel = (FalloffModel)1, losType = (LoSType)0, position = ((EntityState)this).transform.position, procCoefficient = 1f, radius = 10f, teamIndex = val.teamComponent.teamIndex }.Fire(); } } public override void OnPreDestroyBodyServer() { ((GenericCharacterDeath)this).OnPreDestroyBodyServer(); ((GenericCharacterDeath)this).DestroyModel(); } internal static void LoadEffects() { explosionEffect = GameAssets.Load<GameObject>("563b2c87385ef6549b44d727cebd7aa3"); } } public class FireSnipe : BaseSkillState { private const float BaseDuration = 0.15f; private const float AimLinger = 5f; private const string Muzzle = "MuzzleRailgun"; internal static GameObject tracerPrefab; internal static GameObject hitEffectPrefab; internal static GameObject explosionPrefab; public float reloadBoost = 1f; public float damageCoefficient = 6f; public float recoilStrength = 6f; public float bulletForce = 200f; public float airborneForce = 500f; private AmmoKind ammo; private float chargeBoost; private float chargeFraction; private float duration; private int shotsToFire = 1; private int shotsFired; private float fireInterval; private float recoilCarry = 1f; private float animRate = 1f; private bool chargeIncreasesRecoil = true; private bool replicated; private bool entered; private bool started; private SniperController controller; public override void OnEnter() { ((BaseState)this).OnEnter(); entered = true; controller = ((EntityState)this).GetComponent<SniperController>(); if (((EntityState)this).isAuthority) { ammo = AmmoSkillDef.Selected(((EntityState)this).characterBody); if (Object.op_Implicit((Object)(object)controller) && controller.activeScope != null) { controller.activeScope.TryConsumeCharge(out chargeBoost, out chargeFraction); } replicated = true; } TryStartVolley(); } private void TryStartVolley() { //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 (!started && entered && replicated) { started = true; if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) && !((EntityState)this).characterMotor.isGrounded) { ((EntityState)this).characterMotor.ApplyForce(Vector3.up * airborneForce, false, false); } BeginVolley(); FireShot(); } } private void BeginVolley() { duration = 0.15f / ((BaseState)this).attackSpeedStat; shotsToFire = 1; fireInterval = duration; recoilCarry = 1f; animRate = 1f; chargeIncreasesRecoil = true; if (ammo == AmmoKind.Burst) { duration *= 4f; shotsToFire = Mathf.Max(1, (int)(3f * (1f + chargeBoost))); fireInterval = duration * 0.75f / (float)(shotsToFire + 1); recoilCarry = 0.75f; animRate = shotsToFire; chargeIncreasesRecoil = false; } } private void FireShot() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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) shotsFired++; Ray aimRay = ((BaseState)this).GetAimRay(); ((BaseState)this).StartAimMode(aimRay, duration + 5f, true); if (((EntityState)this).isAuthority) { FireBullet(aimRay); float num = (chargeIncreasesRecoil ? (1f + 0.5f * chargeBoost) : 1f); float num2 = ((ammo == AmmoKind.Burst) ? (0.5f * recoilCarry) : 1f); float num3 = recoilStrength * num2 * num; ((BaseState)this).AddRecoil(-1f * num3, -3f * num3, -0.2f * num3, 0.2f * num3); } ((EntityState)this).PlayAnimation("Gesture, Additive", "Shoot", "rateReload", duration * animRate, 0f); if (ammo == AmmoKind.Burst) { SniperSounds.PlayBurst(((EntityState)this).gameObject, chargeFraction, shotsFired >= shotsToFire); } else if (ammo == AmmoKind.Plasma || ammo == AmmoKind.Shock) { SniperSounds.PlayPlasma(((EntityState)this).gameObject, chargeFraction); } else { SniperSounds.PlayFire(((EntityState)this).gameObject, chargeFraction); } } private void FireBullet(Ray aimRay) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: 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_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0324: Expected O, but got Unknown //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Expected O, but got Unknown //IL_03ad: Unknown result type (might be due to invalid IL or missing references) //IL_03b7: Expected O, but got Unknown //IL_03ed: Unknown result type (might be due to invalid IL or missing references) //IL_03f7: Expected O, but got Unknown //IL_040b: Unknown result type (might be due to invalid IL or missing references) //IL_0415: Expected O, but got Unknown bool flag = ((BaseState)this).RollCrit(); float num = ((BaseState)this).damageStat * damageCoefficient * reloadBoost; float radius = 0.2f; float procCoefficient = 1f; int num2 = LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask); if (ammo == AmmoKind.Explosive) { num *= 0.2f * (1f + chargeBoost * 0.8f); radius = 0.5f; num2 |= LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask); } else if (ammo == AmmoKind.Burst) { num *= 0.4f; radius = 0.5f; num2 |= LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask); } else if (ammo == AmmoKind.Plasma) { num *= 1f / 13f * (1f + chargeBoost) / PlasmaDurationScale(chargeBoost); radius = 0.5f; procCoefficient = 0.5f; num2 |= LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask); bulletForce = 0f; } else if (ammo == AmmoKind.Shock) { num = ((BaseState)this).damageStat * damageCoefficient * 0.2f * (reloadBoost + chargeBoost); radius = 0.1f; num2 |= LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask); } else if (ammo == AmmoKind.Spore) { num = ((BaseState)this).damageStat * damageCoefficient * 0.2f * reloadBoost * (1f + Mathf.Sqrt(Mathf.Max(0f, chargeBoost))); radius = 0.5f; num2 |= LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask); } else { num *= 1f + chargeBoost; if (flag) { num *= 1f + chargeBoost / 20f; } } BulletAttack val = new BulletAttack { owner = ((EntityState)this).gameObject, weapon = ((EntityState)this).gameObject, origin = ((Ray)(ref aimRay)).origin, aimVector = ((Ray)(ref aimRay)).direction, minSpread = 0f, maxSpread = 0f, bulletCount = 1u, damage = num, force = bulletForce, isCrit = flag, procCoefficient = procCoefficient, radius = radius, maxDistance = 1000f, smartCollision = true, falloffModel = (FalloffModel)0, hitMask = LayerMask.op_Implicit(LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask) | LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask)), stopperMask = LayerMask.op_Implicit(num2), muzzleName = "MuzzleRailgun", tracerEffectPrefab = ((ammo == AmmoKind.Plasma && Object.op_Implicit((Object)(object)PlasmaEffects.TracerPrefab)) ? PlasmaEffects.TracerPrefab : ((ammo == AmmoKind.Shock && Object.op_Implicit((Object)(object)ShockEffects.TracerPrefab)) ? ShockEffects.TracerPrefab : tracerPrefab)), hitEffectPrefab = ((ammo == AmmoKind.Shock && Object.op_Implicit((Object)(object)ShockEffects.ImpactPrefab)) ? ShockEffects.ImpactPrefab : hitEffectPrefab), queryTriggerInteraction = (QueryTriggerInteraction)0, damageColorIndex = (DamageColorIndex)0 }; float blastRadius; float burnDuration; int stacks; if (ammo == AmmoKind.Explosive) { blastRadius = 8f * (1f + chargeBoost); val.hitCallback = new HitCallback(OnExplosiveHit); } else if (ammo == AmmoKind.Standard) { FmjRicochet.Attach(val); } else if (ammo == AmmoKind.Plasma) { burnDuration = 10f * PlasmaDurationScale(chargeBoost); val.hitCallback = new HitCallback(OnPlasmaHit); } else if (ammo == AmmoKind.Shock) { stacks = 1 + Mathf.RoundToInt(chargeBoost / 0.33f); val.hitCallback = new HitCallback(OnShockHit); } else if (ammo == AmmoKind.Spore) { val.hitCallback = new HitCallback(OnSporeHit); } val.Fire(); bool OnExplosiveHit(BulletAttack attack, ref BulletHit hit) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) bool result = BulletAttack.defaultHitCallback.Invoke(attack, ref hit); if (Object.op_Implicit((Object)(object)hit.collider)) { Explode(attack, hit.point, hit.direction, blastRadius); } return result; } bool OnPlasmaHit(BulletAttack attack, ref BulletHit hit) { //IL_0047: 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_0088: Unknown result type (might be due to invalid IL or missing references) bool result = BulletAttack.defaultHitCallback.Invoke(attack, ref hit); HurtBox hitHurtBox = hit.hitHurtBox; HealthComponent val2 = (Object.op_Implicit((Object)(object)hitHurtBox) ? hitHurtBox.healthComponent : null); CharacterBody val3 = (Object.op_Implicit((Object)(object)val2) ? val2.body : null); if (Object.op_Implicit((Object)(object)val3) && FriendlyFireManager.ShouldDirectHitProceed(val2, TeamComponent.GetObjectTeam(attack.own