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.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using EntityStates; using EntityStates.AI.Walker; using EntityStates.Commando.CommandoWeapon; using HG; using HG.BlendableTypes; using On.RoR2; using On.RoR2.Projectile; using R2API; using R2API.Utils; using RoR2; using RoR2.Achievements; using RoR2.Audio; using RoR2.CharacterAI; using RoR2.ContentManagement; using RoR2.Projectile; using RoR2.Skills; using RoR2.UI; using Soldier76Mod.Components; using Soldier76Mod.Modules; using Soldier76Mod.Modules.Achievements; using Soldier76Mod.Modules.Characters; using Soldier76Mod.Survivors.Soldier76; using Soldier76Mod.Survivors.Soldier76.Components; using Soldier76Mod.Survivors.Soldier76.SkillStates; using UnityEngine; using UnityEngine.Networking; using UnityEngine.Rendering; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Soldier76Mod")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Soldier76Mod")] [assembly: AssemblyTitle("Soldier76Mod")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Soldier76Mod { public class VisorOverlayController : MonoBehaviour { private class BracketInfo { public GameObject uiObject; public Image image; public RectTransform rectTransform; public CharacterBody trackedBody; public float currentAlpha; public float targetAlpha; public float hitAnimTimer; } [CompilerGenerated] private sealed class d__28 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public VisorOverlayController <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__28(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.8f); <>1__state = 1; return true; case 1: <>1__state = -1; break; case 2: <>1__state = -1; break; } if ((Object)(object)<>4__this.body != (Object)null && <>4__this.body.HasBuff(Soldier76Buffs.tacticalVisorBuff)) { Soldier76Plugin.PlayVoiceWithVolume(((Component)<>4__this).gameObject, "Play_skill4_during", 0.3f); <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 2; return true; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__29 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public bool show; public bool enhanced; public VisorOverlayController <>4__this; private float 5__1; private float 5__2; private float 5__3; private float 5__4; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__29(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = 0.3f; 5__2 = 0f; if (show) { if (Object.op_Implicit((Object)(object)<>4__this.visorImage)) { ((Component)<>4__this.visorImage).gameObject.SetActive(true); } if (enhanced && Object.op_Implicit((Object)(object)<>4__this.blueTint)) { ((Component)<>4__this.blueTint).gameObject.SetActive(true); } goto IL_0192; } goto IL_031d; case 1: <>1__state = -1; goto IL_0192; case 2: { <>1__state = -1; goto IL_031d; } IL_031d: if (5__2 < 5__1) { 5__2 += Time.deltaTime; 5__4 = 1f - 5__2 / 5__1; if (Object.op_Implicit((Object)(object)<>4__this.visorImage)) { ((Graphic)<>4__this.visorImage).color = new Color(1f, 1f, 1f, 5__4 * 0.07f); } if (enhanced && Object.op_Implicit((Object)(object)<>4__this.blueTint)) { ((Graphic)<>4__this.blueTint).color = new Color(1f, 0f, 0f, 5__4 * 0.05f); } <>2__current = null; <>1__state = 2; return true; } if (Object.op_Implicit((Object)(object)<>4__this.visorImage)) { ((Component)<>4__this.visorImage).gameObject.SetActive(false); } if (Object.op_Implicit((Object)(object)<>4__this.blueTint)) { ((Component)<>4__this.blueTint).gameObject.SetActive(false); } break; IL_0192: if (5__2 < 5__1) { 5__2 += Time.deltaTime; 5__3 = 5__2 / 5__1; if (Object.op_Implicit((Object)(object)<>4__this.visorImage)) { ((Graphic)<>4__this.visorImage).color = new Color(1f, 1f, 1f, 5__3 * 0.07f); } if (enhanced && Object.op_Implicit((Object)(object)<>4__this.blueTint)) { ((Graphic)<>4__this.blueTint).color = new Color(1f, 0f, 0f, 5__3 * 0.05f); } <>2__current = null; <>1__state = 1; return true; } if (Object.op_Implicit((Object)(object)<>4__this.visorImage)) { ((Graphic)<>4__this.visorImage).color = new Color(1f, 1f, 1f, 0.07f); } if (enhanced && Object.op_Implicit((Object)(object)<>4__this.blueTint)) { ((Graphic)<>4__this.blueTint).color = new Color(1f, 0f, 0f, 0.05f); } break; } <>4__this.fadeRoutine = null; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private CharacterBody body; private RawImage visorImage; private RawImage blueTint; private Texture2D visorTexture; private Coroutine fadeRoutine; private bool isVisorActive; private bool hudReady; private List bracketPool = new List(); private Dictionary activeBrackets = new Dictionary(); private Texture2D bracketTexture; private Transform bracketParent; private float enemySearchTimer; private bool hooksRegistered; private const float BRACKET_SEARCH_INTERVAL = 0.2f; private const float BRACKET_FADE_SPEED = 8f; private const float BRACKET_HIT_SCALE = 1.7f; private const float BRACKET_HIT_DURATION = 0.2f; private const float BRACKET_UI_SIZE = 80f; private const float VISOR_SEARCH_RANGE = 200f; private const float VISOR_SEARCH_ANGLE = 55f; private const int MAX_BRACKETS = 25; private Canvas visorCanvas; private void Awake() { body = ((Component)this).GetComponent(); visorTexture = Soldier76Assets._cachedVisorTexture; if ((Object)(object)visorTexture == (Object)null) { visorTexture = GenerateBorderTexture(); } bracketTexture = GenerateBracketTexture(); } private Texture2D LoadBracketTexture() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)Soldier76Plugin.instance).Info.Location); string path = Path.Combine(directoryName, "texBracket.png"); if (File.Exists(path)) { try { byte[] array = File.ReadAllBytes(path); Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false); ImageConversion.LoadImage(val, array); val.Apply(); Log.Info("Visor: 加载瞄准框贴图 texBracket.png"); return val; } catch { } } return GenerateBracketTexture(); } private bool EnsureHudSetup() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown //IL_008d: 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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Expected O, but got Unknown //IL_0116: 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_014a: 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_0164: 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_0197: Expected O, but got Unknown //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_020b: 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_0225: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Expected O, but got Unknown //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) if (hudReady) { return true; } GameObject val = new GameObject("VisorCanvas", new Type[3] { typeof(Canvas), typeof(CanvasScaler), typeof(GraphicRaycaster) }); Object.DontDestroyOnLoad((Object)(object)val); Canvas component = val.GetComponent(); component.renderMode = (RenderMode)0; component.sortingOrder = 200; visorCanvas = component; CanvasScaler component2 = val.GetComponent(); component2.uiScaleMode = (ScaleMode)0; RectTransform component3 = val.GetComponent(); component3.anchorMin = Vector2.zero; component3.anchorMax = Vector2.one; component3.offsetMin = Vector2.zero; component3.offsetMax = Vector2.zero; GameObject val2 = new GameObject("VisorBlueTint", new Type[1] { typeof(RawImage) }); val2.transform.SetParent(val.transform, false); blueTint = val2.GetComponent(); ((Graphic)blueTint).color = new Color(1f, 0f, 0f, 0f); ((Graphic)blueTint).raycastTarget = false; RectTransform rectTransform = ((Graphic)blueTint).rectTransform; rectTransform.anchorMin = Vector2.zero; rectTransform.anchorMax = Vector2.one; rectTransform.offsetMin = Vector2.zero; rectTransform.offsetMax = Vector2.zero; val2.SetActive(false); GameObject val3 = new GameObject("VisorOverlay", new Type[1] { typeof(RawImage) }); val3.transform.SetParent(val.transform, false); visorImage = val3.GetComponent(); visorImage.texture = (Texture)(object)visorTexture; ((Graphic)visorImage).color = new Color(1f, 1f, 1f, 0f); ((Graphic)visorImage).raycastTarget = false; RectTransform rectTransform2 = ((Graphic)visorImage).rectTransform; rectTransform2.anchorMin = Vector2.zero; rectTransform2.anchorMax = Vector2.one; rectTransform2.offsetMin = Vector2.zero; rectTransform2.offsetMax = Vector2.zero; val3.SetActive(false); GameObject val4 = new GameObject("VisorBrackets", new Type[1] { typeof(RectTransform) }); val4.transform.SetParent(val.transform, false); bracketParent = val4.transform; RectTransform component4 = val4.GetComponent(); component4.anchorMin = Vector2.zero; component4.anchorMax = Vector2.one; component4.offsetMin = Vector2.zero; component4.offsetMax = Vector2.zero; if (Object.op_Implicit((Object)(object)bracketTexture)) { Object.Destroy((Object)(object)bracketTexture); } bracketTexture = LoadBracketTexture(); RegisterHooks(); hudReady = true; Log.Info("VisorOverlayController: 独立 Canvas 初始化完成"); return true; } private void OnDestroy() { UnregisterHooks(); foreach (KeyValuePair activeBracket in activeBrackets) { if (Object.op_Implicit((Object)(object)activeBracket.Value.uiObject)) { Object.Destroy((Object)(object)activeBracket.Value.uiObject); } } activeBrackets.Clear(); foreach (BracketInfo item in bracketPool) { if (Object.op_Implicit((Object)(object)item.uiObject)) { Object.Destroy((Object)(object)item.uiObject); } } bracketPool.Clear(); if (Object.op_Implicit((Object)(object)bracketTexture)) { Object.Destroy((Object)(object)bracketTexture); } if (Object.op_Implicit((Object)(object)bracketParent)) { Object.Destroy((Object)(object)((Component)bracketParent).gameObject); } if (Object.op_Implicit((Object)(object)visorTexture)) { Object.Destroy((Object)(object)visorTexture); } if (Object.op_Implicit((Object)(object)visorCanvas)) { Object.Destroy((Object)(object)((Component)visorCanvas).gameObject); } } private void Update() { //IL_0095: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)body == (Object)null) { return; } bool flag = body.HasBuff(Soldier76Buffs.tacticalVisorBuff); if (flag != isVisorActive) { if (flag) { if (!EnsureHudSetup()) { return; } ((MonoBehaviour)this).StartCoroutine(DelayedVisorDuringSound()); } else { Transform val = ((Component)this).transform.Find("S76Vol_30"); if (Object.op_Implicit((Object)(object)val)) { AkSoundEngine.ExecuteActionOnEvent("Play_skill4_during", (AkActionOnEventType)0, ((Component)val).gameObject); } Soldier76Plugin.PlayVoiceWithVolume(((Component)this).gameObject, "Play_skill4_end", 0.5f); } isVisorActive = flag; if (fadeRoutine != null) { ((MonoBehaviour)this).StopCoroutine(fadeRoutine); } bool enhanced = body.HasBuff(Soldier76Buffs.enhancedVisorBuff); fadeRoutine = ((MonoBehaviour)this).StartCoroutine(FadeVisor(flag, enhanced)); } if (hudReady) { UpdateBrackets(); } } [IteratorStateMachine(typeof(d__28))] private IEnumerator DelayedVisorDuringSound() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__28(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__29))] private IEnumerator FadeVisor(bool show, bool enhanced) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__29(0) { <>4__this = this, show = show, enhanced = enhanced }; } private Texture2D GenerateBracketTexture() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: 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) int num = 128; Texture2D val = new Texture2D(num, num, (TextureFormat)4, false); Color clear = Color.clear; Color val2 = default(Color); ((Color)(ref val2))..ctor(1f, 0.15f, 0.15f, 1f); int num2 = 7; int num3 = 25; int num4 = 2; for (int i = 0; i < num; i++) { for (int j = 0; j < num; j++) { bool flag = false; if (j >= num4 && j < num4 + num3 && i >= num4 && i < num4 + num2) { flag = true; } if (j >= num4 && j < num4 + num2 && i >= num4 && i < num4 + num3) { flag = true; } if (j >= num - num4 - num3 && j < num - num4 && i >= num4 && i < num4 + num2) { flag = true; } if (j >= num - num4 - num2 && j < num - num4 && i >= num4 && i < num4 + num3) { flag = true; } if (j >= num4 && j < num4 + num3 && i >= num - num4 - num2 && i < num - num4) { flag = true; } if (j >= num4 && j < num4 + num2 && i >= num - num4 - num3 && i < num - num4) { flag = true; } if (j >= num - num4 - num3 && j < num - num4 && i >= num - num4 - num2 && i < num - num4) { flag = true; } if (j >= num - num4 - num2 && j < num - num4 && i >= num - num4 - num3 && i < num - num4) { flag = true; } val.SetPixel(j, i, flag ? val2 : clear); } } val.Apply(); return val; } private Texture2D GenerateBorderTexture() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_009e: 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) int num = 512; int num2 = 512; Texture2D val = new Texture2D(num, num2, (TextureFormat)4, false); Color val2 = default(Color); ((Color)(ref val2))..ctor(0.2f, 0.6f, 1f, 0.5f); Color val3 = default(Color); ((Color)(ref val3))..ctor(0f, 0f, 0f, 0f); for (int i = 0; i < num2; i++) { for (int j = 0; j < num; j++) { float num3 = (float)j / (float)num; float num4 = (float)i / (float)num2; bool flag = num3 < 0.03f || num3 > 0.97f || num4 < 0.03f || num4 > 0.97f; val.SetPixel(j, i, flag ? val2 : val3); } } val.Apply(); return val; } private void UpdateBrackets() { //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //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_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020c: 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_0229: 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_0321: Unknown result type (might be due to invalid IL or missing references) //IL_0349: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Unknown result type (might be due to invalid IL or missing references) if (!isVisorActive) { bool flag = false; foreach (BracketInfo item in activeBrackets.Values.ToList()) { item.targetAlpha = 0f; ApplyBracketAlpha(item); if (item.currentAlpha <= 0.001f) { ReturnBracketToPool(item); } else { flag = true; } } if (!flag) { activeBrackets.Clear(); } } else { if ((Object)(object)bracketParent == (Object)null) { return; } Camera main = Camera.main; if ((Object)(object)main == (Object)null) { return; } enemySearchTimer -= Time.deltaTime; if (enemySearchTimer <= 0f) { enemySearchTimer = 0.2f; RefreshEnemyList(); } List list = new List(); foreach (KeyValuePair activeBracket in activeBrackets) { CharacterBody key = activeBracket.Key; BracketInfo value = activeBracket.Value; if ((Object)(object)key == (Object)null || !Object.op_Implicit((Object)(object)key.healthComponent) || !key.healthComponent.alive) { value.targetAlpha = 0f; ApplyBracketAlpha(value); if (value.currentAlpha <= 0.001f) { list.Add(key); } continue; } Vector3 corePosition = key.corePosition; Vector3 val = main.WorldToScreenPoint(corePosition); if (val.z <= 0f) { value.uiObject.SetActive(false); continue; } value.uiObject.SetActive(true); ((Transform)value.rectTransform).position = new Vector3(val.x, val.y, 0f); float num = Vector3.Distance(((Component)main).transform.position, corePosition); float num2 = Mathf.Clamp(80f * (20f / Mathf.Max(num, 5f)), 35f, 80f); value.rectTransform.SetSizeWithCurrentAnchors((Axis)0, num2); value.rectTransform.SetSizeWithCurrentAnchors((Axis)1, num2); if (value.hitAnimTimer > 0f) { value.hitAnimTimer -= Time.deltaTime; float num3 = value.hitAnimTimer / 0.2f; float num4 = 1f + Mathf.Sin(num3 * MathF.PI) * 0.70000005f; ((Transform)value.rectTransform).localScale = Vector3.one * num4; ((Graphic)value.image).color = new Color(1f, 0.3f, 0.05f, value.currentAlpha); } else { ((Transform)value.rectTransform).localScale = Vector3.one; ((Graphic)value.image).color = new Color(1f, 0f, 0f, value.currentAlpha); } ApplyBracketAlpha(value); } foreach (CharacterBody item2 in list) { if (activeBrackets.TryGetValue(item2, out var value2)) { ReturnBracketToPool(value2); activeBrackets.Remove(item2); } } } } private void RefreshEnemyList() { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: 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_0090: 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_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_00c9: 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_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018b: 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_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)body == (Object)null || !Object.op_Implicit((Object)(object)body.healthComponent) || !body.healthComponent.alive || (Object)(object)body.teamComponent == (Object)null) { return; } TeamIndex teamIndex = body.teamComponent.teamIndex; TeamMask enemyTeams = TeamMask.GetEnemyTeams(teamIndex); InputBankTest inputBank = body.inputBank; Vector3 val = (Object.op_Implicit((Object)(object)inputBank) ? inputBank.aimOrigin : body.corePosition); Vector3 val2 = (Object.op_Implicit((Object)(object)inputBank) ? inputBank.aimDirection : (Object.op_Implicit((Object)(object)Camera.main) ? ((Component)Camera.main).transform.forward : ((Component)this).transform.forward)); HashSet hashSet = new HashSet(); foreach (CharacterBody readOnlyInstances in CharacterBody.readOnlyInstancesList) { if ((Object)(object)readOnlyInstances == (Object)null || (Object)(object)readOnlyInstances == (Object)(object)body || !Object.op_Implicit((Object)(object)readOnlyInstances.healthComponent) || !readOnlyInstances.healthComponent.alive || (Object)(object)readOnlyInstances.teamComponent == (Object)null || !((TeamMask)(ref enemyTeams)).HasTeam(readOnlyInstances.teamComponent.teamIndex)) { continue; } Vector3 val3 = readOnlyInstances.corePosition - val; float magnitude = ((Vector3)(ref val3)).magnitude; if (!(magnitude > 200f)) { float num = Vector3.Angle(val2, ((Vector3)(ref val3)).normalized); if (!(num > 55f)) { hashSet.Add(readOnlyInstances); } } } foreach (CharacterBody item in activeBrackets.Keys.ToList()) { if (((Object)(object)item == (Object)null || !hashSet.Contains(item)) && activeBrackets.TryGetValue(item, out var value)) { value.targetAlpha = 0f; ApplyBracketAlpha(value); if (value.currentAlpha <= 0.001f) { ReturnBracketToPool(value); activeBrackets.Remove(item); } } } foreach (CharacterBody item2 in hashSet) { if (activeBrackets.TryGetValue(item2, out var value2)) { value2.targetAlpha = 1f; continue; } BracketInfo bracketFromPool = GetBracketFromPool(); if (bracketFromPool != null) { bracketFromPool.trackedBody = item2; bracketFromPool.currentAlpha = 0f; bracketFromPool.targetAlpha = 1f; bracketFromPool.hitAnimTimer = 0f; ((Transform)bracketFromPool.rectTransform).localScale = Vector3.one; activeBrackets[item2] = bracketFromPool; } } if (hashSet.Count > 0 && !activeBrackets.Any()) { Log.Info($"Visor: 找到 {hashSet.Count} 个敌人, 但 bracket 池为空"); } } private BracketInfo GetBracketFromPool() { //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown //IL_00eb: 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_0129: 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_0155: 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) if (bracketPool.Count > 0) { BracketInfo bracketInfo = bracketPool[bracketPool.Count - 1]; bracketPool.RemoveAt(bracketPool.Count - 1); bracketInfo.uiObject.SetActive(true); return bracketInfo; } if (activeBrackets.Count + bracketPool.Count >= 25) { return null; } GameObject val = new GameObject("EnemyBracket", new Type[1] { typeof(Image) }); val.transform.SetParent(bracketParent, false); Image component = val.GetComponent(); component.sprite = Sprite.Create(bracketTexture, new Rect(0f, 0f, (float)((Texture)bracketTexture).width, (float)((Texture)bracketTexture).height), new Vector2(0.5f, 0.5f), 100f); ((Graphic)component).raycastTarget = false; RectTransform component2 = val.GetComponent(); component2.anchorMin = new Vector2(0.5f, 0.5f); component2.anchorMax = new Vector2(0.5f, 0.5f); component2.pivot = new Vector2(0.5f, 0.5f); component2.sizeDelta = new Vector2(80f, 80f); return new BracketInfo { uiObject = val, image = component, rectTransform = component2, currentAlpha = 0f, targetAlpha = 0f }; } private void ReturnBracketToPool(BracketInfo bracket) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)bracket.uiObject)) { bracket.uiObject.SetActive(false); ((Transform)bracket.rectTransform).localScale = Vector3.one; } bracket.trackedBody = null; bracket.currentAlpha = 0f; bracket.targetAlpha = 0f; bracket.hitAnimTimer = 0f; if (!bracketPool.Contains(bracket)) { bracketPool.Add(bracket); } } private void ApplyBracketAlpha(BracketInfo bracket) { float num = bracket.targetAlpha - bracket.currentAlpha; if (Mathf.Abs(num) < 0.001f) { bracket.currentAlpha = bracket.targetAlpha; } else { bracket.currentAlpha = Mathf.MoveTowards(bracket.currentAlpha, bracket.targetAlpha, 8f * Time.deltaTime); } } private void RegisterHooks() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown if (!hooksRegistered) { hooksRegistered = true; HealthComponent.TakeDamage += new hook_TakeDamage(OnTakeDamageHook); Log.Info("VisorOverlayController: 伤害钩子已注册"); } } private void UnregisterHooks() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown if (hooksRegistered) { hooksRegistered = false; HealthComponent.TakeDamage -= new hook_TakeDamage(OnTakeDamageHook); } } private void OnTakeDamageHook(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo) { orig.Invoke(self, damageInfo); if (!((Object)(object)body == (Object)null) && body.HasBuff(Soldier76Buffs.tacticalVisorBuff) && !((Object)(object)damageInfo.attacker == (Object)null) && !((Object)(object)damageInfo.attacker != (Object)(object)((Component)this).gameObject)) { CharacterBody val = self.body; if (!((Object)(object)val == (Object)null) && activeBrackets.TryGetValue(val, out var value)) { value.hitAnimTimer = 0.2f; } } } } internal static class Log { internal static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void Debug(object data) { _logSource.LogDebug(data); } internal static void Error(object data) { _logSource.LogError(data); } internal static void ErrorAssetBundle(string assetName, string bundleName) { Error("failed to load asset, " + assetName + ", because it does not exist in asset bundle, " + bundleName); } internal static void Fatal(object data) { _logSource.LogFatal(data); } internal static void Info(object data) { _logSource.LogInfo(data); } internal static void Message(object data) { _logSource.LogMessage(data); } internal static void Warning(object data) { _logSource.LogWarning(data); } } [NetworkCompatibility(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.littlefight.soldier76", "soldier76", "1.0.2")] public class Soldier76Plugin : BaseUnityPlugin { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static hook_Start <>9__15_0; internal void b__15_0(orig_Start orig, CharacterBody self) { orig.Invoke(self); if (!_hasPlayedSelectVoice && ((Object)self).name.Contains("Soldier76")) { _hasPlayedSelectVoice = true; ((MonoBehaviour)self).StartCoroutine(PlaySelectVoiceWhenReady()); } } } [CompilerGenerated] private sealed class d__16 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Soldier76Plugin <>4__this; private string 5__1; private AKRESULT 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__16(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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: Invalid comparison between Unknown and I4 //IL_00ae: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(5f); <>1__state = 1; return true; case 1: <>1__state = -1; 5__1 = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)<>4__this).Info.Location), "sound"); AkSoundEngine.AddBasePath(5__1); 5__2 = AkSoundEngine.LoadBank("Soldier76_Voices.bnk", ref _bankId); if ((int)5__2 == 1) { _soundBankLoaded = true; Log.Info("SoundBank加载成功: Soldier76_Voices.bnk"); } else { Log.Warning($"SoundBank加载失败: {5__2}, 尝试备用加载方式..."); } return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__17 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__17(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; goto IL_004d; case 1: <>1__state = -1; goto IL_004d; case 2: { <>1__state = -1; PlayVoice(((Component)RoR2Application.instance).gameObject, "Play_select_76voice"); return false; } IL_004d: if (!_soundBankLoaded) { <>2__current = (object)new WaitForSeconds(0.3f); <>1__state = 1; return true; } <>2__current = (object)new WaitForSeconds(0.2f); <>1__state = 2; return true; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public const string MODUID = "com.littlefight.soldier76"; public const string MODNAME = "soldier76"; public const string MODVERSION = "1.0.2"; public const string DEVELOPER_PREFIX = "S76"; public static Soldier76Plugin instance; private static uint _bankId; private static bool _soundBankLoaded; private static bool _hasPlayedSelectVoice; public static void PlayVoice(GameObject source, string eventName) { if (!((Object)(object)source == (Object)null) && !string.IsNullOrEmpty(eventName)) { AkSoundEngine.PostEvent(eventName, source); } } public static void PlayVoiceWithVolume(GameObject source, string eventName, float volume) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown //IL_006f: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)source == (Object)null) && !string.IsNullOrEmpty(eventName)) { string text = $"S76Vol_{(int)(volume * 100f):D2}"; Transform val = source.transform.Find(text); GameObject val2; if ((Object)(object)val == (Object)null) { val2 = new GameObject(text); val2.transform.SetParent(source.transform); val2.AddComponent(); AkSoundEngine.SetGameObjectOutputBusVolume(val2, (GameObject)null, volume); } else { val2 = ((Component)val).gameObject; } AkSoundEngine.PostEvent(eventName, val2); } } public static Texture2D LoadTexture(string fileName) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown string path = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)instance).Info.Location), fileName); if (!File.Exists(path)) { return null; } byte[] array = File.ReadAllBytes(path); Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false); ImageConversion.LoadImage(val, array); ((Texture)val).filterMode = (FilterMode)1; ((Texture)val).wrapMode = (TextureWrapMode)1; val.Apply(); return val; } public static Texture2D LoadTextureFromAssetBundle(AssetBundle bundle, string assetName) { Texture2D val = bundle.LoadAsset(assetName); if ((Object)(object)val == (Object)null) { return null; } Texture2D val2 = DecompressTexture(val); ((Texture)val2).filterMode = (FilterMode)1; ((Texture)val2).wrapMode = (TextureWrapMode)1; return val2; } public static Sprite LoadSpriteFromAssetBundle(AssetBundle bundle, string assetName) { //IL_0048: 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) Texture2D val = bundle.LoadAsset(assetName); if ((Object)(object)val == (Object)null) { return null; } Texture2D val2 = DecompressTexture(val); ((Texture)val2).filterMode = (FilterMode)1; ((Texture)val2).wrapMode = (TextureWrapMode)1; return Sprite.Create(val2, new Rect(0f, 0f, (float)((Texture)val2).width, (float)((Texture)val2).height), new Vector2(0.5f, 0.5f), 100f); } public static Texture2D DecompressTexture(Texture2D source) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown //IL_0058: Unknown result type (might be due to invalid IL or missing references) RenderTexture temporary = RenderTexture.GetTemporary(((Texture)source).width, ((Texture)source).height, 0, (RenderTextureFormat)7, (RenderTextureReadWrite)2); Graphics.Blit((Texture)(object)source, temporary); RenderTexture active = RenderTexture.active; RenderTexture.active = temporary; Texture2D val = new Texture2D(((Texture)source).width, ((Texture)source).height, (TextureFormat)4, false); val.ReadPixels(new Rect(0f, 0f, (float)((Texture)source).width, (float)((Texture)source).height), 0, 0); val.Apply(); RenderTexture.active = active; RenderTexture.ReleaseTemporary(temporary); return val; } public static Sprite LoadSprite(string fileName) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //IL_0079: 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) string path = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)instance).Info.Location), fileName); if (!File.Exists(path)) { return null; } byte[] array = File.ReadAllBytes(path); Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false); ImageConversion.LoadImage(val, array); ((Texture)val).filterMode = (FilterMode)0; ((Texture)val).wrapMode = (TextureWrapMode)1; val.Apply(); Sprite val2 = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 100f); ((Object)val2).name = fileName; return val2; } private void Awake() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown instance = this; Log.Init(((BaseUnityPlugin)this).Logger); ((MonoBehaviour)this).StartCoroutine(LoadSoundBankDelayed()); object obj = <>c.<>9__15_0; if (obj == null) { hook_Start val = delegate(orig_Start orig, CharacterBody self) { orig.Invoke(self); if (!_hasPlayedSelectVoice && ((Object)self).name.Contains("Soldier76")) { _hasPlayedSelectVoice = true; ((MonoBehaviour)self).StartCoroutine(PlaySelectVoiceWhenReady()); } }; <>c.<>9__15_0 = val; obj = (object)val; } CharacterBody.Start += (hook_Start)obj; Log.Info("=== 士兵76 v1.0.0 by littlefight ==="); Log.Info("主武器: 50%伤害, 5发/秒"); Log.Info("副武器: 200%伤害, CD=10s, 2层充能, 追踪+火箭跳"); Log.Info("辅助: 10秒, +50%速/+300甲/+100%攻速, 扣20%HP/+15%盾, 禁止治疗, CD=20s"); Log.Info("特殊: 10秒, +50%攻速, 子弹追踪, CD=30s | 强化: +50%暴击+100%暴伤"); Log.Info("被动: 击杀+5%, 满100%强化目镜"); Log.Info("=============================="); Language.Init(); new Soldier76Survivor().Initialize(); new ContentPacks().Initialize(); } [IteratorStateMachine(typeof(d__16))] private IEnumerator LoadSoundBankDelayed() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__16(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__17))] private static IEnumerator PlaySelectVoiceWhenReady() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__17(0); } } } namespace Soldier76Mod.Modules { internal static class Asset { internal static Dictionary loadedBundles = new Dictionary(); internal static AssetBundle LoadAssetBundle(string bundleName) { if (bundleName == "myassetbundle") { Log.Error("AssetBundle name hasn't been changed. not loading any assets to avoid conflicts.\nMake sure to rename your assetbundle filename and rename the AssetBundleName field in your character setup code "); return null; } if (loadedBundles.ContainsKey(bundleName)) { return loadedBundles[bundleName]; } AssetBundle val = null; try { val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)Soldier76Plugin.instance).Info.Location), "AssetBundles", bundleName)); } catch (Exception arg) { Log.Error($"Error loading asset bundle, {bundleName}. Your asset bundle must be in a folder next to your mod dll called 'AssetBundles'. Follow the guide to build and install your mod correctly!\n{arg}"); } loadedBundles[bundleName] = val; return val; } internal static GameObject CloneTracer(string originalTracerName, string newTracerName) { if ((Object)(object)LegacyResourcesAPI.Load("Prefabs/Effects/Tracers/" + originalTracerName) == (Object)null) { return null; } GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load("Prefabs/Effects/Tracers/" + originalTracerName), newTracerName, true); if (!Object.op_Implicit((Object)(object)val.GetComponent())) { val.AddComponent(); } if (!Object.op_Implicit((Object)(object)val.GetComponent())) { val.AddComponent(); } if (!Object.op_Implicit((Object)(object)val.GetComponent())) { val.AddComponent(); } val.GetComponent().speed = 250f; val.GetComponent().length = 50f; Content.CreateAndAddEffectDef(val); return val; } internal static void ConvertAllRenderersToHopooShader(GameObject objectToConvert) { if (!Object.op_Implicit((Object)(object)objectToConvert)) { return; } MeshRenderer[] componentsInChildren = objectToConvert.GetComponentsInChildren(); foreach (MeshRenderer val in componentsInChildren) { if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial)) { ((Renderer)val).sharedMaterial.ConvertDefaultShaderToHopoo(); } } SkinnedMeshRenderer[] componentsInChildren2 = objectToConvert.GetComponentsInChildren(); foreach (SkinnedMeshRenderer val2 in componentsInChildren2) { if (Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)((Renderer)val2).sharedMaterial)) { ((Renderer)val2).sharedMaterial.ConvertDefaultShaderToHopoo(); } } } internal static GameObject LoadCrosshair(string crosshairName) { GameObject val = LegacyResourcesAPI.Load("Prefabs/Crosshair/" + crosshairName + "Crosshair"); if ((Object)(object)val == (Object)null) { Log.Error("could not load crosshair with the name " + crosshairName + ". defaulting to Standard"); return LegacyResourcesAPI.Load("Prefabs/Crosshair/StandardCrosshair"); } return val; } internal static GameObject LoadEffect(this AssetBundle assetBundle, string resourceName, bool parentToTransform) { return assetBundle.LoadEffect(resourceName, "", parentToTransform); } internal static GameObject LoadEffect(this AssetBundle assetBundle, string resourceName, string soundName = "", bool parentToTransform = false) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) GameObject val = assetBundle.LoadAsset(resourceName); if (!Object.op_Implicit((Object)(object)val)) { Log.ErrorAssetBundle(resourceName, ((Object)assetBundle).name); return null; } val.AddComponent().duration = 12f; val.AddComponent(); val.AddComponent().vfxPriority = (VFXPriority)2; EffectComponent val2 = val.AddComponent(); val2.applyScale = false; val2.effectIndex = (EffectIndex)(-1); val2.parentToReferencedTransform = parentToTransform; val2.positionAtReferencedTransform = true; val2.soundName = soundName; Content.CreateAndAddEffectDef(val); return val; } internal static GameObject CreateProjectileGhostPrefab(this AssetBundle assetBundle, string ghostName) { GameObject val = assetBundle.LoadAsset(ghostName); if ((Object)(object)val == (Object)null) { Log.Error("Failed to load ghost prefab " + ghostName); } if (!Object.op_Implicit((Object)(object)val.GetComponent())) { val.AddComponent(); } if (!Object.op_Implicit((Object)(object)val.GetComponent())) { val.AddComponent(); } ConvertAllRenderersToHopooShader(val); return val; } internal static GameObject CloneProjectilePrefab(string prefabName, string newPrefabName) { return PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load("Prefabs/Projectiles/" + prefabName), newPrefabName); } internal static GameObject LoadAndAddProjectilePrefab(this AssetBundle assetBundle, string newPrefabName) { GameObject val = assetBundle.LoadAsset(newPrefabName); if ((Object)(object)val == (Object)null) { Log.ErrorAssetBundle(newPrefabName, ((Object)assetBundle).name); return null; } Content.AddProjectilePrefab(val); return val; } } public static class Config { public static ConfigFile MyConfig = ((BaseUnityPlugin)Soldier76Plugin.instance).Config; public static ConfigEntry CharacterEnableConfig(string section, string characterName, string description = "", bool enabledByDefault = true) { if (string.IsNullOrEmpty(description)) { description = "Set to false to disable this character and as much of its code and content as possible"; } return BindAndOptions(section, "Enable " + characterName, enabledByDefault, description, restartRequired: true); } public static ConfigEntry BindAndOptions(string section, string name, T defaultValue, string description = "", bool restartRequired = false) { return BindAndOptions(section, name, defaultValue, 0f, 20f, description, restartRequired); } public static ConfigEntry BindAndOptions(string section, string name, T defaultValue, float min, float max, string description = "", bool restartRequired = false) { if (string.IsNullOrEmpty(description)) { description = name; } if (restartRequired) { description += " (restart required)"; } ConfigEntry result = MyConfig.Bind(section, name, defaultValue, description); if (Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions")) { } return result; } public static ConfigEntry BindAndOptionsSlider(string section, string name, float defaultValue, string description, float min = 0f, float max = 20f, bool restartRequired = false) { return BindAndOptions(section, name, defaultValue, min, max, description, restartRequired); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static void TryRegisterOption(ConfigEntry entry, float min, float max, bool restartRequired) { } public static bool GetKeyPressed(KeyboardShortcut entry) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) foreach (KeyCode modifier in ((KeyboardShortcut)(ref entry)).Modifiers) { if (!Input.GetKey(modifier)) { return false; } } return Input.GetKeyDown(((KeyboardShortcut)(ref entry)).MainKey); } } internal class Content { internal static void AddCharacterBodyPrefab(GameObject bprefab) { ContentPacks.bodyPrefabs.Add(bprefab); } internal static void AddMasterPrefab(GameObject prefab) { ContentPacks.masterPrefabs.Add(prefab); } internal static void AddProjectilePrefab(GameObject prefab) { ContentPacks.projectilePrefabs.Add(prefab); } internal static void AddSurvivorDef(SurvivorDef survivorDef) { ContentPacks.survivorDefs.Add(survivorDef); } internal static void CreateSurvivor(GameObject bodyPrefab, GameObject displayPrefab, Color charColor, string tokenPrefix) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) CreateSurvivor(bodyPrefab, displayPrefab, charColor, tokenPrefix, null, 100f); } internal static void CreateSurvivor(GameObject bodyPrefab, GameObject displayPrefab, Color charColor, string tokenPrefix, float sortPosition) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) CreateSurvivor(bodyPrefab, displayPrefab, charColor, tokenPrefix, null, sortPosition); } internal static void CreateSurvivor(GameObject bodyPrefab, GameObject displayPrefab, Color charColor, string tokenPrefix, UnlockableDef unlockableDef) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) CreateSurvivor(bodyPrefab, displayPrefab, charColor, tokenPrefix, unlockableDef, 100f); } internal static void CreateSurvivor(GameObject bodyPrefab, GameObject displayPrefab, Color charColor, string tokenPrefix, UnlockableDef unlockableDef, float sortPosition) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) SurvivorDef val = ScriptableObject.CreateInstance(); val.bodyPrefab = bodyPrefab; val.displayPrefab = displayPrefab; val.primaryColor = charColor; val.cachedName = ((Object)bodyPrefab).name.Replace("Body", ""); val.displayNameToken = tokenPrefix + "NAME"; val.descriptionToken = tokenPrefix + "DESCRIPTION"; val.outroFlavorToken = tokenPrefix + "OUTRO_FLAVOR"; val.mainEndingEscapeFailureFlavorToken = tokenPrefix + "OUTRO_FAILURE"; val.desiredSortPosition = sortPosition; val.unlockableDef = unlockableDef; AddSurvivorDef(val); } internal static void AddUnlockableDef(UnlockableDef unlockableDef) { ContentPacks.unlockableDefs.Add(unlockableDef); } internal static UnlockableDef CreateAndAddUnlockbleDef(string identifier, string nameToken, Sprite achievementIcon) { UnlockableDef val = ScriptableObject.CreateInstance(); val.cachedName = identifier; val.nameToken = nameToken; val.achievementIcon = achievementIcon; AddUnlockableDef(val); return val; } internal static void AddSkillDef(SkillDef skillDef) { ContentPacks.skillDefs.Add(skillDef); } internal static void AddSkillFamily(SkillFamily skillFamily) { ContentPacks.skillFamilies.Add(skillFamily); } internal static void AddEntityState(Type entityState) { ContentPacks.entityStates.Add(entityState); } internal static void AddBuffDef(BuffDef buffDef) { ContentPacks.buffDefs.Add(buffDef); } internal static BuffDef CreateAndAddBuff(string buffName, Sprite buffIcon, Color buffColor, bool canStack, bool isDebuff) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) BuffDef val = ScriptableObject.CreateInstance(); ((Object)val).name = buffName; val.buffColor = buffColor; val.canStack = canStack; val.isDebuff = isDebuff; val.eliteDef = null; val.iconSprite = buffIcon; AddBuffDef(val); return val; } internal static void AddEffectDef(EffectDef effectDef) { ContentPacks.effectDefs.Add(effectDef); } internal static EffectDef CreateAndAddEffectDef(GameObject effectPrefab) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown EffectDef val = new EffectDef(effectPrefab); AddEffectDef(val); return val; } internal static void AddNetworkSoundEventDef(NetworkSoundEventDef networkSoundEventDef) { ContentPacks.networkSoundEventDefs.Add(networkSoundEventDef); } internal static NetworkSoundEventDef CreateAndAddNetworkSoundEventDef(string eventName) { NetworkSoundEventDef val = ScriptableObject.CreateInstance(); val.akId = AkSoundEngine.GetIDFromString(eventName); val.eventName = eventName; AddNetworkSoundEventDef(val); return val; } } internal class ContentPacks : IContentPackProvider { [CompilerGenerated] private sealed class d__18 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public FinalizeAsyncArgs args; public ContentPacks <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__18(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { if (<>1__state != 0) { return false; } <>1__state = -1; args.ReportProgress(1f); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__17 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public GetContentPackAsyncArgs args; public ContentPacks <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__17(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { if (<>1__state != 0) { return false; } <>1__state = -1; ContentPack.Copy(<>4__this.contentPack, args.output); args.ReportProgress(1f); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__16 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public LoadStaticContentAsyncArgs args; public ContentPacks <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__16(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { if (<>1__state != 0) { return false; } <>1__state = -1; <>4__this.contentPack.identifier = <>4__this.identifier; <>4__this.contentPack.bodyPrefabs.Add(bodyPrefabs.ToArray()); <>4__this.contentPack.masterPrefabs.Add(masterPrefabs.ToArray()); <>4__this.contentPack.projectilePrefabs.Add(projectilePrefabs.ToArray()); <>4__this.contentPack.survivorDefs.Add(survivorDefs.ToArray()); <>4__this.contentPack.unlockableDefs.Add(unlockableDefs.ToArray()); <>4__this.contentPack.skillDefs.Add(skillDefs.ToArray()); <>4__this.contentPack.skillFamilies.Add(skillFamilies.ToArray()); <>4__this.contentPack.entityStateTypes.Add(entityStates.ToArray()); <>4__this.contentPack.buffDefs.Add(buffDefs.ToArray()); <>4__this.contentPack.effectDefs.Add(effectDefs.ToArray()); <>4__this.contentPack.networkSoundEventDefs.Add(networkSoundEventDefs.ToArray()); args.ReportProgress(1f); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } internal ContentPack contentPack = new ContentPack(); public static List bodyPrefabs = new List(); public static List masterPrefabs = new List(); public static List projectilePrefabs = new List(); public static List survivorDefs = new List(); public static List unlockableDefs = new List(); public static List skillFamilies = new List(); public static List skillDefs = new List(); public static List entityStates = new List(); public static List buffDefs = new List(); public static List effectDefs = new List(); public static List networkSoundEventDefs = new List(); public string identifier => "com.littlefight.soldier76"; public void Initialize() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown ContentManager.collectContentPackProviders += new CollectContentPackProvidersDelegate(ContentManager_collectContentPackProviders); } private void ContentManager_collectContentPackProviders(AddContentPackProviderDelegate addContentPackProvider) { addContentPackProvider.Invoke((IContentPackProvider)(object)this); } [IteratorStateMachine(typeof(d__16))] public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__16(0) { <>4__this = this, args = args }; } [IteratorStateMachine(typeof(d__17))] public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__17(0) { <>4__this = this, args = args }; } [IteratorStateMachine(typeof(d__18))] public IEnumerator FinalizeAsync(FinalizeAsyncArgs args) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__18(0) { <>4__this = this, args = args }; } } internal static class ItemDisplayCheck { public static List allDisplayedItems; public static void PrintUnused(ItemDisplayRuleSet itemDisplayRuleSet, string bodyName = "") { PrintUnused((IEnumerable)itemDisplayRuleSet.keyAssetRuleGroups.ToList(), bodyName); } public static void PrintUnused(IEnumerable ruleSet = null, string bodyName = "") { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) string text = "generating item displays for " + bodyName; if (allDisplayedItems == null) { LazyGatherAllItems(); } List list = new List(allDisplayedItems); string text2 = ""; if (ruleSet != null) { foreach (KeyAssetRuleGroup item in ruleSet) { if (item.displayRuleGroup.rules.Length != 0) { list.Remove(item.keyAsset); if (string.IsNullOrEmpty(text2)) { text2 = item.displayRuleGroup.rules[0].childName; } } } } if (string.IsNullOrEmpty(text2)) { text2 = "Chest"; } foreach (Object item2 in list) { string text3 = ""; if (ItemDisplays.KeyAssetDisplayPrefabs.ContainsKey(item2)) { text3 += SpitOutNewRule(item2, text2, ItemDisplays.KeyAssetDisplayPrefabs[item2]); } else { Log.Error($"COULD NOT FIND DISPLAY PREFABS FOR KEYASSET {item2}"); } text += text3; } Log.Message(text); } private static void LazyGatherAllItems() { allDisplayedItems = new List(ItemDisplays.KeyAssetDisplayPrefabs.Keys); allDisplayedItems.Sort(delegate(Object item1, Object item2) { if (item1 is ItemDef && item2 is ItemDef) { return item1.name.CompareTo(item2.name); } if (item1 is EquipmentDef && item2 is EquipmentDef) { return item1.name.CompareTo(item2.name); } if (item1 is ItemDef && item2 is EquipmentDef) { return -1; } return (item1 is EquipmentDef && item2 is ItemDef) ? 1 : 0; }); } private static string SpitOutNewRule(Object asset, string firstCompatibleChild, ItemDisplayRule[] displayRules) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Invalid comparison between Unknown and I4 //IL_00a5: Unknown result type (might be due to invalid IL or missing references) if (displayRules.Length == 0) { return $"\n[NO DISPLAY RULES FOUND FOR THE KEYASSET {asset}"; } string text = "\n itemDisplayRules.Add(ItemDisplays.CreateDisplayRuleGroupWithRules(ItemDisplays.KeyAssets[\"" + asset.name + "\"]"; for (int i = 0; i < displayRules.Length; i++) { text = (((int)displayRules[i].limbMask != 0) ? (text + ",\n" + $" ItemDisplays.CreateLimbMaskDisplayRule(LimbFlags.{displayRules[i].limbMask})") : (text + ",\n ItemDisplays.CreateDisplayRule(ItemDisplays.LoadDisplay(\"" + ((Object)displayRules[i].followerPrefab).name + "\"),\n \"" + firstCompatibleChild + "\",\n new Vector3(2, 2, 2),\n new Vector3(0, 0, 0),\n new Vector3(1, 1, 1)\n )")); } return text + "\n ));"; } } internal static class ItemDisplays { private static Dictionary itemDisplayPrefabs = new Dictionary(); public static Dictionary KeyAssetDisplayPrefabs = new Dictionary(); public static Dictionary KeyAssets = new Dictionary(); public static int queuedDisplays; public static bool initialized = false; public static void LazyInit() { if (!initialized) { initialized = true; PopulateDisplays(); } } internal static void DisposeWhenDone() { queuedDisplays--; if (queuedDisplays <= 0 && initialized) { initialized = false; itemDisplayPrefabs = null; KeyAssetDisplayPrefabs = null; KeyAssets = null; } } internal static void PopulateDisplays() { PopulateFromBody("LoaderBody"); } private static void PopulateFromBody(string bodyName) { ItemDisplayRuleSet itemDisplayRuleSet = ((Component)LegacyResourcesAPI.Load("Prefabs/CharacterBodies/" + bodyName).GetComponent().modelTransform).GetComponent().itemDisplayRuleSet; KeyAssetRuleGroup[] keyAssetRuleGroups = itemDisplayRuleSet.keyAssetRuleGroups; for (int i = 0; i < keyAssetRuleGroups.Length; i++) { ItemDisplayRule[] rules = keyAssetRuleGroups[i].displayRuleGroup.rules; KeyAssetDisplayPrefabs[keyAssetRuleGroups[i].keyAsset] = rules; KeyAssets[keyAssetRuleGroups[i].keyAsset.name] = keyAssetRuleGroups[i].keyAsset; for (int j = 0; j < rules.Length; j++) { GameObject followerPrefab = rules[j].followerPrefab; if (Object.op_Implicit((Object)(object)followerPrefab)) { string key = ((Object)followerPrefab).name?.ToLowerInvariant(); if (!itemDisplayPrefabs.ContainsKey(key)) { itemDisplayPrefabs[key] = followerPrefab; } } } } } private static void PopulateCustomLightningArm() { GameObject val = PrefabAPI.InstantiateClone(itemDisplayPrefabs["displaylightningarmright"], "DisplayLightningCustom", false); LimbMatcher component = val.GetComponent(); component.limbPairs[0].targetChildLimb = "LightningArm1"; component.limbPairs[1].targetChildLimb = "LightningArm2"; component.limbPairs[2].targetChildLimb = "LightningArmEnd"; itemDisplayPrefabs["displaylightningarmcustom"] = val; } public static GameObject LoadDisplay(string name) { if (itemDisplayPrefabs.ContainsKey(name.ToLowerInvariant()) && Object.op_Implicit((Object)(object)itemDisplayPrefabs[name.ToLowerInvariant()])) { return itemDisplayPrefabs[name.ToLowerInvariant()]; } Log.Error("item display " + name + " returned null"); return null; } public static KeyAssetRuleGroup CreateDisplayRuleGroupWithRules(string itemName, params ItemDisplayRule[] rules) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) return CreateDisplayRuleGroupWithRules(GetKeyAssetFromString(itemName), rules); } public static KeyAssetRuleGroup CreateDisplayRuleGroupWithRules(Object keyAsset_, params ItemDisplayRule[] rules) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) if (keyAsset_ == (Object)null) { Log.Error("could not find keyasset"); } KeyAssetRuleGroup result = default(KeyAssetRuleGroup); result.keyAsset = keyAsset_; result.displayRuleGroup = new DisplayRuleGroup { rules = rules }; return result; } public static ItemDisplayRule CreateDisplayRule(string prefabName, string childName, Vector3 position, Vector3 rotation, Vector3 scale) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) return CreateDisplayRule(LoadDisplay(prefabName), childName, position, rotation, scale); } public static ItemDisplayRule CreateDisplayRule(GameObject itemPrefab, string childName, Vector3 position, Vector3 rotation, Vector3 scale) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) ItemDisplayRule result = default(ItemDisplayRule); result.ruleType = (ItemDisplayRuleType)0; result.childName = childName; result.followerPrefab = itemPrefab; result.limbMask = (LimbFlags)0; result.localPos = position; result.localAngles = rotation; result.localScale = scale; return result; } public static ItemDisplayRule CreateLimbMaskDisplayRule(LimbFlags limb) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) ItemDisplayRule result = default(ItemDisplayRule); result.ruleType = (ItemDisplayRuleType)1; result.limbMask = limb; result.childName = ""; result.followerPrefab = null; return result; } private static Object GetKeyAssetFromString(string itemName) { Object val = (Object)(object)LegacyResourcesAPI.Load("ItemDefs/" + itemName); if (val == (Object)null) { val = (Object)(object)LegacyResourcesAPI.Load("EquipmentDefs/" + itemName); } if (val == (Object)null) { Log.Error("Could not load keyasset for " + itemName); } return val; } } internal static class Language { public static string TokensOutput = ""; public static bool usingLanguageFolder = false; public static bool printingEnabled = false; public static void Init() { if (usingLanguageFolder) { Language.collectLanguageRootFolders += Language_collectLanguageRootFolders; } } private static void Language_collectLanguageRootFolders(List obj) { string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)Soldier76Plugin.instance).Info.Location), "Language"); if (Directory.Exists(text)) { obj.Add(text); } } public static void Add(string token, string text) { if (!usingLanguageFolder) { LanguageAPI.Add(token, text); } if (printingEnabled) { TokensOutput = TokensOutput + "\n \"" + token + "\" : \"" + text.Replace(Environment.NewLine, "\\n").Replace("\n", "\\n") + "\","; } } public static void PrintOutput(string fileName = "") { if (printingEnabled) { string text = "{\n strings:\n {" + TokensOutput + "\n }\n}"; Log.Message(fileName + ": \n" + text); if (!string.IsNullOrEmpty(fileName)) { string path = Path.Combine(Directory.GetParent(((BaseUnityPlugin)Soldier76Plugin.instance).Info.Location).FullName, "Language", "en", fileName); File.WriteAllText(path, text); } TokensOutput = ""; } } } internal static class Materials { private static List cachedMaterials = new List(); internal static Shader hotpoo = LegacyResourcesAPI.Load("Shaders/Deferred/HGStandard"); public static Material LoadMaterial(this AssetBundle assetBundle, string materialName) { return assetBundle.CreateHopooMaterialFromBundle(materialName); } public static Material CreateHopooMaterialFromBundle(this AssetBundle assetBundle, string materialName) { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown Material val = cachedMaterials.Find(delegate(Material mat) { materialName.Replace(" (Instance)", ""); return ((Object)mat).name.Contains(materialName); }); if (Object.op_Implicit((Object)(object)val)) { Log.Debug(((Object)val).name + " has already been loaded. returning cached"); return val; } val = assetBundle.LoadAsset(materialName); if (!Object.op_Implicit((Object)(object)val)) { Log.ErrorAssetBundle(materialName, ((Object)assetBundle).name); return new Material(hotpoo); } return val.ConvertDefaultShaderToHopoo(); } public static Material SetHopooMaterial(this Material tempMat) { return tempMat.ConvertDefaultShaderToHopoo(); } public static Material ConvertDefaultShaderToHopoo(this Material tempMat) { //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) if (cachedMaterials.Contains(tempMat)) { Log.Debug(((Object)tempMat).name + " has already been converted. returning cached"); return tempMat; } string text = ((Object)tempMat.shader).name.ToLowerInvariant(); if (!text.StartsWith("standard") && !text.StartsWith("autodesk")) { Log.Debug(((Object)tempMat).name + " is not unity standard shader. aborting material conversion"); return tempMat; } float? num = null; Color? val = null; if (tempMat.IsKeywordEnabled("_NORMALMAP")) { num = tempMat.GetFloat("_BumpScale"); } if (tempMat.IsKeywordEnabled("_EMISSION")) { val = tempMat.GetColor("_EmissionColor"); } tempMat.shader = hotpoo; tempMat.SetTexture("_EmTex", tempMat.GetTexture("_EmissionMap")); tempMat.EnableKeyword("DITHER"); if (num.HasValue) { tempMat.SetFloat("_NormalStrength", num.Value); tempMat.SetTexture("_NormalTex", tempMat.GetTexture("_BumpMap")); } if (val.HasValue) { tempMat.SetColor("_EmColor", val.Value); tempMat.SetFloat("_EmPower", 1f); } if (tempMat.IsKeywordEnabled("NOCULL")) { tempMat.SetInt("_Cull", 0); } if (tempMat.IsKeywordEnabled("LIMBREMOVAL")) { tempMat.SetInt("_LimbRemovalOn", 1); } cachedMaterials.Add(tempMat); return tempMat; } public static Material MakeUnique(this Material material) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown if (cachedMaterials.Contains(material)) { return new Material(material); } return material; } public static Material SetColor(this Material material, Color color) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) material.SetColor("_Color", color); return material; } public static Material SetNormal(this Material material, float normalStrength = 1f) { material.SetFloat("_NormalStrength", normalStrength); return material; } public static Material SetEmission(this Material material) { return material.SetEmission(1f); } public static Material SetEmission(this Material material, float emission) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return material.SetEmission(emission, Color.white); } public static Material SetEmission(this Material material, float emission, Color emissionColor) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) material.SetFloat("_EmPower", emission); material.SetColor("_EmColor", emissionColor); return material; } public static Material SetCull(this Material material, bool cull = false) { material.SetInt("_Cull", cull ? 1 : 0); return material; } public static Material SetSpecular(this Material material, float strength) { material.SetFloat("_SpecularStrength", strength); return material; } public static Material SetSpecular(this Material material, float strength, float exponent) { material.SetFloat("_SpecularStrength", strength); material.SetFloat("SpecularExponent", exponent); return material; } } internal static class Prefabs { private static PhysicMaterial ragdollMaterial; public static GameObject CreateDisplayPrefab(AssetBundle assetBundle, string displayPrefabName, GameObject prefab) { GameObject val = assetBundle.LoadAsset(displayPrefabName); if ((Object)(object)val == (Object)null) { Log.Error("could not load display prefab " + displayPrefabName + ". Make sure this prefab exists in assetbundle " + ((Object)assetBundle).name); return null; } CharacterModel val2 = val.GetComponent(); if (!Object.op_Implicit((Object)(object)val2)) { val2 = val.AddComponent(); } val2.baseRendererInfos = prefab.GetComponentInChildren().baseRendererInfos; Asset.ConvertAllRenderersToHopooShader(val); return val; } public static GameObject LoadCharacterModel(AssetBundle assetBundle, string modelName) { GameObject val = assetBundle.LoadAsset(modelName); if ((Object)(object)val == (Object)null) { Log.Error("could not load model prefab " + modelName + ". Make sure this prefab exists in assetbundle " + ((Object)assetBundle).name); return null; } return val; } public static GameObject LoadCharacterBody(AssetBundle assetBundle, string bodyName) { GameObject val = assetBundle.LoadAsset(bodyName); if ((Object)(object)val == (Object)null) { Log.Error("could not load body prefab " + bodyName + ". Make sure this prefab exists in assetbundle " + ((Object)assetBundle).name); return null; } return val; } public static GameObject CloneCharacterBody(BodyInfo bodyInfo) { GameObject val = LegacyResourcesAPI.Load("Prefabs/CharacterBodies/" + bodyInfo.bodyNameToClone + "Body"); if (!Object.op_Implicit((Object)(object)val)) { Log.Error(bodyInfo.bodyNameToClone + " Body to clone is not a valid body, character creation failed"); return null; } GameObject val2 = PrefabAPI.InstantiateClone(val, bodyInfo.bodyName); for (int num = val2.transform.childCount - 1; num >= 0; num--) { Object.DestroyImmediate((Object)(object)((Component)val2.transform.GetChild(num)).gameObject); } return val2; } public static GameObject CreateBodyPrefab(AssetBundle assetBundle, string modelPrefabName, BodyInfo bodyInfo) { return CreateBodyPrefab(LoadCharacterModel(assetBundle, modelPrefabName), bodyInfo); } public static GameObject CreateBodyPrefab(GameObject model, BodyInfo bodyInfo) { return CreateBodyPrefab(CloneCharacterBody(bodyInfo), model, bodyInfo); } public static GameObject CreateBodyPrefab(GameObject newBodyPrefab, AssetBundle assetBundle, string modelName, BodyInfo bodyInfo) { return CreateBodyPrefab(newBodyPrefab, LoadCharacterModel(assetBundle, modelName), bodyInfo); } public static GameObject CreateBodyPrefab(AssetBundle assetBundle, string bodyPrefabName, string modelPrefabName, BodyInfo bodyInfo) { return CreateBodyPrefab(LoadCharacterBody(assetBundle, bodyPrefabName), LoadCharacterModel(assetBundle, modelPrefabName), bodyInfo); } public static GameObject CreateBodyPrefab(GameObject newBodyPrefab, GameObject model, BodyInfo bodyInfo) { if ((Object)(object)model == (Object)null || (Object)(object)newBodyPrefab == (Object)null) { Log.Error($"Character creation failed. Model: {model}, Body: {newBodyPrefab}"); return null; } SetupCharacterBody(newBodyPrefab, bodyInfo); Transform modelBaseTransform = AddCharacterModelToSurvivorBody(newBodyPrefab, model.transform, bodyInfo); SetupModelLocator(newBodyPrefab, modelBaseTransform, model.transform); SetupCharacterDirection(newBodyPrefab, modelBaseTransform, model.transform); SetupCameraTargetParams(newBodyPrefab, bodyInfo); SetupCapsuleCollider(newBodyPrefab); Content.AddCharacterBodyPrefab(newBodyPrefab); return newBodyPrefab; } private static void SetupCharacterBody(GameObject newBodyPrefab, BodyInfo bodyInfo) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) CharacterBody component = newBodyPrefab.GetComponent(); component.baseNameToken = bodyInfo.bodyNameToken; component.subtitleNameToken = bodyInfo.subtitleNameToken; component.portraitIcon = bodyInfo.characterPortrait; component.bodyColor = bodyInfo.bodyColor; component._defaultCrosshairPrefab = bodyInfo.crosshair; component.hideCrosshair = false; component.preferredPodPrefab = bodyInfo.podPrefab; component.baseMaxHealth = bodyInfo.maxHealth; component.baseRegen = bodyInfo.healthRegen; component.baseArmor = bodyInfo.armor; component.baseMaxShield = bodyInfo.shield; component.baseDamage = bodyInfo.damage; component.baseAttackSpeed = bodyInfo.attackSpeed; component.baseCrit = bodyInfo.crit; component.baseMoveSpeed = bodyInfo.moveSpeed; component.baseJumpPower = bodyInfo.jumpPower; component.autoCalculateLevelStats = bodyInfo.autoCalculateLevelStats; if (bodyInfo.autoCalculateLevelStats) { component.levelMaxHealth = Mathf.Round(component.baseMaxHealth * 0.3f); component.levelMaxShield = Mathf.Round(component.baseMaxShield * 0.3f); component.levelRegen = component.baseRegen * 0.2f; component.levelMoveSpeed = 0f; component.levelJumpPower = 0f; component.levelDamage = component.baseDamage * 0.2f; component.levelAttackSpeed = 0f; component.levelCrit = 0f; component.levelArmor = 0f; } else { component.levelMaxHealth = bodyInfo.healthGrowth; component.levelMaxShield = bodyInfo.shieldGrowth; component.levelRegen = bodyInfo.regenGrowth; component.levelMoveSpeed = bodyInfo.moveSpeedGrowth; component.levelJumpPower = bodyInfo.jumpPowerGrowth; component.levelDamage = bodyInfo.damageGrowth; component.levelAttackSpeed = bodyInfo.attackSpeedGrowth; component.levelCrit = bodyInfo.critGrowth; component.levelArmor = bodyInfo.armorGrowth; } component.baseAcceleration = bodyInfo.acceleration; component.baseJumpCount = bodyInfo.jumpCount; component.sprintingSpeedMultiplier = 1.45f; component.bodyFlags = (BodyFlags)16; component.rootMotionInMainState = false; component.hullClassification = (HullClassification)0; component.isChampion = false; } private static Transform AddCharacterModelToSurvivorBody(GameObject bodyPrefab, Transform modelTransform, BodyInfo bodyInfo) { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) Transform val = bodyPrefab.transform.Find("ModelBase"); if ((Object)(object)val == (Object)null) { val = new GameObject("ModelBase").transform; val.parent = bodyPrefab.transform; val.localPosition = bodyInfo.modelBasePosition; val.localRotation = Quaternion.identity; } modelTransform.parent = ((Component)val).transform; modelTransform.localPosition = Vector3.zero; modelTransform.localRotation = Quaternion.identity; Transform val2 = bodyPrefab.transform.Find("CameraPivot"); if ((Object)(object)val2 == (Object)null) { val2 = new GameObject("CameraPivot").transform; val2.parent = bodyPrefab.transform; val2.localPosition = bodyInfo.cameraPivotPosition; val2.localRotation = Quaternion.identity; } Transform val3 = bodyPrefab.transform.Find("AimOrigin"); if ((Object)(object)val3 == (Object)null) { val3 = new GameObject("AimOrigin").transform; val3.parent = bodyPrefab.transform; val3.localPosition = bodyInfo.aimOriginPosition; val3.localRotation = Quaternion.identity; } bodyPrefab.GetComponent().aimOriginTransform = val3; return ((Component)val).transform; } private static void SetupCharacterDirection(GameObject prefab, Transform modelBaseTransform, Transform modelTransform) { if (Object.op_Implicit((Object)(object)prefab.GetComponent())) { CharacterDirection component = prefab.GetComponent(); component.targetTransform = modelBaseTransform; component.overrideAnimatorForwardTransform = null; component.rootMotionAccumulator = null; component.modelAnimator = ((Component)modelTransform).GetComponent(); component.driveFromRootRotation = false; component.turnSpeed = 720f; } } private static void SetupCameraTargetParams(GameObject prefab, BodyInfo bodyInfo) { CameraTargetParams component = prefab.GetComponent(); component.cameraParams = bodyInfo.cameraParams; component.cameraPivotTransform = prefab.transform.Find("CameraPivot"); } private static void SetupModelLocator(GameObject prefab, Transform modelBaseTransform, Transform modelTransform) { ModelLocator component = prefab.GetComponent(); component.modelTransform = modelTransform; component.modelBaseTransform = modelBaseTransform; } private static void SetupCapsuleCollider(GameObject prefab) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) CapsuleCollider component = prefab.GetComponent(); component.center = new Vector3(0f, 0f, 0f); component.radius = 0.5f; component.height = 1.82f; component.direction = 1; } public static CharacterModel SetupCharacterModel(GameObject bodyPrefab, CustomRendererInfo[] customInfos = null) { CharacterModel val = ((Component)bodyPrefab.GetComponent().modelTransform).gameObject.GetComponent(); bool flag = (Object)(object)val != (Object)null; if (!flag) { val = ((Component)bodyPrefab.GetComponent().modelTransform).gameObject.AddComponent(); } val.body = bodyPrefab.GetComponent(); val.autoPopulateLightInfos = true; val.invisibilityCount = 0; val.temporaryOverlays = new List(); if (!flag) { SetupCustomRendererInfos(val, customInfos); } else { SetupPreAttachedRendererInfos(val); } SetupHurtboxGroup(bodyPrefab, ((Component)val).gameObject); SetupAimAnimator(bodyPrefab, ((Component)val).gameObject); SetupFootstepController(((Component)val).gameObject); SetupRagdoll(((Component)val).gameObject); return val; } public static void SetupPreAttachedRendererInfos(CharacterModel characterModel) { for (int i = 0; i < characterModel.baseRendererInfos.Length; i++) { if ((Object)(object)characterModel.baseRendererInfos[i].defaultMaterial == (Object)null) { characterModel.baseRendererInfos[i].defaultMaterial = characterModel.baseRendererInfos[i].renderer.sharedMaterial; } if ((Object)(object)characterModel.baseRendererInfos[i].defaultMaterial == (Object)null) { Log.Error($"no material for rendererinfo of this renderer: {characterModel.baseRendererInfos[i].renderer}"); } characterModel.baseRendererInfos[i].defaultMaterial.ConvertDefaultShaderToHopoo(); } } public static void SetupCustomRendererInfos(CharacterModel characterModel, CustomRendererInfo[] customInfos) { //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) ChildLocator component = ((Component)characterModel).GetComponent(); if (!Object.op_Implicit((Object)(object)component)) { Log.Error("Failed CharacterModel setup: ChildLocator component does not exist on the model"); return; } List list = new List(); for (int i = 0; i < customInfos.Length; i++) { if (!Object.op_Implicit((Object)(object)component.FindChild(customInfos[i].childName))) { Log.Error("Trying to add a RendererInfo for a renderer that does not exist: " + customInfos[i].childName); continue; } Renderer component2 = ((Component)component.FindChild(customInfos[i].childName)).GetComponent(); if (Object.op_Implicit((Object)(object)component2)) { Material val = customInfos[i].material; if ((Object)(object)val == (Object)null) { val = ((!customInfos[i].dontHotpoo) ? component2.sharedMaterial.ConvertDefaultShaderToHopoo() : component2.sharedMaterial); } list.Add(new RendererInfo { renderer = component2, defaultMaterial = val, ignoreOverlays = customInfos[i].ignoreOverlays, defaultShadowCastingMode = (ShadowCastingMode)1 }); } } characterModel.baseRendererInfos = list.ToArray(); } private static void SetupHurtboxGroup(GameObject bodyPrefab, GameObject model) { SetupMainHurtboxesFromChildLocator(bodyPrefab, model); SetHurtboxesHealthComponents(bodyPrefab); } private static void SetupMainHurtboxesFromChildLocator(GameObject bodyPrefab, GameObject model) { //IL_011b: 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) if ((Object)(object)bodyPrefab.GetComponent() != (Object)null) { Log.Debug("Hitboxgroup already exists on model prefab. aborting code setup"); return; } ChildLocator component = model.GetComponent(); if (string.IsNullOrEmpty(component.FindChildNameInsensitive("MainHurtbox"))) { Log.Error("Could not set up main hurtbox: make sure you have a transform pair in your prefab's ChildLocator called 'MainHurtbox'"); return; } HurtBoxGroup val = model.AddComponent(); HurtBox val2 = null; GameObject val3 = component.FindChildGameObjectInsensitive("HeadHurtbox"); if (Object.op_Implicit((Object)(object)val3)) { Log.Debug("HeadHurtboxFound. Setting up"); val2 = val3.AddComponent(); ((Component)val2).gameObject.layer = LayerIndex.entityPrecise.intVal; val2.healthComponent = bodyPrefab.GetComponent(); val2.isBullseye = false; val2.isSniperTarget = true; val2.damageModifier = (DamageModifier)0; val2.hurtBoxGroup = val; val2.indexInGroup = 1; } HurtBox val4 = component.FindChildGameObjectInsensitive("MainHurtbox").AddComponent(); ((Component)val4).gameObject.layer = LayerIndex.entityPrecise.intVal; val4.healthComponent = bodyPrefab.GetComponent(); val4.isBullseye = true; val4.isSniperTarget = (Object)(object)val2 == (Object)null; val4.damageModifier = (DamageModifier)0; val4.hurtBoxGroup = val; val4.indexInGroup = 0; if (Object.op_Implicit((Object)(object)val2)) { val.hurtBoxes = (HurtBox[])(object)new HurtBox[2] { val4, val2 }; } else { val.hurtBoxes = (HurtBox[])(object)new HurtBox[1] { val4 }; } val.mainHurtBox = val4; val.bullseyeCount = 1; } private static string FindChildNameInsensitive(this ChildLocator childLocator, string child) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) return childLocator.transformPairs.Where((NameTransformPair pair) => pair.name.ToLowerInvariant() == child.ToLowerInvariant()).FirstOrDefault().name; } private static Transform FindChildInsensitive(this ChildLocator childLocator, string child) { return childLocator.FindChild(childLocator.FindChildNameInsensitive(child)); } private static GameObject FindChildGameObjectInsensitive(this ChildLocator childLocator, string child) { return childLocator.FindChildGameObject(childLocator.FindChildNameInsensitive(child)); } public static void SetHurtboxesHealthComponents(GameObject bodyPrefab) { HealthComponent component = bodyPrefab.GetComponent(); HurtBoxGroup[] componentsInChildren = bodyPrefab.GetComponentsInChildren(); foreach (HurtBoxGroup val in componentsInChildren) { val.mainHurtBox.healthComponent = component; for (int j = 0; j < val.hurtBoxes.Length; j++) { val.hurtBoxes[j].healthComponent = component; } } } private static void SetupFootstepController(GameObject model) { FootstepHandler val = model.AddComponent(); val.baseFootstepString = "Play_player_footstep"; val.sprintFootstepOverrideString = ""; val.enableFootstepDust = true; val.footstepDustPrefab = LegacyResourcesAPI.Load("Prefabs/GenericFootstepDust"); } private static void SetupRagdoll(GameObject model) { RagdollController component = model.GetComponent(); if (!Object.op_Implicit((Object)(object)component)) { return; } if ((Object)(object)ragdollMaterial == (Object)null) { ragdollMaterial = ((Component)LegacyResourcesAPI.Load("Prefabs/CharacterBodies/CommandoBody").GetComponentInChildren().bones[1]).GetComponent().material; } Transform[] bones = component.bones; foreach (Transform val in bones) { if (Object.op_Implicit((Object)(object)val)) { ((Component)val).gameObject.layer = LayerIndex.ragdoll.intVal; Collider component2 = ((Component)val).GetComponent(); if (Object.op_Implicit((Object)(object)component2)) { component2.sharedMaterial = ragdollMaterial; } else { Log.Error($"Ragdoll bone {((Component)val).gameObject} doesn't have a collider. Ragdoll will break."); } } } } private static void SetupAimAnimator(GameObject prefab, GameObject model) { AimAnimator val = model.AddComponent(); val.directionComponent = prefab.GetComponent(); val.pitchRangeMax = 60f; val.pitchRangeMin = -60f; val.yawRangeMin = -80f; val.yawRangeMax = 80f; val.pitchGiveupRange = 30f; val.yawGiveupRange = 10f; val.giveupDuration = 3f; val.inputBank = prefab.GetComponent(); } public static void CreateGenericDoppelganger(GameObject bodyPrefab, string masterName, string masterToCopy) { CloneDopplegangerMaster(bodyPrefab, masterName, masterToCopy); } public static GameObject CloneDopplegangerMaster(GameObject bodyPrefab, string masterName, string masterToCopy) { GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load("Prefabs/CharacterMasters/" + masterToCopy + "MonsterMaster"), masterName, true); val.GetComponent().bodyPrefab = bodyPrefab; Content.AddMasterPrefab(val); return val; } public static GameObject CreateBlankMasterPrefab(GameObject bodyPrefab, string masterName) { GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load("Prefabs/CharacterMasters/CommandoMonsterMaster"), masterName, true); ContentPacks.masterPrefabs.Add(val); CharacterMaster component = val.GetComponent(); component.bodyPrefab = bodyPrefab; AISkillDriver[] components = val.GetComponents(); for (int i = 0; i < components.Length; i++) { Object.Destroy((Object)(object)components[i]); } return val; } public static GameObject LoadMaster(this AssetBundle assetBundle, GameObject bodyPrefab, string assetName) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) GameObject val = assetBundle.LoadAsset(assetName); BaseAI val2 = val.GetComponent(); if ((Object)(object)val2 == (Object)null) { val2 = val.AddComponent(); val2.aimVectorDampTime = 0.1f; val2.aimVectorMaxSpeed = 360f; } val2.scanState = new SerializableEntityStateType(typeof(Wander)); EntityStateMachine component = val.GetComponent(); if ((Object)(object)component == (Object)null) { AddEntityStateMachine(val, "AI", typeof(Wander), typeof(Wander)); } val2.stateMachine = component; CharacterMaster val3 = val.GetComponent(); if ((Object)(object)val3 == (Object)null) { val3 = val.AddComponent(); } val3.bodyPrefab = bodyPrefab; val3.teamIndex = (TeamIndex)2; Content.AddMasterPrefab(val); return val; } public static void ClearEntityStateMachines(GameObject bodyPrefab) { EntityStateMachine[] components = bodyPrefab.GetComponents(); for (int num = components.Length - 1; num >= 0; num--) { Object.DestroyImmediate((Object)(object)components[num]); } NetworkStateMachine component = bodyPrefab.GetComponent(); component.stateMachines = Array.Empty(); CharacterDeathBehavior component2 = bodyPrefab.GetComponent(); if (Object.op_Implicit((Object)(object)component2)) { component2.idleStateMachine = Array.Empty(); } SetStateOnHurt component3 = bodyPrefab.GetComponent(); if (Object.op_Implicit((Object)(object)component3)) { component3.idleStateMachine = Array.Empty(); } CharacterBody component4 = bodyPrefab.GetComponent(); if (Object.op_Implicit((Object)(object)component4)) { component4.vehicleIdleStateMachine = Array.Empty(); } } public static EntityStateMachine AddEntityStateMachine(GameObject prefab, string machineName, Type mainStateType = null, Type initalStateType = null, bool addToHurt = true, bool addToDeath = true) { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) EntityStateMachine val = EntityStateMachine.FindByCustomName(prefab, machineName); if ((Object)(object)val == (Object)null) { val = prefab.AddComponent(); } else { Log.Message("An Entity State Machine already exists with the name " + machineName + ". replacing."); } val.customName = machineName; if (mainStateType == null) { mainStateType = typeof(Idle); } val.mainStateType = new SerializableEntityStateType(mainStateType); if (initalStateType == null) { initalStateType = typeof(Idle); } val.initialStateType = new SerializableEntityStateType(initalStateType); NetworkStateMachine component = prefab.GetComponent(); if (Object.op_Implicit((Object)(object)component)) { component.stateMachines = component.stateMachines.Append(val).ToArray(); } CharacterDeathBehavior component2 = prefab.GetComponent(); if (Object.op_Implicit((Object)(object)component2) && addToDeath) { component2.idleStateMachine = component2.idleStateMachine.Append(val).ToArray(); } SetStateOnHurt component3 = prefab.GetComponent(); if (Object.op_Implicit((Object)(object)component3) && addToHurt) { component3.idleStateMachine = component3.idleStateMachine.Append(val).ToArray(); } CharacterBody component4 = prefab.GetComponent(); if (Object.op_Implicit((Object)(object)component4)) { component4.vehicleIdleStateMachine = component4.vehicleIdleStateMachine.Append(val).ToArray(); } return val; } public static EntityStateMachine AddMainEntityStateMachine(GameObject bodyPrefab, string machineName = "Body", Type mainStateType = null, Type initalStateType = null) { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) EntityStateMachine val = EntityStateMachine.FindByCustomName(bodyPrefab, machineName); if ((Object)(object)val == (Object)null) { val = bodyPrefab.AddComponent(); } else { Log.Message("An Entity State Machine already exists with the name " + machineName + ". replacing."); } val.customName = machineName; if (mainStateType == null) { mainStateType = typeof(GenericCharacterMain); } val.mainStateType = new SerializableEntityStateType(mainStateType); if (initalStateType == null) { initalStateType = typeof(SpawnTeleporterState); } val.initialStateType = new SerializableEntityStateType(initalStateType); NetworkStateMachine component = bodyPrefab.GetComponent(); if (Object.op_Implicit((Object)(object)component)) { component.stateMachines = component.stateMachines.Append(val).ToArray(); } CharacterDeathBehavior component2 = bodyPrefab.GetComponent(); if (Object.op_Implicit((Object)(object)component2)) { component2.deathStateMachine = val; } SetStateOnHurt component3 = bodyPrefab.GetComponent(); if (Object.op_Implicit((Object)(object)component3)) { component3.targetStateMachine = val; } return val; } public static void SetupHitBoxGroup(GameObject modelPrefab, string hitBoxGroupName, params string[] hitboxChildNames) { ChildLocator component = modelPrefab.GetComponent(); Transform[] array = (Transform[])(object)new Transform[hitboxChildNames.Length]; for (int i = 0; i < hitboxChildNames.Length; i++) { array[i] = component.FindChild(hitboxChildNames[i]); if ((Object)(object)array[i] == (Object)null) { Log.Error("missing hitbox for " + hitboxChildNames[i]); } } SetupHitBoxGroup(modelPrefab, hitBoxGroupName, array); } public static void SetupHitBoxGroup(GameObject prefab, string hitBoxGroupName, params Transform[] hitBoxTransforms) { List list = new List(); foreach (Transform val in hitBoxTransforms) { if ((Object)(object)val == (Object)null) { Log.Error("Error setting up hitboxGroup for " + hitBoxGroupName + ": hitbox transform was null"); continue; } HitBox item = ((Component)val).gameObject.AddComponent(); ((Component)val).gameObject.layer = LayerIndex.projectile.intVal; list.Add(item); } if (list.Count == 0) { Log.Error("No hitboxes were set up. aborting setting up hitboxGroup for " + hitBoxGroupName); return; } HitBoxGroup val2 = prefab.AddComponent(); val2.hitBoxes = list.ToArray(); val2.groupName = hitBoxGroupName; } } public class CustomRendererInfo { public string childName; public Material material = null; public bool dontHotpoo = false; public bool ignoreOverlays = false; } internal static class Skills { public static void CreateSkillFamilies(GameObject targetPrefab) { SkillSlot[] array = new SkillSlot[4]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); CreateSkillFamilies(targetPrefab, (SkillSlot[])(object)array); } public static void CreateSkillFamilies(GameObject targetPrefab, params SkillSlot[] slots) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected I4, but got Unknown SkillLocator component = targetPrefab.GetComponent(); foreach (SkillSlot val in slots) { SkillSlot val2 = val; switch (val2 - -1) { case 1: component.primary = CreateGenericSkillWithSkillFamily(targetPrefab, "Primary"); break; case 2: component.secondary = CreateGenericSkillWithSkillFamily(targetPrefab, "Secondary"); break; case 3: component.utility = CreateGenericSkillWithSkillFamily(targetPrefab, "Utility"); break; case 4: component.special = CreateGenericSkillWithSkillFamily(targetPrefab, "Special"); break; } } } public static void ClearGenericSkills(GameObject targetPrefab) { GenericSkill[] componentsInChildren = targetPrefab.GetComponentsInChildren(); foreach (GenericSkill val in componentsInChildren) { Object.DestroyImmediate((Object)(object)val); } } public static GenericSkill CreateGenericSkillWithSkillFamily(GameObject targetPrefab, SkillSlot skillSlot, bool hidden = false) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected I4, but got Unknown SkillLocator component = targetPrefab.GetComponent(); switch (skillSlot - -1) { case 1: return component.primary = CreateGenericSkillWithSkillFamily(targetPrefab, "Primary", hidden); case 2: return component.secondary = CreateGenericSkillWithSkillFamily(targetPrefab, "Secondary", hidden); case 3: return component.utility = CreateGenericSkillWithSkillFamily(targetPrefab, "Utility", hidden); case 4: return component.special = CreateGenericSkillWithSkillFamily(targetPrefab, "Special", hidden); case 0: Log.Error("Failed to create GenericSkill with skillslot None. If making a GenericSkill outside of the main 4, specify a familyName, and optionally a genericSkillName"); return null; default: return null; } } public static GenericSkill CreateGenericSkillWithSkillFamily(GameObject targetPrefab, string familyName, bool hidden = false) { return CreateGenericSkillWithSkillFamily(targetPrefab, familyName, familyName, hidden); } public static GenericSkill CreateGenericSkillWithSkillFamily(GameObject targetPrefab, string genericSkillName, string familyName, bool hidden = false) { GenericSkill val = targetPrefab.AddComponent(); val.skillName = genericSkillName; val.hideInCharacterSelect = hidden; SkillFamily val2 = ScriptableObject.CreateInstance(); ((Object)val2).name = ((Object)targetPrefab).name + familyName + "Family"; val2.variants = (Variant[])(object)new Variant[0]; val._skillFamily = val2; Content.AddSkillFamily(val2); return val; } public static void AddSkillToFamily(SkillFamily skillFamily, SkillDef skillDef, UnlockableDef unlockableDef = null) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1); Variant[] variants = skillFamily.variants; int num = skillFamily.variants.Length - 1; Variant val = new Variant { skillDef = skillDef, unlockableDef = unlockableDef }; ((Variant)(ref val)).viewableNode = new Node(skillDef.skillNameToken, false, (Node)null); variants[num] = val; } public static void AddSkillsToFamily(SkillFamily skillFamily, params SkillDef[] skillDefs) { foreach (SkillDef skillDef in skillDefs) { AddSkillToFamily(skillFamily, skillDef); } } public static void AddPrimarySkills(GameObject targetPrefab, params SkillDef[] skillDefs) { AddSkillsToFamily(targetPrefab.GetComponent().primary.skillFamily, skillDefs); } public static void AddSecondarySkills(GameObject targetPrefab, params SkillDef[] skillDefs) { AddSkillsToFamily(targetPrefab.GetComponent().secondary.skillFamily, skillDefs); } public static void AddUtilitySkills(GameObject targetPrefab, params SkillDef[] skillDefs) { AddSkillsToFamily(targetPrefab.GetComponent().utility.skillFamily, skillDefs); } public static void AddSpecialSkills(GameObject targetPrefab, params SkillDef[] skillDefs) { AddSkillsToFamily(targetPrefab.GetComponent().special.skillFamily, skillDefs); } public static void AddUnlockablesToFamily(SkillFamily skillFamily, params UnlockableDef[] unlockableDefs) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < unlockableDefs.Length; i++) { Variant val = skillFamily.variants[i]; val.unlockableDef = unlockableDefs[i]; skillFamily.variants[i] = val; } } public static SkillDef CreateSkillDef(SkillDefInfo skillDefInfo) { return Skills.CreateSkillDef(skillDefInfo); } public static T CreateSkillDef(SkillDefInfo skillDefInfo) where T : SkillDef { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) T val = ScriptableObject.CreateInstance(); ((SkillDef)val).skillName = skillDefInfo.skillName; ((Object)(object)val).name = skillDefInfo.skillName; ((SkillDef)val).skillNameToken = skillDefInfo.skillNameToken; ((SkillDef)val).skillDescriptionToken = skillDefInfo.skillDescriptionToken; ((SkillDef)val).icon = skillDefInfo.skillIcon; ((SkillDef)val).activationState = skillDefInfo.activationState; ((SkillDef)val).activationStateMachineName = skillDefInfo.activationStateMachineName; ((SkillDef)val).interruptPriority = skillDefInfo.interruptPriority; ((SkillDef)val).baseMaxStock = skillDefInfo.baseMaxStock; ((SkillDef)val).baseRechargeInterval = skillDefInfo.baseRechargeInterval; ((SkillDef)val).rechargeStock = skillDefInfo.rechargeStock; ((SkillDef)val).requiredStock = skillDefInfo.requiredStock; ((SkillDef)val).stockToConsume = skillDefInfo.stockToConsume; ((SkillDef)val).dontAllowPastMaxStocks = skillDefInfo.dontAllowPastMaxStocks; ((SkillDef)val).beginSkillCooldownOnSkillEnd = skillDefInfo.beginSkillCooldownOnSkillEnd; ((SkillDef)val).canceledFromSprinting = skillDefInfo.canceledFromSprinting; ((SkillDef)val).forceSprintDuringState = skillDefInfo.forceSprintDuringState; ((SkillDef)val).fullRestockOnAssign = skillDefInfo.fullRestockOnAssign; ((SkillDef)val).resetCooldownTimerOnUse = skillDefInfo.resetCooldownTimerOnUse; ((SkillDef)val).isCombatSkill = skillDefInfo.isCombatSkill; ((SkillDef)val).mustKeyPress = skillDefInfo.mustKeyPress; ((SkillDef)val).cancelSprintingOnActivation = skillDefInfo.cancelSprintingOnActivation; ((SkillDef)val).keywordTokens = skillDefInfo.keywordTokens; Content.AddSkillDef((SkillDef)(object)val); return val; } } internal class SkillDefInfo { public string skillName; public string skillNameToken; public string skillDescriptionToken; public string[] keywordTokens = Array.Empty(); public Sprite skillIcon; public SerializableEntityStateType activationState; public string activationStateMachineName; public InterruptPriority interruptPriority; public float baseRechargeInterval; public int baseMaxStock = 1; public int rechargeStock = 1; public int requiredStock = 1; public int stockToConsume = 1; public bool resetCooldownTimerOnUse = false; public bool fullRestockOnAssign = true; public bool dontAllowPastMaxStocks = false; public bool beginSkillCooldownOnSkillEnd = false; public bool mustKeyPress = false; public bool isCombatSkill = true; public bool canceledFromSprinting = false; public bool cancelSprintingOnActivation = true; public bool forceSprintDuringState = false; public SkillDefInfo() { } public SkillDefInfo(string skillName, string skillNameToken, string skillDescriptionToken, Sprite skillIcon, SerializableEntityStateType activationState, string activationStateMachineName = "Weapon", bool agile = false) { //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) this.skillName = skillName; this.skillNameToken = skillNameToken; this.skillDescriptionToken = skillDescriptionToken; this.skillIcon = skillIcon; this.activationState = activationState; this.activationStateMachineName = activationStateMachineName; cancelSprintingOnActivation = !agile; if (agile) { keywordTokens = new string[1] { "KEYWORD_AGILE" }; } interruptPriority = (InterruptPriority)0; isCombatSkill = true; baseRechargeInterval = 0f; requiredStock = 0; stockToConsume = 0; } } internal static class Skins { internal struct SkinDefInfo { internal SkinDef[] BaseSkins; internal Sprite Icon; internal string NameToken; internal UnlockableDef UnlockableDef; internal GameObject RootObject; internal RendererInfo[] RendererInfos; internal MeshReplacement[] MeshReplacements; internal GameObjectActivation[] GameObjectActivations; internal ProjectileGhostReplacement[] ProjectileGhostReplacements; internal MinionSkinReplacement[] MinionSkinReplacements; internal string Name; } internal static SkinDef CreateSkinDef(string skinName, Sprite skinIcon, RendererInfo[] defaultRendererInfos, GameObject root, UnlockableDef unlockableDef = null) { //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Expected O, but got Unknown //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Expected O, but got Unknown SkinDefInfo skinDefInfo = default(SkinDefInfo); skinDefInfo.BaseSkins = Array.Empty(); skinDefInfo.GameObjectActivations = (GameObjectActivation[])(object)new GameObjectActivation[0]; skinDefInfo.Icon = skinIcon; skinDefInfo.MeshReplacements = (MeshReplacement[])(object)new MeshReplacement[0]; skinDefInfo.MinionSkinReplacements = (MinionSkinReplacement[])(object)new MinionSkinReplacement[0]; skinDefInfo.Name = skinName; skinDefInfo.NameToken = skinName; skinDefInfo.ProjectileGhostReplacements = (ProjectileGhostReplacement[])(object)new ProjectileGhostReplacement[0]; skinDefInfo.RendererInfos = (RendererInfo[])(object)new RendererInfo[defaultRendererInfos.Length]; skinDefInfo.RootObject = root; skinDefInfo.UnlockableDef = unlockableDef; SkinDefInfo skinDefInfo2 = skinDefInfo; SkinDef.Awake += new hook_Awake(DoNothing); SkinDef val = ScriptableObject.CreateInstance(); val.baseSkins = skinDefInfo2.BaseSkins; val.icon = skinDefInfo2.Icon; val.unlockableDef = skinDefInfo2.UnlockableDef; val.rootObject = skinDefInfo2.RootObject; defaultRendererInfos.CopyTo(skinDefInfo2.RendererInfos, 0); val.rendererInfos = skinDefInfo2.RendererInfos; val.gameObjectActivations = skinDefInfo2.GameObjectActivations; val.meshReplacements = skinDefInfo2.MeshReplacements; val.projectileGhostReplacements = skinDefInfo2.ProjectileGhostReplacements; val.minionSkinReplacements = skinDefInfo2.MinionSkinReplacements; val.nameToken = skinDefInfo2.NameToken; ((Object)val).name = skinDefInfo2.Name; SkinDef.Awake -= new hook_Awake(DoNothing); return val; } private static void DoNothing(orig_Awake orig, SkinDef self) { } private static RendererInfo[] getRendererMaterials(RendererInfo[] defaultRenderers, params Material[] materials) { RendererInfo[] array = (RendererInfo[])(object)new RendererInfo[defaultRenderers.Length]; defaultRenderers.CopyTo(array, 0); for (int i = 0; i < array.Length; i++) { try { array[i].defaultMaterial = materials[i]; } catch { Log.Error("error adding skin rendererinfo material. make sure you're not passing in too many"); } } return array; } internal static MeshReplacement[] getMeshReplacements(AssetBundle assetBundle, RendererInfo[] defaultRendererInfos, params string[] meshes) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) List list = new List(); for (int i = 0; i < defaultRendererInfos.Length; i++) { if (!string.IsNullOrEmpty(meshes[i])) { list.Add(new MeshReplacement { renderer = defaultRendererInfos[i].renderer, mesh = assetBundle.LoadAsset(meshes[i]) }); } } return list.ToArray(); } } internal static class Tokens { public const string agilePrefix = "Agile."; public static string DamageText(string text) { return "" + text + ""; } public static string DamageValueText(float value) { return $"{value * 100f}% damage"; } public static string UtilityText(string text) { return "" + text + ""; } public static string RedText(string text) { return HealthText(text); } public static string HealthText(string text) { return "" + text + ""; } public static string KeywordText(string keyword, string sub) { return "" + keyword + "" + sub + ""; } public static string ScepterDescription(string desc) { return "\nSCEPTER: " + desc + ""; } public static string GetAchievementNameToken(string identifier) { return "ACHIEVEMENT_" + identifier.ToUpperInvariant() + "_NAME"; } public static string GetAchievementDescriptionToken(string identifier) { return "ACHIEVEMENT_" + identifier.ToUpperInvariant() + "_DESCRIPTION"; } } } namespace Soldier76Mod.Modules.Characters { public abstract class CharacterBase where T : CharacterBase, new() { public abstract string assetBundleName { get; } public abstract string bodyName { get; } public abstract string modelPrefabName { get; } public abstract BodyInfo bodyInfo { get; } public virtual CustomRendererInfo[] customRendererInfos { get; } public virtual ItemDisplaysBase itemDisplays { get; } public static T instance { get; private set; } public abstract AssetBundle assetBundle { get; protected set; } public abstract GameObject bodyPrefab { get; protected set; } public abstract CharacterBody prefabCharacterBody { get; protected set; } public abstract GameObject characterModelObject { get; protected set; } public abstract CharacterModel prefabCharacterModel { get; protected set; } public virtual void Initialize() { instance = this as T; assetBundle = Asset.LoadAssetBundle(assetBundleName); InitializeCharacter(); } public virtual void InitializeCharacter() { InitializeCharacterBodyPrefab(); InitializeItemDisplays(); } protected virtual void InitializeCharacterBodyPrefab() { characterModelObject = Prefabs.LoadCharacterModel(assetBundle, modelPrefabName); bodyPrefab = Prefabs.CreateBodyPrefab(characterModelObject, bodyInfo); prefabCharacterBody = bodyPrefab.GetComponent(); prefabCharacterModel = Prefabs.SetupCharacterModel(bodyPrefab, customRendererInfos); } public virtual void InitializeItemDisplays() { ItemDisplayRuleSet val = ScriptableObject.CreateInstance(); ((Object)val).name = "idrs" + bodyName; prefabCharacterModel.itemDisplayRuleSet = val; if (itemDisplays != null) { ItemDisplays.queuedDisplays++; ContentManager.onContentPacksAssigned += SetItemDisplays; } } public void SetItemDisplays(ReadOnlyArray obj) { itemDisplays.SetItemDisplays(prefabCharacterModel.itemDisplayRuleSet); } public abstract void InitializeEntityStateMachines(); public abstract void InitializeSkills(); public abstract void InitializeSkins(); public abstract void InitializeCharacterMaster(); } public class BodyInfo { public string bodyName = ""; public string bodyNameToken = ""; public string subtitleNameToken = ""; public string bodyNameToClone = "Commando"; public Color bodyColor = Color.white; public Texture characterPortrait = null; public float sortPosition = 100f; public GameObject crosshair = null; public GameObject podPrefab = null; public float maxHealth = 100f; public float healthRegen = 1f; public float armor = 0f; public float shield = 0f; public int jumpCount = 1; public float damage = 12f; public float attackSpeed = 1f; public float crit = 1f; public float moveSpeed = 7f; public float acceleration = 80f; public float jumpPower = 15f; public bool autoCalculateLevelStats = true; public float healthGrowth = 30.000002f; public float regenGrowth = 0.2f; public float armorGrowth = 0f; public float shieldGrowth = 0f; public float damageGrowth = 2.4f; public float attackSpeedGrowth = 0f; public float critGrowth = 0f; public float moveSpeedGrowth = 0f; public float jumpPowerGrowth = 0f; public Vector3 aimOriginPosition = new Vector3(0f, 1.6f, 0f); public Vector3 modelBasePosition = new Vector3(0f, -0.92f, 0f); public Vector3 cameraPivotPosition = new Vector3(0f, 0.8f, 0f); public float cameraParamsVerticalOffset = 1.37f; public float cameraParamsDepth = -10f; private CharacterCameraParams _cameraParams; public CharacterCameraParams cameraParams { get { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_cameraParams == (Object)null) { _cameraParams = ScriptableObject.CreateInstance(); _cameraParams.data.minPitch = BlendableFloat.op_Implicit(-70f); _cameraParams.data.maxPitch = BlendableFloat.op_Implicit(70f); _cameraParams.data.wallCushion = BlendableFloat.op_Implicit(0.1f); _cameraParams.data.pivotVerticalOffset = BlendableFloat.op_Implicit(cameraParamsVerticalOffset); _cameraParams.data.idealLocalCameraPos = BlendableVector3.op_Implicit(new Vector3(0f, 0f, cameraParamsDepth)); } return _cameraParams; } set { _cameraParams = value; } } } public abstract class ItemDisplaysBase { public void SetItemDisplays(ItemDisplayRuleSet itemDisplayRuleSet) { List list = new List(); ItemDisplays.LazyInit(); SetItemDisplayRules(list); itemDisplayRuleSet.keyAssetRuleGroups = list.ToArray(); ItemDisplays.DisposeWhenDone(); } protected abstract void SetItemDisplayRules(List itemDisplayRules); } public abstract class SurvivorBase : CharacterBase where T : SurvivorBase, new() { public abstract string masterName { get; } public abstract string displayPrefabName { get; } public abstract string survivorTokenPrefix { get; } public abstract UnlockableDef characterUnlockableDef { get; } public abstract GameObject displayPrefab { get; protected set; } public override void InitializeCharacter() { base.InitializeCharacter(); InitializeDisplayPrefab(); InitializeSurvivor(); } protected virtual void InitializeDisplayPrefab() { displayPrefab = Prefabs.CreateDisplayPrefab(assetBundle, displayPrefabName, bodyPrefab); } protected virtual void InitializeSurvivor() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) Content.CreateSurvivor(bodyPrefab, displayPrefab, bodyInfo.bodyColor, survivorTokenPrefix, characterUnlockableDef, bodyInfo.sortPosition); } protected virtual void AddCssPreviewSkill(int indexFromEditor, SkillFamily skillFamily, SkillDef skillDef) { CharacterSelectSurvivorPreviewDisplayController component = displayPrefab.GetComponent(); if (!Object.op_Implicit((Object)(object)component)) { Log.Error("trying to add skillChangeResponse to null CharacterSelectSurvivorPreviewDisplayController.\nMake sure you created one on your Display prefab in editor"); return; } component.skillChangeResponses[indexFromEditor].triggerSkillFamily = skillFamily; component.skillChangeResponses[indexFromEditor].triggerSkill = skillDef; } protected virtual void AddCssPreviewSkin(int indexFromEditor, SkinDef skinDef) { CharacterSelectSurvivorPreviewDisplayController component = displayPrefab.GetComponent(); if (!Object.op_Implicit((Object)(object)component)) { Log.Error("trying to add skinChangeResponse to null CharacterSelectSurvivorPreviewDisplayController.\nMake sure you created one on your Display prefab in editor"); } else { component.skinChangeResponses[indexFromEditor].triggerSkin = skinDef; } } protected virtual void FinalizeCSSPreviewDisplayController() { //IL_0073: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)displayPrefab)) { return; } CharacterSelectSurvivorPreviewDisplayController component = displayPrefab.GetComponent(); if (!Object.op_Implicit((Object)(object)component)) { return; } component.bodyPrefab = bodyPrefab; List list = new List(); for (int i = 0; i < component.skillChangeResponses.Length; i++) { if ((Object)(object)component.skillChangeResponses[i].triggerSkillFamily != (Object)null) { list.Add(component.skillChangeResponses[i]); } } component.skillChangeResponses = list.ToArray(); } } } namespace Soldier76Mod.Modules.BaseStates { public abstract class BaseMeleeAttack : BaseSkillState, IStepSetter { public int swingIndex; protected string hitboxGroupName = "SwordGroup"; protected DamageTypeCombo damageType = DamageTypeCombo.op_Implicit((DamageType)0); protected float damageCoefficient = 3.5f; protected float procCoefficient = 1f; protected float pushForce = 300f; protected Vector3 bonusForce = Vector3.zero; protected float baseDuration = 1f; protected float attackStartPercentTime = 0.2f; protected float attackEndPercentTime = 0.4f; protected float earlyExitPercentTime = 0.4f; protected float hitStopDuration = 0.012f; protected float attackRecoil = 0.75f; protected float hitHopVelocity = 4f; protected string swingSoundString = ""; protected string hitSoundString = ""; protected string muzzleString = "SwingCenter"; protected string playbackRateParam = "Slash.playbackRate"; protected GameObject swingEffectPrefab; protected GameObject hitEffectPrefab; protected NetworkSoundEventIndex impactSound = (NetworkSoundEventIndex)(-1); protected OverlapAttack attack; public float duration; private bool hasFired; private float hitPauseTimer; protected bool inHitPause; private bool hasHopped; protected float stopwatch; protected Animator animator; private HitStopCachedState hitStopCachedState; private Vector3 storedVelocity; public override void OnEnter() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0087: 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_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) ((BaseState)this).OnEnter(); duration = baseDuration / ((BaseState)this).attackSpeedStat; animator = ((EntityState)this).GetModelAnimator(); ((BaseState)this).StartAimMode(0.5f + duration, false); PlayAttackAnimation(); attack = new OverlapAttack(); attack.damageType = damageType; attack.attacker = ((EntityState)this).gameObject; attack.inflictor = ((EntityState)this).gameObject; attack.teamIndex = ((BaseState)this).GetTeam(); attack.damage = damageCoefficient * ((BaseState)this).damageStat; attack.procCoefficient = procCoefficient; attack.hitEffectPrefab = hitEffectPrefab; attack.forceVector = bonusForce; attack.pushAwayForce = pushForce; attack.hitBoxGroup = ((BaseState)this).FindHitBoxGroup(hitboxGroupName); attack.isCrit = ((BaseState)this).RollCrit(); attack.impactSound = impactSound; ModifyOverlapAttack(attack); } protected virtual void ModifyOverlapAttack(OverlapAttack attack) { } protected virtual void PlayAttackAnimation() { ((EntityState)this).PlayCrossfade("Gesture, Override", "Slash" + (1 + swingIndex), playbackRateParam, duration, 0.05f); } public override void OnExit() { if (inHitPause) { RemoveHitstop(); } ((EntityState)this).OnExit(); } protected virtual void PlaySwingEffect() { EffectManager.SimpleMuzzleFlash(swingEffectPrefab, ((EntityState)this).gameObject, muzzleString, false); } protected virtual void OnHitEnemyAuthority() { Util.PlaySound(hitSoundString, ((EntityState)this).gameObject); if (!hasHopped) { if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) && !((EntityState)this).characterMotor.isGrounded && hitHopVelocity > 0f) { ((BaseState)this).SmallHop(((EntityState)this).characterMotor, hitHopVelocity); } hasHopped = true; } ApplyHitstop(); } protected void ApplyHitstop() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) if (!inHitPause && hitStopDuration > 0f) { storedVelocity = ((EntityState)this).characterMotor.velocity; hitStopCachedState = ((BaseState)this).CreateHitStopCachedState(((EntityState)this).characterMotor, animator, playbackRateParam); hitPauseTimer = hitStopDuration / ((BaseState)this).attackSpeedStat; inHitPause = true; } } private void FireAttack() { if (((EntityState)this).isAuthority && attack.Fire((List)null)) { OnHitEnemyAuthority(); } } private void EnterAttack() { hasFired = true; Util.PlayAttackSpeedSound(swingSoundString, ((EntityState)this).gameObject, ((BaseState)this).attackSpeedStat); PlaySwingEffect(); if (((EntityState)this).isAuthority) { ((BaseState)this).AddRecoil(-1f * attackRecoil, -2f * attackRecoil, -0.5f * attackRecoil, 0.5f * attackRecoil); } } public override void FixedUpdate() { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) ((EntityState)this).FixedUpdate(); hitPauseTimer -= Time.deltaTime; if (hitPauseTimer <= 0f && inHitPause) { RemoveHitstop(); } if (!inHitPause) { stopwatch += Time.deltaTime; } else { if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor)) { ((EntityState)this).characterMotor.velocity = Vector3.zero; } if (Object.op_Implicit((Object)(object)animator)) { animator.SetFloat(playbackRateParam, 0f); } } bool flag = stopwatch >= duration * attackStartPercentTime; bool flag2 = stopwatch >= duration * attackEndPercentTime; if ((flag && !flag2) || (flag && flag2 && !hasFired)) { if (!hasFired) { EnterAttack(); } FireAttack(); } if (stopwatch >= duration && ((EntityState)this).isAuthority) { ((EntityState)this).outer.SetNextStateToMain(); } } private void RemoveHitstop() { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) ((BaseState)this).ConsumeHitStopCachedState(hitStopCachedState, ((EntityState)this).characterMotor, animator); inHitPause = false; ((EntityState)this).characterMotor.velocity = storedVelocity; } public override InterruptPriority GetMinimumInterruptPriority() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) if (stopwatch >= duration * earlyExitPercentTime) { return (InterruptPriority)0; } return (InterruptPriority)1; } public override void OnSerialize(NetworkWriter writer) { ((BaseSkillState)this).OnSerialize(writer); writer.Write(swingIndex); } public override void OnDeserialize(NetworkReader reader) { ((BaseSkillState)this).OnDeserialize(reader); swingIndex = reader.ReadInt32(); } public void SetStep(int i) { swingIndex = i; } } public abstract class BaseTimedSkillState : BaseSkillState { protected float duration; protected float castStartTime; protected float castEndTime; protected bool hasFired; protected bool isFiring; protected bool hasExited; public abstract float TimedBaseDuration { get; } public abstract float TimedBaseCastStartPercentTime { get; } public virtual float TimedBaseCastEndPercentTime => 1f; public override void OnEnter() { InitDurationValues(); ((BaseState)this).OnEnter(); } protected virtual void InitDurationValues() { duration = TimedBaseDuration / ((BaseState)this).attackSpeedStat; castStartTime = TimedBaseCastStartPercentTime * duration; castEndTime = TimedBaseCastEndPercentTime * duration; } protected virtual void OnCastEnter() { } protected virtual void OnCastFixedUpdate() { } protected virtual void OnCastUpdate() { } protected virtual void OnCastExit() { } public override void FixedUpdate() { ((EntityState)this).FixedUpdate(); bool flag = ((EntityState)this).fixedAge >= castStartTime; bool flag2 = ((EntityState)this).fixedAge >= castEndTime; isFiring = false; if ((flag && !flag2) || (flag && flag2 && !hasFired)) { isFiring = true; OnCastFixedUpdate(); if (!hasFired) { OnCastEnter(); hasFired = true; } } if (flag2 && !hasExited) { hasExited = true; OnCastExit(); } if (((EntityState)this).fixedAge > duration) { ((EntityState)this).outer.SetNextStateToMain(); } } public override void Update() { ((EntityState)this).Update(); if (isFiring) { OnCastUpdate(); } } } public class ExampleTimedSkillState : BaseTimedSkillState { public override float TimedBaseDuration => 1.5f; public override float TimedBaseCastStartPercentTime => 0.2f; public override float TimedBaseCastEndPercentTime => 0.9f; protected override void OnCastEnter() { } protected override void OnCastFixedUpdate() { } protected override void OnCastExit() { } } public class ExampleDelayedSkillState : BaseTimedSkillState { public override float TimedBaseDuration => 1.5f; public override float TimedBaseCastStartPercentTime => 0.2f; protected override void OnCastEnter() { } } } namespace Soldier76Mod.Modules.Achievements { public abstract class BaseMasteryAchievement : BaseAchievement { public abstract string RequiredCharacterBody { get; } public abstract float RequiredDifficultyCoefficient { get; } public override BodyIndex LookUpRequiredBodyIndex() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) return BodyCatalog.FindBodyIndex(RequiredCharacterBody); } public override void OnBodyRequirementMet() { ((BaseAchievement)this).OnBodyRequirementMet(); Run.onClientGameOverGlobal += OnClientGameOverGlobal; } public override void OnBodyRequirementBroken() { Run.onClientGameOverGlobal -= OnClientGameOverGlobal; ((BaseAchievement)this).OnBodyRequirementBroken(); } private void OnClientGameOverGlobal(Run run, RunReport runReport) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Invalid comparison between Unknown and I4 //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Invalid comparison between Unknown and I4 if (!Object.op_Implicit((Object)(object)runReport.gameEnding) || !runReport.gameEnding.isWin) { return; } DifficultyIndex val = runReport.ruleBook.FindDifficulty(); DifficultyDef difficultyDef = DifficultyCatalog.GetDifficultyDef(val); if (difficultyDef != null) { bool flag = difficultyDef.countsAsHardMode && difficultyDef.scalingValue >= RequiredDifficultyCoefficient; bool flag2 = difficultyDef.nameToken == "INFERNO_NAME"; bool flag3 = (int)val >= 3 && (int)val <= 10; if (flag || flag2 || flag3) { ((BaseAchievement)this).Grant(); } } } } } namespace Soldier76Mod.Components { public class GunAttachmentController : MonoBehaviour { private GameObject gunInstance; private void Awake() { //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Expected O, but got Unknown //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) AssetBundle assetBundle = Soldier76Assets._assetBundle; if ((Object)(object)assetBundle == (Object)null) { Log.Warning("GunAttachment: AssetBundle 为空"); return; } GameObject val = assetBundle.LoadAsset("76gun"); if ((Object)(object)val == (Object)null) { Log.Warning("GunAttachment: 找不到 76gun"); return; } Transform val2 = FindBoneRecursive(((Component)this).transform.root, "R_Hand"); if ((Object)(object)val2 == (Object)null) { Log.Warning("GunAttachment: 找不到右手骨骼 R_Hand"); LogBones(((Component)this).transform.root); return; } GameObject val3 = new GameObject("GunMount"); val3.transform.SetParent(val2, false); val3.transform.localPosition = new Vector3(-0.25f, 0f, 0f); val3.transform.localRotation = Quaternion.Euler(90f, 0f, 0f); gunInstance = Object.Instantiate(val, val3.transform); gunInstance.transform.localPosition = new Vector3(0.3f, 0.05f, -0.15f); gunInstance.transform.localRotation = Quaternion.identity; gunInstance.transform.localScale = new Vector3(0.3f, 0.3f, 0.3f); Log.Info("GunAttachment: 枪已挂载到 " + ((Object)val2).name); ((MonoBehaviour)this).Invoke("RegisterRenderers", 0.5f); } private void RegisterRenderers() { //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) CharacterModel componentInChildren = ((Component)this).GetComponentInChildren(); if ((Object)(object)componentInChildren == (Object)null || (Object)(object)gunInstance == (Object)null) { return; } Renderer[] componentsInChildren = gunInstance.GetComponentsInChildren(true); RendererInfo[] array = componentInChildren.baseRendererInfos; Renderer[] array2 = componentsInChildren; foreach (Renderer val in array2) { if (!((Object)(object)val == (Object)null)) { RendererInfo[] array3 = (RendererInfo[])(object)new RendererInfo[array.Length + 1]; for (int j = 0; j < array.Length; j++) { array3[j] = array[j]; } array3[array.Length] = new RendererInfo { renderer = val, defaultMaterial = val.sharedMaterial, defaultShadowCastingMode = (ShadowCastingMode)1, ignoreOverlays = false }; array = array3; } } componentInChildren.baseRendererInfos = array; Log.Info($"GunAttachment: 已注册 {componentsInChildren.Length} 个渲染器"); } private static Transform FindBoneRecursive(Transform parent, string keyword) { if (((Object)parent).name.Contains(keyword)) { return parent; } for (int i = 0; i < parent.childCount; i++) { Transform val = FindBoneRecursive(parent.GetChild(i), keyword); if ((Object)(object)val != (Object)null) { return val; } } return null; } private static void LogBones(Transform parent) { Log.Info(" Bone: " + ((Object)parent).name); for (int i = 0; i < parent.childCount; i++) { LogBones(parent.GetChild(i)); } } private void OnDestroy() { if (Object.op_Implicit((Object)(object)gunInstance)) { Object.Destroy((Object)(object)gunInstance); } } } public class Soldier76PassiveController : MonoBehaviour { private CharacterBody body; private float charge; private bool enhancedReady; private Outline skillBorder; private GameObject canvasObject; private Image ringBackground; private Image ringFill; private Text percentageText; private const float chargePerKill = 5f; private const float maxCharge = 100f; private void Awake() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown //IL_0090: 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_00be: 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_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Expected O, but got Unknown //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0192: 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_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Expected O, but got Unknown //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Expected O, but got Unknown //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_036c: Unknown result type (might be due to invalid IL or missing references) //IL_0379: Unknown result type (might be due to invalid IL or missing references) //IL_0386: 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) body = ((Component)this).GetComponent(); Sprite cachedRingFull = Soldier76Assets._cachedRingFull; Sprite cachedRingMiddle = Soldier76Assets._cachedRingMiddle; canvasObject = new GameObject("ChargeCanvas", new Type[1] { typeof(Canvas) }); Canvas component = canvasObject.GetComponent(); component.renderMode = (RenderMode)0; component.sortingOrder = 100; GameObject val = new GameObject("ChargeRing"); val.transform.SetParent(canvasObject.transform, false); RectTransform val2 = val.AddComponent(); val2.anchorMin = new Vector2(0.5f, 0f); val2.anchorMax = new Vector2(0.5f, 0f); val2.pivot = new Vector2(0.5f, 0.5f); val2.anchoredPosition = new Vector2(0f, 90f); val2.sizeDelta = new Vector2(100f, 100f); GameObject val3 = new GameObject("RingBG", new Type[1] { typeof(Image) }); val3.transform.SetParent(val.transform, false); ringBackground = val3.GetComponent(); ringBackground.sprite = cachedRingFull; ringBackground.type = (Type)0; ((Graphic)ringBackground).color = new Color(0.4f, 0.4f, 0.4f, 0.6f); ((Graphic)ringBackground).raycastTarget = false; RectTransform rectTransform = ((Graphic)ringBackground).rectTransform; rectTransform.anchorMin = Vector2.zero; rectTransform.anchorMax = Vector2.one; rectTransform.offsetMin = Vector2.zero; rectTransform.offsetMax = Vector2.zero; GameObject val4 = new GameObject("RingFill", new Type[1] { typeof(Image) }); val4.transform.SetParent(val.transform, false); ringFill = val4.GetComponent(); ringFill.sprite = cachedRingMiddle ?? cachedRingFull; ringFill.type = (Type)3; ringFill.fillMethod = (FillMethod)4; ringFill.fillOrigin = 2; ringFill.fillAmount = 0f; ((Graphic)ringFill).color = new Color(1f, 0.8f, 0f, 0.9f); ((Graphic)ringFill).raycastTarget = false; RectTransform rectTransform2 = ((Graphic)ringFill).rectTransform; rectTransform2.anchorMin = Vector2.zero; rectTransform2.anchorMax = Vector2.one; rectTransform2.offsetMin = Vector2.zero; rectTransform2.offsetMax = Vector2.zero; GameObject val5 = new GameObject("ChargeText", new Type[1] { typeof(Text) }); val5.transform.SetParent(val.transform, false); percentageText = val5.GetComponent(); percentageText.font = Resources.GetBuiltinResource("Arial.ttf"); percentageText.fontSize = 18; percentageText.fontStyle = (FontStyle)1; percentageText.alignment = (TextAnchor)4; ((Graphic)percentageText).color = Color.white; ((Graphic)percentageText).raycastTarget = false; RectTransform rectTransform3 = ((Graphic)percentageText).rectTransform; rectTransform3.anchorMin = Vector2.zero; rectTransform3.anchorMax = Vector2.one; rectTransform3.offsetMin = Vector2.zero; rectTransform3.offsetMax = Vector2.zero; canvasObject.SetActive(false); GlobalEventManager.onCharacterDeathGlobal += OnCharacterDeathGlobal; } private void OnCharacterDeathGlobal(DamageReport report) { if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)report.attackerBody) || !((Object)(object)report.attackerBody == (Object)(object)body)) { return; } charge = Mathf.Min(charge + 5f, 100f); if (charge >= 100f && !enhancedReady) { enhancedReady = true; ShowSkillBorder(show: true); if (Object.op_Implicit((Object)(object)body)) { Soldier76Plugin.PlayVoice(((Component)body).gameObject, "Play_skill0_ready"); } } } public bool TryConsumeCharge() { if (enhancedReady) { charge = 0f; enhancedReady = false; ShowSkillBorder(show: false); return true; } return false; } private void ShowSkillBorder(bool show) { //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Invalid comparison between Unknown and I4 //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) if (show && (Object)(object)skillBorder == (Object)null) { HUD val = ((HUD.instancesList.Count > 0) ? HUD.instancesList[0] : null); if ((Object)(object)val?.mainContainer == (Object)null) { return; } SkillIcon[] componentsInChildren = val.mainContainer.GetComponentsInChildren(); SkillIcon[] array = componentsInChildren; foreach (SkillIcon val2 in array) { if ((int)val2.targetSkillSlot == 3) { skillBorder = ((Component)val2).GetComponent() ?? ((Component)val2).gameObject.AddComponent(); ((Shadow)skillBorder).effectColor = Color.yellow; ((Shadow)skillBorder).effectDistance = new Vector2(4f, 4f); ((Behaviour)skillBorder).enabled = true; break; } } } else if (!show && Object.op_Implicit((Object)(object)skillBorder)) { Object.Destroy((Object)(object)skillBorder); skillBorder = null; } } private void Update() { //IL_00dc: 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_0124: 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) if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)canvasObject)) { bool flag = Object.op_Implicit((Object)(object)body.healthComponent) && body.healthComponent.alive; bool flag2 = charge > 0f; canvasObject.SetActive(flag && flag2); if (flag && flag2) { ringFill.fillAmount = charge / 100f; percentageText.text = (enhancedReady ? "READY" : $"{(int)charge}%"); ((Graphic)percentageText).color = (enhancedReady ? Color.yellow : Color.white); ((Graphic)ringFill).color = (enhancedReady ? new Color(1f, 0.8f, 0f, 1f) : new Color(1f, 0.8f, 0f, 0.9f)); } } } private void OnDestroy() { GlobalEventManager.onCharacterDeathGlobal -= OnCharacterDeathGlobal; if (Object.op_Implicit((Object)(object)skillBorder)) { Object.Destroy((Object)(object)skillBorder); } if (Object.op_Implicit((Object)(object)canvasObject)) { Object.Destroy((Object)(object)canvasObject); } } } } namespace Soldier76Mod.Survivors.Soldier76 { public static class Soldier76AI { public static void Init(GameObject bodyPrefab, string masterName) { //IL_003a: 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_00c9: 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_00f7: 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_0150: 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_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: 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_0209: 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_0225: 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_0289: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_0329: Unknown result type (might be due to invalid IL or missing references) //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) GameObject val = Prefabs.CreateBlankMasterPrefab(bodyPrefab, masterName); BaseAI component = val.GetComponent(); component.aimVectorDampTime = 0.1f; component.aimVectorMaxSpeed = 360f; AISkillDriver val2 = val.AddComponent(); val2.customName = "Use Primary Rifle"; val2.skillSlot = (SkillSlot)0; val2.requireSkillReady = false; val2.requireEquipmentReady = false; val2.minUserHealthFraction = float.NegativeInfinity; val2.maxUserHealthFraction = float.PositiveInfinity; val2.minTargetHealthFraction = float.NegativeInfinity; val2.maxTargetHealthFraction = float.PositiveInfinity; val2.minDistance = 0f; val2.maxDistance = 40f; val2.selectionRequiresTargetLoS = false; val2.selectionRequiresOnGround = false; val2.selectionRequiresAimTarget = false; val2.maxTimesSelected = -1; val2.moveTargetType = (TargetType)0; val2.activationRequiresTargetLoS = false; val2.activationRequiresAimTargetLoS = false; val2.activationRequiresAimConfirmation = false; val2.movementType = (MovementType)1; val2.moveInputScale = 1f; val2.aimType = (AimType)1; val2.ignoreNodeGraph = false; val2.shouldSprint = true; val2.shouldFireEquipment = false; val2.buttonPressType = (ButtonPressType)0; AISkillDriver val3 = val.AddComponent(); val3.customName = "Use Helix Rockets"; val3.skillSlot = (SkillSlot)1; val3.requireSkillReady = true; val3.minDistance = 0f; val3.maxDistance = 30f; val3.selectionRequiresTargetLoS = false; val3.selectionRequiresOnGround = false; val3.selectionRequiresAimTarget = false; val3.maxTimesSelected = -1; val3.moveTargetType = (TargetType)0; val3.activationRequiresTargetLoS = false; val3.activationRequiresAimTargetLoS = false; val3.activationRequiresAimConfirmation = true; val3.movementType = (MovementType)1; val3.moveInputScale = 1f; val3.aimType = (AimType)1; val3.buttonPressType = (ButtonPressType)0; AISkillDriver val4 = val.AddComponent(); val4.customName = "Use Sprint"; val4.skillSlot = (SkillSlot)2; val4.requireSkillReady = false; val4.minDistance = 12f; val4.maxDistance = float.PositiveInfinity; val4.selectionRequiresTargetLoS = false; val4.selectionRequiresOnGround = false; val4.selectionRequiresAimTarget = false; val4.maxTimesSelected = -1; val4.moveTargetType = (TargetType)0; val4.activationRequiresTargetLoS = false; val4.activationRequiresAimTargetLoS = false; val4.activationRequiresAimConfirmation = false; val4.movementType = (MovementType)1; val4.moveInputScale = 1f; val4.aimType = (AimType)1; val4.buttonPressType = (ButtonPressType)0; AISkillDriver val5 = val.AddComponent(); val5.customName = "Use Tactical Visor"; val5.skillSlot = (SkillSlot)3; val5.requireSkillReady = true; val5.minDistance = 0f; val5.maxDistance = 25f; val5.selectionRequiresTargetLoS = true; val5.selectionRequiresOnGround = false; val5.selectionRequiresAimTarget = false; val5.maxTimesSelected = -1; val5.moveTargetType = (TargetType)0; val5.activationRequiresTargetLoS = false; val5.activationRequiresAimTargetLoS = false; val5.activationRequiresAimConfirmation = false; val5.movementType = (MovementType)1; val5.moveInputScale = 1f; val5.aimType = (AimType)1; val5.buttonPressType = (ButtonPressType)0; AISkillDriver val6 = val.AddComponent(); val6.customName = "Chase"; val6.skillSlot = (SkillSlot)(-1); val6.requireSkillReady = false; val6.minDistance = 0f; val6.maxDistance = float.PositiveInfinity; val6.moveTargetType = (TargetType)0; val6.activationRequiresTargetLoS = false; val6.activationRequiresAimTargetLoS = false; val6.activationRequiresAimConfirmation = false; val6.movementType = (MovementType)1; val6.moveInputScale = 1f; val6.aimType = (AimType)1; val6.buttonPressType = (ButtonPressType)0; } } public static class Soldier76Assets { public static GameObject helixRocketPrefab; public static Texture2D _cachedVisorTexture; public static Sprite _cachedRingFull; public static Sprite _cachedRingMiddle; public static AssetBundle _assetBundle { get; private set; } public static void Init(AssetBundle assetBundle) { _assetBundle = assetBundle; CreateProjectiles(); PreloadTextures(); } private static void PreloadTextures() { //IL_0082: 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_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Expected O, but got Unknown //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_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) Texture2D val = _assetBundle.LoadAsset("zhanshumujing"); if (Object.op_Implicit((Object)(object)val)) { _cachedVisorTexture = Soldier76Plugin.DecompressTexture(val); ((Texture)_cachedVisorTexture).filterMode = (FilterMode)1; ((Texture)_cachedVisorTexture).wrapMode = (TextureWrapMode)1; } Texture2D val2 = _assetBundle.LoadAsset("texChargeRing"); if (!Object.op_Implicit((Object)(object)val2)) { return; } Texture2D val3 = Soldier76Plugin.DecompressTexture(val2); _cachedRingFull = Sprite.Create(val3, new Rect(0f, 0f, (float)((Texture)val3).width, (float)((Texture)val3).height), new Vector2(0.5f, 0.5f), 100f); Texture2D val4 = new Texture2D(((Texture)val3).width, ((Texture)val3).height, (TextureFormat)4, false); int width = ((Texture)val3).width; int height = ((Texture)val3).height; int num = width / 2; int num2 = height / 2; float num3 = Mathf.Min(num, num2); Color clear = Color.clear; for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) { float num4 = Mathf.Sqrt((float)((j - num) * (j - num) + (i - num2) * (i - num2))); float num5 = num4 / num3; if (num5 >= 0.35f && num5 <= 0.7f) { val4.SetPixel(j, i, val3.GetPixel(j, i)); } else { val4.SetPixel(j, i, clear); } } } val4.Apply(); _cachedRingMiddle = Sprite.Create(val4, new Rect(0f, 0f, (float)((Texture)val4).width, (float)((Texture)val4).height), new Vector2(0.5f, 0.5f), 100f); } private static void CreateProjectiles() { CreateHelixRocketPrefab(); Content.AddProjectilePrefab(helixRocketPrefab); } private static void CreateHelixRocketPrefab() { //IL_0087: Unknown result type (might be due to invalid IL or missing references) helixRocketPrefab = Asset.CloneProjectilePrefab("CommandoGrenadeProjectile", "Soldier76HelixRocket"); Rigidbody component = helixRocketPrefab.GetComponent(); if (Object.op_Implicit((Object)(object)component)) { component.useGravity = false; } ProjectileSimple component2 = helixRocketPrefab.GetComponent(); if (Object.op_Implicit((Object)(object)component2)) { component2.desiredForwardSpeed = 80f; component2.velocity = 0f; } ProjectileImpactExplosion component3 = helixRocketPrefab.GetComponent(); ((ProjectileExplosion)component3).blastRadius = 8f; ((ProjectileExplosion)component3).blastDamageCoefficient = 1f; ((ProjectileExplosion)component3).falloffModel = (FalloffModel)0; component3.destroyOnEnemy = true; component3.destroyOnWorld = true; component3.lifetime = 6f; component3.timerAfterImpact = true; component3.lifetimeAfterImpact = 0.05f; ProjectileController component4 = helixRocketPrefab.GetComponent(); if ((Object)(object)_assetBundle.LoadAsset("HelixRocketGhost") != (Object)null) { component4.ghostPrefab = _assetBundle.CreateProjectileGhostPrefab("HelixRocketGhost"); } component4.startSound = ""; ProjectileSteerTowardTarget val = helixRocketPrefab.AddComponent(); HelixRocketJumpComponent helixRocketJumpComponent = helixRocketPrefab.AddComponent(); helixRocketJumpComponent.blastRadius = ((ProjectileExplosion)component3).blastRadius; helixRocketJumpComponent.jumpForce = 30f; } } public static class Soldier76Buffs { public static BuffDef sprintBuff; public static BuffDef tacticalVisorBuff; public static BuffDef enhancedVisorBuff; public static void Init(AssetBundle assetBundle) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0058: 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) sprintBuff = Content.CreateAndAddBuff("S76SprintBuff", LegacyResourcesAPI.Load("BuffDefs/HiddenInvincibility").iconSprite, new Color(0.3f, 0.6f, 0.9f), canStack: false, isDebuff: false); tacticalVisorBuff = Content.CreateAndAddBuff("S76TacticalVisorBuff", LegacyResourcesAPI.Load("BuffDefs/HiddenInvincibility").iconSprite, new Color(1f, 0.5f, 0f), canStack: false, isDebuff: false); enhancedVisorBuff = Content.CreateAndAddBuff("S76EnhancedVisorBuff", LegacyResourcesAPI.Load("BuffDefs/HiddenInvincibility").iconSprite, new Color(1f, 0.2f, 0.2f), canStack: false, isDebuff: false); } } public static class Soldier76Config { public static ConfigEntry someConfigBool; public static ConfigEntry someConfigFloat; public static ConfigEntry someConfigFloatWithCustomRange; public static void Init() { string section = "Soldier76"; someConfigBool = Config.BindAndOptions(section, "someConfigBool", defaultValue: true, "this creates a bool config, and a checkbox option in risk of options"); someConfigFloat = Config.BindAndOptions(section, "someConfigfloat", 5f); someConfigFloatWithCustomRange = Config.BindAndOptions(section, "someConfigfloat2", 5f, 0f, 50f, "if a custom range is not passed in, a float will default to a slider with range 0-20. risk of options only has sliders"); } } public class Soldier76ItemDisplays : ItemDisplaysBase { protected override void SetItemDisplayRules(List itemDisplayRules) { } } public static class Soldier76States { public static void Init() { Content.AddEntityState(typeof(FirePulseRifle)); Content.AddEntityState(typeof(FireHelixRockets)); Content.AddEntityState(typeof(Sprint)); Content.AddEntityState(typeof(TacticalVisor)); } } public static class Soldier76StaticValues { public const float rifleDamageCoefficient = 0.5f; public const float helixDamageCoefficient = 2f; } public static class Soldier76Tokens { public static void Init() { AddSoldier76Tokens(); } public static void AddSoldier76Tokens() { string text = "S76_S76_"; string text2 = "士兵76是一名均衡可靠的战术突击角色,正面交火和持续作战都游刃有余。" + Environment.NewLine + Environment.NewLine + "< ! > 重型脉冲步枪持续射击,高效触发物品效果。" + Environment.NewLine + Environment.NewLine + "< ! > 螺旋飞弹发射一枚爆炸飞弹,造成范围伤害。" + Environment.NewLine + Environment.NewLine + "< ! > 肾上腺素大幅提升战斗属性,但会消耗生命值并暂时无法治疗。" + Environment.NewLine + Environment.NewLine + "< ! > 战术目镜锁定敌人,子弹自动追踪。击杀充能可解锁强化目镜。" + Environment.NewLine + Environment.NewLine; string text3 = "……于是他离开了,带着未竟的使命,继续追查着真相。"; string text4 = "……于是他就这样消逝了,成为了这场无尽战争里又一个无名的亡魂。"; Language.Add(text + "NAME", "士兵76"); Language.Add(text + "DESCRIPTION", text2); Language.Add(text + "SUBTITLE", "独行老兵"); Language.Add(text + "LORE", "一名追寻真相的老兵。"); Language.Add(text + "OUTRO_FLAVOR", text3); Language.Add(text + "OUTRO_FAILURE", text4); Language.Add(text + "MASTERY_SKIN_NAME", "Alternate"); Language.Add(text + "PRIMARY_RIFLE_NAME", "重型脉冲步枪"); Language.Add(text + "PRIMARY_RIFLE_DESCRIPTION", "向前方持续射击脉冲子弹,每发子弹造成 50% 的伤害。"); Language.Add(text + "SECONDARY_HELIX_NAME", "螺旋飞弹"); Language.Add(text + "SECONDARY_HELIX_DESCRIPTION", $"发射一枚爆炸飞弹,造成 {200f}% 范围伤害。冷却10秒,可充能2次。"); Language.Add(text + "UTILITY_SPRINT_NAME", "肾上腺素"); Language.Add(text + "UTILITY_SPRINT_DESCRIPTION", "注射肾上腺素,持续 10秒:+50% 移速、+300 护甲、+100% 攻击速度。获得 15% 最大生命值的护盾。消耗 20% 最大生命值,期间 无法治疗。冷却20秒。"); Language.Add(text + "SPECIAL_VISOR_NAME", "战术目镜"); Language.Add(text + "SPECIAL_VISOR_DESCRIPTION", "启动战术目镜,持续 10秒:+50% 攻击速度,主武器子弹 自动追踪 准星附近的敌人。冷却30秒。\n强化模式: 充能满时启动,额外获得 +50% 暴击率 和 +100% 暴击伤害。"); Language.Add(text + "PASSIVE_NAME", "战术充能"); Language.Add(text + "PASSIVE_DESCRIPTION", "击杀敌人累积 充能(击杀+5%)。充能达 100% 时,下次战术目镜自动进入 强化模式。"); Language.Add(Tokens.GetAchievementNameToken("S76_S76_masteryAchievement"), "士兵76:精通"); Language.Add(Tokens.GetAchievementDescriptionToken("S76_S76_masteryAchievement"), "使用士兵76在季风难度下通关或 obliterate。"); } } public static class Soldier76Unlockables { public static UnlockableDef characterUnlockableDef; public static UnlockableDef masterySkinUnlockableDef; public static void Init() { masterySkinUnlockableDef = Content.CreateAndAddUnlockbleDef("S76_S76_masteryUnlockable", Tokens.GetAchievementNameToken("S76_S76_masteryAchievement"), CharacterBase.instance.assetBundle.LoadAsset("texMasteryAchievement")); } } public class Soldier76Survivor : SurvivorBase { public const string S76_PREFIX = "S76_S76_"; public override string assetBundleName => "soldier76bundle"; public override string bodyName => "Soldier76Body"; public override string masterName => "Soldier76MonsterMaster"; public override string modelPrefabName => "mdlSoldier76"; public override string displayPrefabName => "mdlSoldier76DisplayMenu"; public override string survivorTokenPrefix => "S76_S76_"; public override BodyInfo bodyInfo => new BodyInfo { bodyName = bodyName, bodyNameToken = "S76_S76_NAME", subtitleNameToken = "S76_S76_SUBTITLE", characterPortrait = (Texture)(object)Soldier76Plugin.LoadTextureFromAssetBundle(assetBundle, "texPlayerIcon"), bodyColor = new Color(0.3f, 0.55f, 0.85f), sortPosition = 100f, crosshair = Asset.LoadCrosshair("Standard"), podPrefab = LegacyResourcesAPI.Load("Prefabs/NetworkedObjects/SurvivorPod"), maxHealth = 110f, healthRegen = 1.5f, armor = 0f, damage = 12f, moveSpeed = 7f, jumpCount = 1, autoCalculateLevelStats = true }; public override CustomRendererInfo[] customRendererInfos => new CustomRendererInfo[0]; public override UnlockableDef characterUnlockableDef => Soldier76Unlockables.characterUnlockableDef; public override ItemDisplaysBase itemDisplays => new Soldier76ItemDisplays(); public override AssetBundle assetBundle { get; protected set; } public override GameObject bodyPrefab { get; protected set; } public override CharacterBody prefabCharacterBody { get; protected set; } public override GameObject characterModelObject { get; protected set; } public override CharacterModel prefabCharacterModel { get; protected set; } public override GameObject displayPrefab { get; protected set; } public override void Initialize() { base.Initialize(); } public override void InitializeCharacter() { Soldier76Unlockables.Init(); base.InitializeCharacter(); Soldier76Config.Init(); Soldier76States.Init(); Soldier76Tokens.Init(); Soldier76Assets.Init(assetBundle); Soldier76Buffs.Init(assetBundle); InitializeEntityStateMachines(); InitializeSkills(); InitializeSkins(); InitializeCharacterMaster(); AdditionalBodySetup(); AddHooks(); } private void AdditionalBodySetup() { bodyPrefab.AddComponent(); bodyPrefab.AddComponent(); bodyPrefab.AddComponent(); } public override void InitializeEntityStateMachines() { Prefabs.ClearEntityStateMachines(bodyPrefab); Prefabs.AddMainEntityStateMachine(bodyPrefab, "Body", typeof(GenericCharacterMain), typeof(SpawnTeleporterState)); Prefabs.AddEntityStateMachine(bodyPrefab, "Weapon"); Prefabs.AddEntityStateMachine(bodyPrefab, "Weapon2"); } public override void InitializeSkills() { Skills.ClearGenericSkills(bodyPrefab); AddPassiveSkill(); AddPrimarySkills(); AddSecondarySkills(); AddUtilitySkills(); AddSpecialSkills(); } private void AddPassiveSkill() { //IL_000e: 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_0058: Unknown result type (might be due to invalid IL or missing references) bodyPrefab.GetComponent().passiveSkill = new PassiveSkill { enabled = true, skillNameToken = "S76_S76_PASSIVE_NAME", skillDescriptionToken = "S76_S76_PASSIVE_DESCRIPTION", keywordToken = "", icon = Soldier76Plugin.LoadSpriteFromAssetBundle(assetBundle, "texPassiveIcon") }; } private void AddPrimarySkills() { //IL_006b: 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_0082: Unknown result type (might be due to invalid IL or missing references) Skills.CreateGenericSkillWithSkillFamily(bodyPrefab, (SkillSlot)0); SkillDefInfo skillDefInfo = new SkillDefInfo(); skillDefInfo.skillName = "Soldier76PulseRifle"; skillDefInfo.skillNameToken = "S76_S76_PRIMARY_RIFLE_NAME"; skillDefInfo.skillDescriptionToken = "S76_S76_PRIMARY_RIFLE_DESCRIPTION"; skillDefInfo.keywordTokens = new string[1] { "KEYWORD_AGILE" }; skillDefInfo.skillIcon = Soldier76Plugin.LoadSpriteFromAssetBundle(assetBundle, "texPrimaryIcon"); skillDefInfo.activationState = new SerializableEntityStateType(typeof(FirePulseRifle)); skillDefInfo.activationStateMachineName = "Weapon"; skillDefInfo.interruptPriority = (InterruptPriority)0; skillDefInfo.baseMaxStock = 1; skillDefInfo.baseRechargeInterval = 0f; skillDefInfo.requiredStock = 0; skillDefInfo.stockToConsume = 0; skillDefInfo.fullRestockOnAssign = true; skillDefInfo.dontAllowPastMaxStocks = false; skillDefInfo.mustKeyPress = true; skillDefInfo.beginSkillCooldownOnSkillEnd = false; skillDefInfo.isCombatSkill = true; skillDefInfo.canceledFromSprinting = false; skillDefInfo.cancelSprintingOnActivation = false; skillDefInfo.forceSprintDuringState = false; SkillDef val = Skills.CreateSkillDef(skillDefInfo); Skills.AddPrimarySkills(bodyPrefab, val); } private void AddSecondarySkills() { //IL_0057: 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_006e: Unknown result type (might be due to invalid IL or missing references) Skills.CreateGenericSkillWithSkillFamily(bodyPrefab, (SkillSlot)1); SkillDefInfo skillDefInfo = new SkillDefInfo(); skillDefInfo.skillName = "Soldier76HelixRockets"; skillDefInfo.skillNameToken = "S76_S76_SECONDARY_HELIX_NAME"; skillDefInfo.skillDescriptionToken = "S76_S76_SECONDARY_HELIX_DESCRIPTION"; skillDefInfo.skillIcon = Soldier76Plugin.LoadSpriteFromAssetBundle(assetBundle, "texSecondaryIcon"); skillDefInfo.activationState = new SerializableEntityStateType(typeof(FireHelixRockets)); skillDefInfo.activationStateMachineName = "Weapon2"; skillDefInfo.interruptPriority = (InterruptPriority)1; skillDefInfo.baseRechargeInterval = 10f; skillDefInfo.baseMaxStock = 2; skillDefInfo.rechargeStock = 1; skillDefInfo.requiredStock = 1; skillDefInfo.stockToConsume = 1; skillDefInfo.resetCooldownTimerOnUse = false; skillDefInfo.fullRestockOnAssign = true; skillDefInfo.dontAllowPastMaxStocks = false; skillDefInfo.mustKeyPress = true; skillDefInfo.beginSkillCooldownOnSkillEnd = true; skillDefInfo.isCombatSkill = true; skillDefInfo.canceledFromSprinting = false; skillDefInfo.cancelSprintingOnActivation = false; skillDefInfo.forceSprintDuringState = false; SkillDef val = Skills.CreateSkillDef(skillDefInfo); Skills.AddSecondarySkills(bodyPrefab, val); } private void AddUtilitySkills() { //IL_0057: 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_006e: Unknown result type (might be due to invalid IL or missing references) Skills.CreateGenericSkillWithSkillFamily(bodyPrefab, (SkillSlot)2); SkillDefInfo skillDefInfo = new SkillDefInfo(); skillDefInfo.skillName = "Soldier76Adrenaline"; skillDefInfo.skillNameToken = "S76_S76_UTILITY_SPRINT_NAME"; skillDefInfo.skillDescriptionToken = "S76_S76_UTILITY_SPRINT_DESCRIPTION"; skillDefInfo.skillIcon = Soldier76Plugin.LoadSpriteFromAssetBundle(assetBundle, "texUtilityIcon"); skillDefInfo.activationState = new SerializableEntityStateType(typeof(Sprint)); skillDefInfo.activationStateMachineName = "Weapon"; skillDefInfo.interruptPriority = (InterruptPriority)2; skillDefInfo.baseRechargeInterval = 20f; skillDefInfo.baseMaxStock = 1; skillDefInfo.rechargeStock = 1; skillDefInfo.requiredStock = 1; skillDefInfo.stockToConsume = 1; skillDefInfo.resetCooldownTimerOnUse = false; skillDefInfo.fullRestockOnAssign = true; skillDefInfo.dontAllowPastMaxStocks = false; skillDefInfo.mustKeyPress = true; skillDefInfo.beginSkillCooldownOnSkillEnd = true; skillDefInfo.isCombatSkill = false; skillDefInfo.canceledFromSprinting = false; skillDefInfo.cancelSprintingOnActivation = false; skillDefInfo.forceSprintDuringState = false; SkillDef val = Skills.CreateSkillDef(skillDefInfo); Skills.AddUtilitySkills(bodyPrefab, val); } private void AddSpecialSkills() { //IL_0057: 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_006e: Unknown result type (might be due to invalid IL or missing references) Skills.CreateGenericSkillWithSkillFamily(bodyPrefab, (SkillSlot)3); SkillDefInfo skillDefInfo = new SkillDefInfo(); skillDefInfo.skillName = "Soldier76TacticalVisor"; skillDefInfo.skillNameToken = "S76_S76_SPECIAL_VISOR_NAME"; skillDefInfo.skillDescriptionToken = "S76_S76_SPECIAL_VISOR_DESCRIPTION"; skillDefInfo.skillIcon = Soldier76Plugin.LoadSpriteFromAssetBundle(assetBundle, "texSpecialIcon"); skillDefInfo.activationState = new SerializableEntityStateType(typeof(TacticalVisor)); skillDefInfo.activationStateMachineName = "Weapon"; skillDefInfo.interruptPriority = (InterruptPriority)1; skillDefInfo.baseMaxStock = 1; skillDefInfo.baseRechargeInterval = 30f; skillDefInfo.rechargeStock = 1; skillDefInfo.requiredStock = 1; skillDefInfo.stockToConsume = 1; skillDefInfo.resetCooldownTimerOnUse = false; skillDefInfo.fullRestockOnAssign = true; skillDefInfo.dontAllowPastMaxStocks = false; skillDefInfo.mustKeyPress = false; skillDefInfo.beginSkillCooldownOnSkillEnd = true; skillDefInfo.isCombatSkill = true; skillDefInfo.canceledFromSprinting = false; skillDefInfo.cancelSprintingOnActivation = false; skillDefInfo.forceSprintDuringState = false; SkillDef val = Skills.CreateSkillDef(skillDefInfo); Skills.AddSpecialSkills(bodyPrefab, val); } public override void InitializeSkins() { ModelSkinController val = ((Component)prefabCharacterModel).gameObject.AddComponent(); ChildLocator component = ((Component)prefabCharacterModel).GetComponent(); RendererInfo[] baseRendererInfos = prefabCharacterModel.baseRendererInfos; List list = new List(); SkinDef item = Skins.CreateSkinDef("DEFAULT_SKIN", Soldier76Plugin.LoadSpriteFromAssetBundle(assetBundle, "texMainSkin"), baseRendererInfos, ((Component)prefabCharacterModel).gameObject); list.Add(item); val.skins = list.ToArray(); } public override void InitializeCharacterMaster() { Soldier76AI.Init(bodyPrefab, masterName); } private void AddHooks() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPI_GetStatCoefficients); HealthComponent.Heal += new hook_Heal(HealthComponent_Heal); ProjectileController.OnDestroy += new hook_OnDestroy(ProjectileController_OnDestroy); HealthComponent.TakeDamage += new hook_TakeDamage(HealthComponent_TakeDamage); } private void ProjectileController_OnDestroy(orig_OnDestroy orig, ProjectileController self) { //IL_0071: 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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: 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_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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_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_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); if ((Object)(object)self == (Object)null || (Object)(object)self.owner == (Object)null || !((Object)((Component)self).gameObject).name.Contains("Soldier76HelixRocket")) { return; } CharacterMotor component = self.owner.GetComponent(); if (!((Object)(object)component == (Object)null)) { float num = Vector3.Distance(((Component)self).transform.position, self.owner.transform.position); if (!(num > 8f)) { Vector3 val = self.owner.transform.position - ((Component)self).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; normalized.y = Mathf.Max(Mathf.Abs(normalized.y), 0.3f); component.velocity = normalized * 20f; component.ApplyForce(normalized * 20f, true, false); Transform transform = self.owner.transform; transform.position += normalized * 5f; } } } private void HealthComponent_TakeDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo) { if (damageInfo.crit && Object.op_Implicit((Object)(object)damageInfo.attacker)) { CharacterBody component = damageInfo.attacker.GetComponent(); if (Object.op_Implicit((Object)(object)component) && component.HasBuff(Soldier76Buffs.enhancedVisorBuff)) { damageInfo.damage *= 2f; } } orig.Invoke(self, damageInfo); } private float HealthComponent_Heal(orig_Heal orig, HealthComponent self, float amount, ProcChainMask procChainMask, bool nonRegen) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)self.body) && self.body.HasBuff(Soldier76Buffs.sprintBuff)) { return 0f; } return orig.Invoke(self, amount, procChainMask, nonRegen); } private void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args) { if (sender.HasBuff(Soldier76Buffs.sprintBuff)) { args.moveSpeedMultAdd += 0.5f; args.armorAdd += 300f; args.attackSpeedMultAdd += 1f; args.baseRegenAdd = 0f - sender.baseRegen; } if (sender.HasBuff(Soldier76Buffs.tacticalVisorBuff)) { args.attackSpeedMultAdd += 0.5f; } if (sender.HasBuff(Soldier76Buffs.enhancedVisorBuff)) { args.critAdd += 50f; } } private Transform FindBoneRecursive(Transform parent, string keyword) { if (((Object)parent).name.ToLower().Contains(keyword.ToLower())) { return parent; } for (int i = 0; i < parent.childCount; i++) { Transform val = FindBoneRecursive(parent.GetChild(i), keyword); if ((Object)(object)val != (Object)null) { return val; } } return null; } private void LogBoneNames(Transform parent, string indent) { Log.Info(indent + ((Object)parent).name); for (int i = 0; i < parent.childCount; i++) { LogBoneNames(parent.GetChild(i), indent + " "); } } } } namespace Soldier76Mod.Survivors.Soldier76.SkillStates { public class FireHelixRockets : BaseSkillState { public static float damageCoefficient = 2f; public static float baseDuration = 0.5f; public static float force = 50f; private float duration; private bool hasFired; public override void OnEnter() { ((BaseState)this).OnEnter(); duration = baseDuration / ((BaseState)this).attackSpeedStat; ((EntityState)this).characterBody.SetAimTimer(2f); ((EntityState)this).PlayAnimation("Gesture, Additive", "ThrowBomb", "ThrowBomb.playbackRate", duration, 0f); Soldier76Plugin.PlayVoiceWithVolume(((EntityState)this).gameObject, "Play_skill2_rocketsound", 0.15f); } public override void FixedUpdate() { ((EntityState)this).FixedUpdate(); if (!hasFired) { FireRocket(); } if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority) { ((EntityState)this).outer.SetNextStateToMain(); } } private void FireRocket() { //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) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_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_0070: Expected O, but got Unknown //IL_0098: 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_00bc: 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_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) hasFired = true; Ray aimRay = ((BaseState)this).GetAimRay(); GameObject target = null; BullseyeSearch val = new BullseyeSearch { teamMaskFilter = TeamMask.GetEnemyTeams(((EntityState)this).characterBody.teamComponent.teamIndex), sortMode = (SortMode)1, filterByLoS = false, searchOrigin = ((Ray)(ref aimRay)).origin, searchDirection = ((Ray)(ref aimRay)).direction, maxDistanceFilter = 100f, minDistanceFilter = 0f }; val.RefreshCandidates(); HurtBox val2 = val.GetResults().FirstOrDefault(); if (Object.op_Implicit((Object)(object)val2)) { target = ((Component)val2).gameObject; } FireProjectileInfo val3 = default(FireProjectileInfo); val3.projectilePrefab = Soldier76Assets.helixRocketPrefab; val3.position = ((Ray)(ref aimRay)).origin; val3.rotation = Util.QuaternionSafeLookRotation(((Ray)(ref aimRay)).direction); val3.owner = ((EntityState)this).gameObject; val3.damage = damageCoefficient * ((BaseState)this).damageStat; val3.force = force; val3.crit = ((BaseState)this).RollCrit(); val3.damageColorIndex = (DamageColorIndex)0; val3.target = target; ((FireProjectileInfo)(ref val3)).speedOverride = 80f; FireProjectileInfo val4 = val3; ProjectileManager.instance.FireProjectile(val4); ((EntityState)this).characterBody.AddSpreadBloom(1.5f); EffectManager.SimpleMuzzleFlash(FirePistol2.muzzleEffectPrefab, ((EntityState)this).gameObject, "Muzzle", false); } public override InterruptPriority GetMinimumInterruptPriority() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) return (InterruptPriority)1; } } public class FirePulseRifle : BaseSkillState { public static float damageCoefficient = 0.5f; public static float procCoefficient = 1f; public static float fireInterval = 0.2f; public static float force = 200f; public static float recoil = 1f; public static float range = 200f; private float fireTimer; private string muzzleString; public override void OnEnter() { ((BaseState)this).OnEnter(); ((EntityState)this).characterBody.SetAimTimer(2f); muzzleString = "Muzzle"; ((EntityState)this).PlayAnimation("Gesture, Additive", "FirePistol, Right"); Fire(); fireTimer = fireInterval / ((BaseState)this).attackSpeedStat; } public override void FixedUpdate() { ((EntityState)this).FixedUpdate(); fireTimer -= Time.fixedDeltaTime; if (fireTimer <= 0f) { if (((EntityState)this).isAuthority && Object.op_Implicit((Object)(object)((EntityState)this).inputBank) && ((EntityState)this).inputBank.skill1.down) { Fire(); fireTimer = fireInterval / ((BaseState)this).attackSpeedStat; } else if (((EntityState)this).isAuthority) { ((EntityState)this).outer.SetNextStateToMain(); } } } private void Fire() { //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_0057: 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_015e: 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_016a: 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_0172: 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_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: 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_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: 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_020c: 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_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_0234: 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_024a: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Expected O, but got Unknown //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: 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_00ca: 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_00e3: Expected O, but got Unknown //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: 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_0128: Unknown result type (might be due to invalid IL or missing references) ((EntityState)this).characterBody.AddSpreadBloom(0.3f); Soldier76Plugin.PlayVoiceWithVolume(((EntityState)this).gameObject, "Play_skill1_shootsound", 0.15f); EffectManager.SimpleMuzzleFlash(FirePistol2.muzzleEffectPrefab, ((EntityState)this).gameObject, muzzleString, false); if (!((EntityState)this).isAuthority) { return; } Ray aimRay = ((BaseState)this).GetAimRay(); Vector3 aimVector = ((Ray)(ref aimRay)).direction; if (((EntityState)this).characterBody.HasBuff(Soldier76Buffs.tacticalVisorBuff)) { BullseyeSearch val = new BullseyeSearch { teamMaskFilter = TeamMask.GetEnemyTeams(((EntityState)this).characterBody.teamComponent.teamIndex), sortMode = (SortMode)2, filterByLoS = false, searchOrigin = ((Ray)(ref aimRay)).origin, searchDirection = ((Ray)(ref aimRay)).direction, maxDistanceFilter = range, minDistanceFilter = 0f, maxAngleFilter = 30f }; val.RefreshCandidates(); HurtBox val2 = val.GetResults().FirstOrDefault(); if (Object.op_Implicit((Object)(object)val2)) { Vector3 val3 = ((Component)val2).transform.position - ((Ray)(ref aimRay)).origin; aimVector = ((Vector3)(ref val3)).normalized; } } ((BaseState)this).AddRecoil(-0.3f * recoil, -0.5f * recoil, -0.2f * recoil, 0.2f * recoil); BulletAttack val4 = new BulletAttack { bulletCount = 1u, aimVector = aimVector, origin = ((Ray)(ref aimRay)).origin, damage = damageCoefficient * ((BaseState)this).damageStat, damageColorIndex = (DamageColorIndex)0, damageType = DamageTypeCombo.GenericPrimary, falloffModel = (FalloffModel)1, maxDistance = range, force = force, hitMask = CommonMasks.bullet, minSpread = 0f, maxSpread = ((EntityState)this).characterBody.spreadBloomAngle, isCrit = ((BaseState)this).RollCrit(), owner = ((EntityState)this).gameObject, muzzleName = muzzleString, smartCollision = true, procCoefficient = procCoefficient, radius = 0.1f, tracerEffectPrefab = FirePistol2.tracerEffectPrefab, spreadPitchScale = 1f, spreadYawScale = 1f, hitEffectPrefab = FirePistol2.hitEffectPrefab }; val4.Fire(); } public override InterruptPriority GetMinimumInterruptPriority() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) return (InterruptPriority)1; } } public class Sprint : BaseSkillState { public static float buffDuration = 10f; public override void OnEnter() { ((BaseState)this).OnEnter(); if (((EntityState)this).isAuthority) { HealthComponent healthComponent = ((EntityState)this).characterBody.healthComponent; if (Object.op_Implicit((Object)(object)healthComponent)) { float num = ((EntityState)this).characterBody.maxHealth * 0.2f; healthComponent.health = Mathf.Max(healthComponent.health - num, 1f); float shield = ((EntityState)this).characterBody.maxHealth * 0.15f; healthComponent.shield = shield; } Soldier76Plugin.PlayVoice(((EntityState)this).gameObject, "Play_skill3_76voice"); ((EntityState)this).characterBody.AddTimedBuff(Soldier76Buffs.sprintBuff, buffDuration); Util.PlaySound("Play_item_use_laserTurbine", ((EntityState)this).gameObject); } ((EntityState)this).outer.SetNextStateToMain(); } public override InterruptPriority GetMinimumInterruptPriority() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) return (InterruptPriority)2; } } public class TacticalVisor : BaseSkillState { public static float buffDuration = 10f; public override void OnEnter() { ((BaseState)this).OnEnter(); if (((EntityState)this).isAuthority) { bool flag = false; Soldier76PassiveController component = ((EntityState)this).GetComponent(); if ((Object)(object)component != (Object)null && component.TryConsumeCharge()) { flag = true; ((EntityState)this).characterBody.AddTimedBuff(Soldier76Buffs.enhancedVisorBuff, buffDuration); } ((EntityState)this).characterBody.AddTimedBuff(Soldier76Buffs.tacticalVisorBuff, buffDuration); if (!Object.op_Implicit((Object)(object)((EntityState)this).GetComponent())) { ((EntityState)this).gameObject.AddComponent(); } Soldier76Plugin.PlayVoiceWithVolume(((EntityState)this).gameObject, "Play_skill4_start", 0.5f); Soldier76Plugin.PlayVoice(((EntityState)this).gameObject, "Play_skill4_76voice"); } ((EntityState)this).PlayAnimation("FullBody, Override", "Idle", "Run.playbackRate", 0.5f, 0f); ((EntityState)this).outer.SetNextStateToMain(); } public override InterruptPriority GetMinimumInterruptPriority() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) return (InterruptPriority)2; } } } namespace Soldier76Mod.Survivors.Soldier76.Components { public class HelixRocketJumpComponent : MonoBehaviour { [CompilerGenerated] private sealed class d__4 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public HelixRocketJumpComponent <>4__this; private ProjectileController 5__1; private GameObject 5__2; private float 5__3; private CharacterMotor 5__4; private Vector3 5__5; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__4(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; 5__2 = null; 5__4 = null; <>1__state = -2; } private bool MoveNext() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013a: 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_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018a: 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_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForFixedUpdate(); <>1__state = 1; return true; case 1: <>1__state = -1; <>2__current = (object)new WaitForFixedUpdate(); <>1__state = 2; return true; case 2: { <>1__state = -1; 5__1 = ((Component)<>4__this).GetComponent(); if ((Object)(object)5__1 == (Object)null) { return false; } 5__2 = 5__1.owner; if ((Object)(object)5__2 == (Object)null) { return false; } 5__3 = Vector3.Distance(((Component)<>4__this).transform.position, 5__2.transform.position); if (5__3 > <>4__this.blastRadius) { return false; } 5__4 = 5__2.GetComponent(); if ((Object)(object)5__4 == (Object)null) { return false; } Vector3 val = 5__2.transform.position - ((Component)<>4__this).transform.position; 5__5 = ((Vector3)(ref val)).normalized; 5__5.y = Mathf.Max(Mathf.Abs(5__5.y), 0.3f); Transform transform = 5__2.transform; transform.position += 5__5 * 8f; 5__4.velocity = 5__5 * <>4__this.jumpForce; 5__4.ApplyForce(5__5 * <>4__this.jumpForce, true, false); return false; } } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public float blastRadius = 8f; public float jumpForce = 30f; private bool hasJumped; private void OnTriggerEnter(Collider other) { if (!hasJumped) { hasJumped = true; ((MonoBehaviour)this).StartCoroutine(ExecuteJump()); } } [IteratorStateMachine(typeof(d__4))] private IEnumerator ExecuteJump() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__4(0) { <>4__this = this }; } } internal class Soldier76WeaponComponent : MonoBehaviour { private void Awake() { } } } namespace Soldier76Mod.Survivors.Soldier76.Achievements { [RegisterAchievement("S76_S76_masteryAchievement", "S76_S76_masteryUnlockable", null, 10u, null)] public class Soldier76MasteryAchievement : BaseMasteryAchievement { public const string identifier = "S76_S76_masteryAchievement"; public const string unlockableIdentifier = "S76_S76_masteryUnlockable"; public override string RequiredCharacterBody => CharacterBase.instance.bodyName; public override float RequiredDifficultyCoefficient => 3f; } }