Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of CaptainTurretBeacon v1.0.0
CaptainTurretBeacon.dll
Decompiled 4 months agousing System; using System.Collections; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using CaptainBeaconCooldown; using EntityStates; using EntityStates.Captain.Weapon; using EntityStates.CaptainSupplyDrop; using Microsoft.CodeAnalysis; using MonoMod.RuntimeDetour; using On.RoR2; using On.RoR2.CharacterAI; using R2API; using RoR2; using RoR2.CharacterAI; using RoR2.Skills; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; using UnityEngine.Rendering; [assembly: AssemblyTitle("CaptainTurretBeacon")] [assembly: AssemblyProduct("CaptainTurretBeacon")] [assembly: AssemblyInformationalVersion("1.0.0+e5518f4560f3a0ae7661f6590137fb2bd7085a53")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyCompany("CaptainTurretBeacon")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: CompilationRelaxations(8)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace CaptainTurretBeacon { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("HIFU.CaptainTurretBeacon", "CaptainTurretBeacon", "1.0.0")] public class Main : BaseUnityPlugin { public const string PluginGUID = "HIFU.CaptainTurretBeacon"; public const string PluginAuthor = "HIFU"; public const string PluginName = "CaptainTurretBeacon"; public const string PluginVersion = "1.0.0"; public static ManualLogSource ctbLogger; public static bool CaptainBeaconCooldownLoaded; public static AssetBundle bundle; public static Main Instance; public Hook hook; public bool hooked = false; public static ConfigEntry<float> beaconCooldown { get; set; } public void Awake() { Instance = this; ctbLogger = ((BaseUnityPlugin)this).Logger; bundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)Instance).Info.Location), "captainturretbeacon")); beaconCooldown = ((BaseUnityPlugin)this).Config.Bind<float>("Behavior", "Cooldown Amount", 60f, "Enabled when Phys09s Captain Beacon Cooldown and Tweaks is installed. The cooldown that the Beacon skill has."); CallSupplyTurretSkillDef.Init(); TurretFireSkillDef.Init(); Prefabs.Init(); AddCooldownToBeacon(); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public void AddCooldownToBeacon() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown try { hook = new Hook((MethodBase)typeof(CaptainBeaconCooldown).GetMethod("Awake", (BindingFlags)(-1)), typeof(Main).GetMethod("AddCooldownsHook", (BindingFlags)(-1))); } catch { } } private static void AddCooldownsHook(Action<CaptainBeaconCooldown> orig, CaptainBeaconCooldown self) { orig(self); Array.Resize(ref self.beaconNameTokens, self.beaconNameTokens.Length + 1); self.beaconNameTokens[self.beaconNameTokens.Length - 1] = "CAPTAIN_SUPPLY_TURRET_NAME"; Array.Resize(ref self.beaconCooldowns, self.beaconCooldowns.Length + 1); self.beaconCooldowns[self.beaconCooldowns.Length - 1] = beaconCooldown.Value; } } public static class Prefabs { [CompilerGenerated] private static class <>O { public static hook_Init <0>__OnBodyCatalogInit; public static hook_OnBodyDamaged <1>__OnAIDamaged; } public static GameObject beaconPrefab; public static GameObject turretBodyPrefab; public static GameObject turretMasterPrefab; public static GameObject indicatorPrefab; public static GameObject tracerPrefab; public static GameObject muzzleFlashPrefab; public static GameObject impactPrefab; public static BodyIndex captainBodyIndex; public static void Init() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown //IL_00b3: 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_0102: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: 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_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Expected O, but got Unknown //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_0337: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_036f: Unknown result type (might be due to invalid IL or missing references) //IL_0371: Unknown result type (might be due to invalid IL or missing references) //IL_038d: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: Unknown result type (might be due to invalid IL or missing references) //IL_03a7: Unknown result type (might be due to invalid IL or missing references) //IL_03ee: Unknown result type (might be due to invalid IL or missing references) //IL_03f3: Unknown result type (might be due to invalid IL or missing references) //IL_0445: Unknown result type (might be due to invalid IL or missing references) //IL_044a: Unknown result type (might be due to invalid IL or missing references) //IL_0450: Expected O, but got Unknown //IL_0466: Unknown result type (might be due to invalid IL or missing references) //IL_046b: Unknown result type (might be due to invalid IL or missing references) //IL_0471: Expected O, but got Unknown beaconPrefab = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"7eaa9cf9fa18c374ab0c0acc09db93a2").WaitForCompletion(), "Captain Turret Beacon", true); GenericDisplayNameProvider component = beaconPrefab.GetComponent<GenericDisplayNameProvider>(); component.displayToken = "CAPTAIN_SUPPLY_TURRET_NAME"; EntityStateMachine component2 = beaconPrefab.GetComponent<EntityStateMachine>(); component2.mainStateType = new SerializableEntityStateType(typeof(TurretMainState)); SkinnedMeshRenderer component3 = ((Component)beaconPrefab.GetComponent<ModelLocator>()._modelTransform.Find("CaptainSupplyDropMesh")).GetComponent<SkinnedMeshRenderer>(); Material val = new Material(Addressables.LoadAssetAsync<Material>((object)"5be601672a643584a8bf78a2ca56c12b").WaitForCompletion()); val.SetTexture("_MainTex", (Texture)(object)Main.bundle.LoadAsset<Texture2D>("texTurretBeaconDiffuse.png")); val.SetColor("_EmColor", Color.white); val.SetFloat("_EmPower", 5.5f); ((Renderer)component3).material = val; beaconPrefab.AddComponent<HopooGames>(); PrefabAPI.RegisterNetworkPrefab(beaconPrefab); ContentAddition.AddNetworkedObject(beaconPrefab); turretBodyPrefab = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"04508f474b420d546b5d55a9a18a9698").WaitForCompletion(), "Captain Turret Body", true); CharacterBody component4 = turretBodyPrefab.GetComponent<CharacterBody>(); component4.baseNameToken = "CAPTAIN_TURRET_NAME"; component4.baseDamage = 9.6f; component4.levelDamage = 1.92f; HealthComponent component5 = turretBodyPrefab.GetComponent<HealthComponent>(); component5.isDefaultGodMode = true; component5.godMode = true; GenericSkill component6 = turretBodyPrefab.GetComponent<GenericSkill>(); SkillFamily val2 = ScriptableObject.CreateInstance<SkillFamily>(); val2.variants = (Variant[])(object)new Variant[1]; val2.defaultVariantIndex = 0u; val2.variants[0] = new Variant { skillDef = TurretFireSkillDef.skillDef, unlockableDef = null }; ContentAddition.AddSkillFamily(val2); component6._skillFamily = val2; component4.portraitIcon = (Texture)(object)Main.bundle.LoadAsset<Texture2D>("texCaptainTurretPortrait.png"); Texture2D val3 = Addressables.LoadAssetAsync<Texture2D>((object)"d67c887632cd1704ebe3a19486dbe843").WaitForCompletion(); Material val4 = new Material(Addressables.LoadAssetAsync<Material>((object)"a9b91ae3f60a5d14a97ec97e5991dc57").WaitForCompletion()); val4.SetTexture("_MainTex", (Texture)(object)Main.bundle.LoadAsset<Texture2D>("texCaptainTurretDiffuse.png")); val4.SetTexture("_PrintRamp", (Texture)(object)val3); val4.SetColor("_EmColor", Color.white); val4.SetFloat("_EmPower", 5.5f); Transform modelTransform = turretBodyPrefab.GetComponent<ModelLocator>()._modelTransform; HurtBoxGroup component7 = ((Component)modelTransform).GetComponent<HurtBoxGroup>(); HurtBox val5 = component7.hurtBoxes[0]; HurtBox val6 = component7.hurtBoxes[1]; Array.Resize(ref component7.hurtBoxes, 0); Object.Destroy((Object)(object)((Component)val5).GetComponent<HurtBox>()); Object.Destroy((Object)(object)((Component)val5).GetComponent<CapsuleCollider>()); Object.Destroy((Object)(object)((Component)val6).GetComponent<HurtBox>()); Object.Destroy((Object)(object)((Component)val6).GetComponent<BoxCollider>()); component7.mainHurtBox = null; Object.Destroy((Object)(object)((Component)modelTransform).GetComponent<HurtBoxGroup>()); Mesh mesh = Addressables.LoadAssetAsync<Mesh>((object)"bc52bb41b17826042a15ba20e4447f32").WaitForCompletion(); SkinnedMeshRenderer component8 = ((Component)modelTransform.Find("EngiTurretMesh")).GetComponent<SkinnedMeshRenderer>(); ((Renderer)component8).material = val4; SkinDefParams val7 = ScriptableObject.CreateInstance<SkinDefParams>(); val7.rendererInfos = (RendererInfo[])(object)new RendererInfo[1]; val7.rendererInfos[0] = new RendererInfo { renderer = (Renderer)(object)component8, defaultMaterial = val4, defaultShadowCastingMode = (ShadowCastingMode)1, hideOnDeath = false, ignoreOverlays = false, ignoresMaterialOverrides = false }; val7.meshReplacements = (MeshReplacement[])(object)new MeshReplacement[1]; val7.meshReplacements[0] = new MeshReplacement { mesh = mesh, renderer = (Renderer)(object)component8 }; SkinDef val8 = ScriptableObject.CreateInstance<SkinDef>(); val8.rootObject = ((Component)modelTransform).gameObject; val8.skinDefParams = val7; ModelSkinController component9 = ((Component)modelTransform).GetComponent<ModelSkinController>(); component9.skins[0] = val8; ContentAddition.AddBody(turretBodyPrefab); turretMasterPrefab = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"ab6d27c997dd03546bcb6f3176059eba").WaitForCompletion(), "Captain Turret Master", true); CharacterMaster component10 = turretMasterPrefab.GetComponent<CharacterMaster>(); component10.bodyPrefab = turretBodyPrefab; ContentAddition.AddMaster(turretMasterPrefab); SetUpVFX(); object obj = <>O.<0>__OnBodyCatalogInit; if (obj == null) { hook_Init val9 = OnBodyCatalogInit; <>O.<0>__OnBodyCatalogInit = val9; obj = (object)val9; } BodyCatalog.Init += (hook_Init)obj; object obj2 = <>O.<1>__OnAIDamaged; if (obj2 == null) { hook_OnBodyDamaged val10 = OnAIDamaged; <>O.<1>__OnAIDamaged = val10; obj2 = (object)val10; } BaseAI.OnBodyDamaged += (hook_OnBodyDamaged)obj2; } private static void OnAIDamaged(orig_OnBodyDamaged orig, BaseAI self, DamageReport damageReport) { if (Object.op_Implicit((Object)(object)self.currentEnemy.characterBody) && self.currentEnemy.characterBody.baseNameToken == "CAPTAIN_TURRET_NAME") { self.currentEnemy.Reset(); } else { orig.Invoke(self, damageReport); } } private static IEnumerator OnBodyCatalogInit(orig_Init orig) { yield return orig.Invoke(); captainBodyIndex = BodyCatalog.FindBodyIndex("CaptainBody(Clone)"); } public static void SetUpVFX() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0072: 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_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Expected O, but got Unknown //IL_011a: 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_0129: 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_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019a: 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_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Expected O, but got Unknown //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: 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_0237: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Expected O, but got Unknown //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Expected O, but got Unknown //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_0294: 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_02a3: 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) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: 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_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_0373: Unknown result type (might be due to invalid IL or missing references) //IL_0378: Unknown result type (might be due to invalid IL or missing references) //IL_037a: Unknown result type (might be due to invalid IL or missing references) //IL_0381: Expected O, but got Unknown //IL_0396: Unknown result type (might be due to invalid IL or missing references) //IL_039b: Unknown result type (might be due to invalid IL or missing references) //IL_03ad: Unknown result type (might be due to invalid IL or missing references) //IL_03b2: Unknown result type (might be due to invalid IL or missing references) //IL_03c7: Unknown result type (might be due to invalid IL or missing references) //IL_03e7: Unknown result type (might be due to invalid IL or missing references) //IL_0402: Unknown result type (might be due to invalid IL or missing references) //IL_0407: Unknown result type (might be due to invalid IL or missing references) //IL_043d: Unknown result type (might be due to invalid IL or missing references) //IL_0442: Unknown result type (might be due to invalid IL or missing references) //IL_0448: Unknown result type (might be due to invalid IL or missing references) //IL_0464: Unknown result type (might be due to invalid IL or missing references) //IL_0469: Unknown result type (might be due to invalid IL or missing references) //IL_046f: Unknown result type (might be due to invalid IL or missing references) //IL_04a2: Unknown result type (might be due to invalid IL or missing references) //IL_04a7: Unknown result type (might be due to invalid IL or missing references) //IL_04a9: Unknown result type (might be due to invalid IL or missing references) //IL_04b0: Expected O, but got Unknown //IL_04c8: Unknown result type (might be due to invalid IL or missing references) //IL_04cd: Unknown result type (might be due to invalid IL or missing references) //IL_04d7: Unknown result type (might be due to invalid IL or missing references) //IL_04dc: Unknown result type (might be due to invalid IL or missing references) //IL_04e4: Unknown result type (might be due to invalid IL or missing references) //IL_04ee: Unknown result type (might be due to invalid IL or missing references) //IL_04f3: Unknown result type (might be due to invalid IL or missing references) //IL_050d: Unknown result type (might be due to invalid IL or missing references) //IL_0512: Unknown result type (might be due to invalid IL or missing references) //IL_0524: Unknown result type (might be due to invalid IL or missing references) //IL_0529: Unknown result type (might be due to invalid IL or missing references) //IL_053b: Unknown result type (might be due to invalid IL or missing references) //IL_0540: Unknown result type (might be due to invalid IL or missing references) //IL_0555: Unknown result type (might be due to invalid IL or missing references) indicatorPrefab = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"5ba295c0a3919a544939e6efe1ff17b3").WaitForCompletion(), "Captain Turret Range Indicator VFX", true); Transform val = indicatorPrefab.transform.Find("Radius, Spherical"); val.localScale = Vector3.one * 60f * 2f; Material val2 = new Material(Addressables.LoadAssetAsync<Material>((object)"efcdb7ab1fe128a4eb2d79a8024c25bd").WaitForCompletion()); Texture2D val3 = Addressables.LoadAssetAsync<Texture2D>((object)"cd8abd51143aa5140aded186614aa040").WaitForCompletion(); val2.SetTexture("_MainTex", (Texture)(object)val3); val2.SetTexture("_Cloud1Tex", (Texture)(object)val3); val2.SetColor("_TintColor", Color32.op_Implicit(new Color32(byte.MaxValue, (byte)0, (byte)0, (byte)128))); ((Renderer)((Component)val).GetComponent<MeshRenderer>()).material = val2; PrefabAPI.RegisterNetworkPrefab(indicatorPrefab); tracerPrefab = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"561b80f2f7f29ba4cb234df1444df815").WaitForCompletion(), "Captain Turret Tracer VFX", false); LineRenderer component = tracerPrefab.GetComponent<LineRenderer>(); Gradient val4 = new Gradient(); GradientColorKey[] array = (GradientColorKey[])(object)new GradientColorKey[2] { new GradientColorKey(Color.red, 0f), new GradientColorKey(Color.red, 1f) }; val4.SetKeys(array, (GradientAlphaKey[])(object)new GradientAlphaKey[2] { new GradientAlphaKey(1f, 0f), new GradientAlphaKey(1f, 1f) }); component.colorGradient = val4; Texture2D val5 = Addressables.LoadAssetAsync<Texture2D>((object)"d67c887632cd1704ebe3a19486dbe843").WaitForCompletion(); Material val6 = new Material(Addressables.LoadAssetAsync<Material>((object)"7fa66dfdd452dab48af0fbe1993f04d6").WaitForCompletion()); val6.SetTexture("_RemapTex", (Texture)(object)val5); ((Renderer)component).material = val6; ContentAddition.AddEffect(tracerPrefab); muzzleFlashPrefab = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"1a8f4ee7d7e360d42ba0dca68ff828c6").WaitForCompletion(), "Captain Turret Muzzle Flash VFX", false); Transform transform = muzzleFlashPrefab.transform; ParticleSystemRenderer component2 = ((Component)transform.Find("Ring")).GetComponent<ParticleSystemRenderer>(); Material val7 = new Material(Addressables.LoadAssetAsync<Material>((object)"67a2cf616ad4b42479cd8bdb2b0b0ca2").WaitForCompletion()); val7.SetTexture("_RemapTex", (Texture)(object)val5); ((Renderer)component2).material = val7; ColorOverLifetimeModule colorOverLifetime = ((Component)transform.Find("Flames")).GetComponent<ParticleSystem>().colorOverLifetime; Gradient val8 = new Gradient(); GradientColorKey[] array2 = (GradientColorKey[])(object)new GradientColorKey[3] { new GradientColorKey(Color32.op_Implicit(new Color32(byte.MaxValue, (byte)103, (byte)100, byte.MaxValue)), 0.053f), new GradientColorKey(Color32.op_Implicit(new Color32((byte)233, (byte)0, (byte)13, byte.MaxValue)), 0.309f), new GradientColorKey(Color32.op_Implicit(new Color32((byte)233, (byte)0, (byte)26, byte.MaxValue)), 1f) }; GradientAlphaKey[] array3 = (GradientAlphaKey[])(object)new GradientAlphaKey[3]; array3[0] = new GradientAlphaKey(0f, 0f); array3[0] = new GradientAlphaKey(1f, 0.141f); array3[0] = new GradientAlphaKey(0f, 1f); val8.SetKeys(array2, array3); ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(val4); ColorOverLifetimeModule colorOverLifetime2 = ((Component)transform.Find("Flash")).GetComponent<ParticleSystem>().colorOverLifetime; Gradient val9 = new Gradient(); val9.SetKeys(array, (GradientAlphaKey[])(object)new GradientAlphaKey[2] { new GradientAlphaKey(0.271f, 0f), new GradientAlphaKey(0f, 1f) }); ((ColorOverLifetimeModule)(ref colorOverLifetime2)).color = MinMaxGradient.op_Implicit(val9); Light component3 = ((Component)transform.Find("Point light")).GetComponent<Light>(); component3.color = Color.red; ContentAddition.AddEffect(muzzleFlashPrefab); impactPrefab = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"5a6d604670c05594a83b3727683e711d").WaitForCompletion(), "Captain Turret Impact VFX", false); Transform transform2 = impactPrefab.transform; ColorOverLifetimeModule colorOverLifetime3 = ((Component)transform2.Find("Flash")).GetComponent<ParticleSystem>().colorOverLifetime; ((ColorOverLifetimeModule)(ref colorOverLifetime3)).color = MinMaxGradient.op_Implicit(val9); ColorOverLifetimeModule colorOverLifetime4 = ((Component)transform2.Find("Flames")).GetComponent<ParticleSystem>().colorOverLifetime; ((ColorOverLifetimeModule)(ref colorOverLifetime4)).color = MinMaxGradient.op_Implicit(val8); Transform val10 = transform2.Find("Ring"); ParticleSystemRenderer component4 = ((Component)val10).GetComponent<ParticleSystemRenderer>(); ((Renderer)component4).material = val7; ColorOverLifetimeModule colorOverLifetime5 = ((Component)val10).GetComponent<ParticleSystem>().colorOverLifetime; Gradient val11 = new Gradient(); GradientColorKey[] array4 = (GradientColorKey[])(object)new GradientColorKey[2]; array4[0] = new GradientColorKey(Color32.op_Implicit(new Color32((byte)202, (byte)0, (byte)35, byte.MaxValue)), 0f); array4[0] = new GradientColorKey(Color.red, 0.585f); GradientAlphaKey[] array5 = (GradientAlphaKey[])(object)new GradientAlphaKey[3]; array5[0] = new GradientAlphaKey(1f, 0f); array5[1] = new GradientAlphaKey(1f, 0.479f); array5[1] = new GradientAlphaKey(0.082f, 1f); val11.SetKeys(array4, array5); ((ColorOverLifetimeModule)(ref colorOverLifetime5)).color = MinMaxGradient.op_Implicit(val11); ContentAddition.AddEffect(impactPrefab); } } public class CallSupplyTurretSkillDef { public static void Init() { //IL_000d: 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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_016a: 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_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) bool flag = default(bool); ContentAddition.AddEntityState(typeof(CallSupplyTurretState), ref flag); ContentAddition.AddEntityState(typeof(TurretMainState), ref flag); ContentAddition.AddEntityState(typeof(TurretFireState), ref flag); SkillDef val = ScriptableObject.CreateInstance<SkillDef>(); val.skillName = "CaptainSupplyDropTurret"; val.skillNameToken = "CAPTAIN_SUPPLY_TURRET_NAME"; val.skillDescriptionToken = "CAPTAIN_SUPPLY_TURRET_DESCRIPTION"; val.icon = Main.bundle.LoadAsset<Sprite>("texCaptainTurret.png"); val.activationStateMachineName = "Weapon"; val.activationState = new SerializableEntityStateType(typeof(CallSupplyTurretState)); val.interruptPriority = (InterruptPriority)2; val.baseRechargeInterval = 0f; val.baseMaxStock = 1; val.rechargeStock = 0; val.requiredStock = 1; val.stockToConsume = 0; val.attackSpeedBuffsRestockSpeed = false; val.attackSpeedBuffsRestockSpeed_Multiplier = 1f; val.resetCooldownTimerOnUse = false; val.fullRestockOnAssign = true; val.dontAllowPastMaxStocks = false; val.beginSkillCooldownOnSkillEnd = true; val.isCooldownBlockedUntilManuallyReset = false; val.cancelSprintingOnActivation = true; val.forceSprintDuringState = false; val.canceledFromSprinting = true; val.isCombatSkill = true; val.mustKeyPress = true; val.triggeredByPressRelease = false; val.autoHandleLuminousShot = true; val.hideStockCount = false; LanguageAPI.Add("CAPTAIN_SUPPLY_TURRET_NAME", "Beacon: Turret"); LanguageAPI.Add("CAPTAIN_SUPPLY_TURRET_DESCRIPTION", "<style=cIsUtility>Request</style> a turret that <style=cIsUtility>inherits all your items</style> and attacks all nearby enemies for <style=cIsDamage>200% damage per second</style>."); LanguageAPI.Add("CAPTAIN_TURRET_NAME", "Captain Turret"); ContentAddition.AddSkillDef(val); SkillFamily val2 = Addressables.LoadAssetAsync<SkillFamily>((object)"d72f3891fdf9e744d93ed1df83c1098a").WaitForCompletion(); SkillFamily val3 = Addressables.LoadAssetAsync<SkillFamily>((object)"6e49127cdcc369c4da9be6fb00913307").WaitForCompletion(); Array.Resize(ref val2.variants, val2.variants.Length + 1); val2.variants[val2.variants.Length - 1].skillDef = val; Array.Resize(ref val3.variants, val3.variants.Length + 1); val3.variants[val3.variants.Length - 1].skillDef = val; } } public class TurretFireSkillDef { public static SkillDef skillDef; public static void Init() { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) skillDef = ScriptableObject.CreateInstance<SkillDef>(); skillDef.skillName = "CaptainTurretFire"; skillDef.skillNameToken = "CAPTAIN_SUPPLY_TURRET_FIRE_NAME"; skillDef.skillDescriptionToken = "CAPTAIN_SUPPLY_TURRET_FIRE_DESCRIPTION"; skillDef.icon = null; skillDef.activationStateMachineName = "Weapon"; skillDef.activationState = new SerializableEntityStateType(typeof(TurretFireState)); skillDef.interruptPriority = (InterruptPriority)0; skillDef.baseRechargeInterval = 0f; skillDef.baseMaxStock = 1; skillDef.rechargeStock = 1; skillDef.requiredStock = 1; skillDef.stockToConsume = 1; skillDef.attackSpeedBuffsRestockSpeed = false; skillDef.attackSpeedBuffsRestockSpeed_Multiplier = 1f; skillDef.resetCooldownTimerOnUse = false; skillDef.fullRestockOnAssign = true; skillDef.dontAllowPastMaxStocks = false; skillDef.beginSkillCooldownOnSkillEnd = false; skillDef.isCooldownBlockedUntilManuallyReset = false; skillDef.cancelSprintingOnActivation = true; skillDef.forceSprintDuringState = false; skillDef.canceledFromSprinting = false; skillDef.isCombatSkill = true; skillDef.mustKeyPress = false; skillDef.triggeredByPressRelease = false; skillDef.autoHandleLuminousShot = true; skillDef.hideStockCount = false; ContentAddition.AddSkillDef(skillDef); } } public class CallSupplyTurretState : CallSupplyDropBase { public override void OnEnter() { base.supplyDropPrefab = Prefabs.beaconPrefab; ((CallSupplyDropBase)this).OnEnter(); } } public class HopooGames : NetworkBehaviour { public GameObject turretInstance; private static int kCmdCmdSpawnTurret; [Command] public void CmdSpawnTurret(GameObject builder, Vector3 position, Quaternion rotation) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: 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_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0087: 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_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)builder)) { return; } CharacterBody component = builder.GetComponent<CharacterBody>(); if (!Object.op_Implicit((Object)(object)component)) { return; } GameObject masterPrefab = MasterCatalog.GetMasterPrefab(MasterCatalog.FindMasterIndex(Prefabs.turretMasterPrefab)); if (!Object.op_Implicit((Object)(object)masterPrefab)) { return; } CharacterMaster master = component.master; if (!Object.op_Implicit((Object)(object)master)) { return; } KillTurretInstance(); CharacterMaster val = new MasterSummon { masterPrefab = masterPrefab, position = position, rotation = rotation, summonerBodyObject = builder, ignoreTeamMemberLimit = true, inventoryToCopy = master.inventory }.Perform(); Inventory inventory = val.inventory; if (Object.op_Implicit((Object)(object)inventory)) { inventory.RemoveItem(Items.Mushroom, inventory.GetItemCount(Items.Mushroom)); } CharacterBody body = val.GetBody(); if (Object.op_Implicit((Object)(object)body)) { if (!body.HasBuff(Buffs.Intangible)) { body.AddBuff(Buffs.Intangible); } HealthComponent healthComponent = body.healthComponent; if (Object.op_Implicit((Object)(object)healthComponent)) { healthComponent.godMode = true; healthComponent.isDefaultGodMode = true; } } turretInstance = ((Component)val).gameObject; } public void OnDisable() { KillTurretInstance(); } public void OnDestroy() { KillTurretInstance(); } public void KillTurretInstance() { if (!Object.op_Implicit((Object)(object)turretInstance)) { return; } CharacterMaster component = turretInstance.GetComponent<CharacterMaster>(); CharacterBody body = component.GetBody(); if (Object.op_Implicit((Object)(object)body)) { HealthComponent healthComponent = body.healthComponent; if (Object.op_Implicit((Object)(object)healthComponent)) { healthComponent.godMode = false; healthComponent.isDefaultGodMode = false; } } component.TrueKill(); } private void UNetVersion() { } protected static void InvokeCmdCmdSpawnTurret(NetworkBehaviour obj, NetworkReader reader) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { Debug.LogError((object)"Command CmdSpawnTurret called on client."); } else { ((HopooGames)(object)obj).CmdSpawnTurret(reader.ReadGameObject(), reader.ReadVector3(), reader.ReadQuaternion()); } } public void CallCmdSpawnTurret(GameObject builder, Vector3 position, Quaternion rotation) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_0060: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) if (!NetworkClient.active) { Debug.LogError((object)"Command function CmdSpawnTurret called on server."); return; } if (((NetworkBehaviour)this).isServer) { CmdSpawnTurret(builder, position, rotation); return; } NetworkWriter val = new NetworkWriter(); val.Write((short)0); val.Write((short)5); val.WritePackedUInt32((uint)kCmdCmdSpawnTurret); val.Write(((Component)this).GetComponent<NetworkIdentity>().netId); val.Write(builder); val.Write(position); val.Write(rotation); ((NetworkBehaviour)this).SendCommandInternal(val, 0, "CmdSpawnTurret"); } static HopooGames() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown kCmdCmdSpawnTurret = -3705997; NetworkBehaviour.RegisterCommandDelegate(typeof(HopooGames), kCmdCmdSpawnTurret, new CmdDelegate(InvokeCmdCmdSpawnTurret)); NetworkCRC.RegisterBehaviour("HopooGames", 0); } public override bool OnSerialize(NetworkWriter writer, bool forceAll) { bool result = default(bool); return result; } public override void OnDeserialize(NetworkReader reader, bool initialState) { } } public class TurretFireState : BaseState { public static GameObject effectPrefab = Prefabs.muzzleFlashPrefab; public static GameObject hitEffectPrefab = Prefabs.impactPrefab; public static GameObject tracerEffectPrefab = Prefabs.tracerPrefab; public static string attackSoundString = "Play_engi_R_turret_shot"; public static float damageCoefficient = 0.7f; public static float force = 200f; public static float minSpread = 0f; public static float maxSpread = 1.5f; public static float baseDuration = 0.35f; private float duration; private static int stateHash = Animator.StringToHash("FireGauss"); private static int paramHash = Animator.StringToHash("FireGauss.playbackRate"); public override void OnEnter() { //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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: 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_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Expected O, but got Unknown //IL_0148: Unknown result type (might be due to invalid IL or missing references) ((BaseState)this).OnEnter(); duration = baseDuration / base.attackSpeedStat; Util.PlaySound(attackSoundString, ((EntityState)this).gameObject); Ray aimRay = ((BaseState)this).GetAimRay(); ((BaseState)this).StartAimMode(aimRay, 2f, false); ((EntityState)this).PlayAnimation("Gesture", stateHash, paramHash, duration); string text = "Muzzle"; EffectManager.SimpleMuzzleFlash(effectPrefab, ((EntityState)this).gameObject, text, false); if (((EntityState)this).isAuthority) { BulletAttack val = new BulletAttack { owner = ((EntityState)this).gameObject, weapon = ((EntityState)this).gameObject, origin = ((Ray)(ref aimRay)).origin, aimVector = ((Ray)(ref aimRay)).direction, minSpread = minSpread, maxSpread = maxSpread, bulletCount = 1u, damage = damageCoefficient * base.damageStat, force = force, tracerEffectPrefab = tracerEffectPrefab, muzzleName = text, hitEffectPrefab = hitEffectPrefab, isCrit = Util.CheckRoll(base.critStat, ((EntityState)this).characterBody.master), HitEffectNormal = false, radius = 0.15f }; val.damageType.damageSource = (DamageSource)1; val.Fire(); } } public override void OnExit() { ((EntityState)this).OnExit(); } public override void FixedUpdate() { ((EntityState)this).FixedUpdate(); if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority) { ((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)1; } } public class TurretMainState : BaseMainState { public static GameObject turretPrefab = Prefabs.turretMasterPrefab; public GameObject turretPrefabInstance; public GameObject indicatorInstance; public CharacterBody ownerBody; public float heightOffset = 3.5f; public HopooGames hopooGames; public bool enableRadiusIndicator { get { return Object.op_Implicit((Object)(object)indicatorInstance); } set { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) if (enableRadiusIndicator != value) { if (value) { indicatorInstance = Object.Instantiate<GameObject>(Prefabs.indicatorPrefab, ((EntityState)this).transform.position, Quaternion.identity); indicatorInstance.GetComponent<NetworkedBodyAttachment>().AttachToGameObjectAndSpawn(((EntityState)this).gameObject, (string)null); } else { Object.Destroy((Object)(object)indicatorInstance); indicatorInstance = null; } } } } public override Interactability GetInteractability(Interactor activator) { //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 (Interactability)0; } public override void OnEnter() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_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) ((BaseCaptainSupplyDropState)this).OnEnter(); hopooGames = ((Component)((EntityState)this).outer).GetComponent<HopooGames>(); GenericOwnership component = ((Component)((EntityState)this).outer).GetComponent<GenericOwnership>(); Vector3 position = ((Component)((BaseCaptainSupplyDropState)this).interactionComponent).transform.position + ((Component)((BaseCaptainSupplyDropState)this).interactionComponent).transform.up * heightOffset; if (!Object.op_Implicit((Object)(object)component)) { return; } GameObject ownerObject = component.ownerObject; if (Object.op_Implicit((Object)(object)ownerObject)) { if (Object.op_Implicit((Object)(object)hopooGames) && ((EntityState)this).isAuthority) { hopooGames.CallCmdSpawnTurret(ownerObject, position, ((Component)((BaseCaptainSupplyDropState)this).interactionComponent).transform.rotation); } enableRadiusIndicator = true; } } public override void OnExit() { enableRadiusIndicator = false; ((BaseCaptainSupplyDropState)this).OnExit(); } } }