Decompiled source of ImprovedVRUI v0.0.1
plugins/ImprovedVRUI.dll
Decompiled 2 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyCompany("ImprovedVRUI")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Extends upon the UI in HOTDS so that you can make better use of your VR headset and have a better experience.")] [assembly: AssemblyFileVersion("0.0.1.0")] [assembly: AssemblyInformationalVersion("0.0.1")] [assembly: AssemblyProduct("ImprovedVRUI")] [assembly: AssemblyTitle("ImprovedVRUI")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace ImprovedVRUI { public enum ReplaceMissile { ORIGINAL, FEROCITY, HOBS } [BepInPlugin("ImprovedVRUI", "ImprovedVRUI", "0.0.1")] [BepInProcess("dyingsun.exe")] public class Plugin : BaseUnityPlugin { internal static ManualLogSource Log; public const string pluginGuid = "x17.hotds.improved_vr_ui"; public const string pluginName = "ImprovedVRUI"; public const string pluginVersion = "0.0.1"; private ConfigEntry<bool> configReplaceImpCapitalPDS; private ConfigEntry<bool> configReplaceBombsWithBeam; private ConfigEntry<bool> configReplaceBlunderBussWithScattergun; private ConfigEntry<bool> configReplaceAutorifleWithVulcan; private ConfigEntry<bool> configReplaceECMWithPlasmaBombLauncher; private ConfigEntry<bool> configReplaceLongRifleWithPPC; private ConfigEntry<ReplaceMissile> configReplaceMissileOption; private void Awake() { Log = ((BaseUnityPlugin)this).Logger; configReplaceImpCapitalPDS = ((BaseUnityPlugin)this).Config.Bind<bool>("Weapons.Toggles", "ReplaceImpCapitalPDS", true, "Replace the PR.MK4 PDS with something that isn't dogshit and actually works."); if (configReplaceImpCapitalPDS.Value) { ((BaseUnityPlugin)this).Logger.LogInfo((object)$"configReplaceImpCapitalPDS: {configReplaceImpCapitalPDS.Value}"); } configReplaceBombsWithBeam = ((BaseUnityPlugin)this).Config.Bind<bool>("Weapons.Toggles", "ReplaceBombsWithBeam", true, "Replace Purifier bombs with the Nightfire Plasma Beam, you Gundam fan you."); if (configReplaceBombsWithBeam.Value) { ((BaseUnityPlugin)this).Logger.LogInfo((object)$"configReplaceBombsWithBeam: {configReplaceBombsWithBeam.Value}"); } configReplaceBlunderBussWithScattergun = ((BaseUnityPlugin)this).Config.Bind<bool>("Weapons.Toggles", "ReplaceBlunderBussWithScattergun", true, "Replace Blunderbuss shotgun with a longer ranged, tighter spread, shield damaging version."); if (configReplaceBlunderBussWithScattergun.Value) { ((BaseUnityPlugin)this).Logger.LogInfo((object)$"configReplaceBlunderBussWithScattergun: {configReplaceBlunderBussWithScattergun.Value}"); } configReplaceAutorifleWithVulcan = ((BaseUnityPlugin)this).Config.Bind<bool>("Weapons.Toggles", "ReplaceAutorifleWithVulcan", true, "Replace Autorifle with a faster firing, but shorter range version"); if (configReplaceAutorifleWithVulcan.Value) { ((BaseUnityPlugin)this).Logger.LogInfo((object)$"configReplaceAutorifleWithVulcan: {configReplaceAutorifleWithVulcan.Value}"); } configReplaceECMWithPlasmaBombLauncher = ((BaseUnityPlugin)this).Config.Bind<bool>("Weapons.Toggles", "ReplaceECMWithPlasmaBombLauncher", true, "Replace ECM weapon with a Plasma bomb launcher akin to the Homeworld games."); if (configReplaceECMWithPlasmaBombLauncher.Value) { ((BaseUnityPlugin)this).Logger.LogInfo((object)$"configReplaceECMWithPlasmaBombLauncher: {configReplaceECMWithPlasmaBombLauncher.Value}"); } configReplaceLongRifleWithPPC = ((BaseUnityPlugin)this).Config.Bind<bool>("Weapons.Toggles", "ReplaceLongRifleWithPPC", true, "Replace Long Rifle weapon with a tap-firing marksman's weapon."); if (configReplaceECMWithPlasmaBombLauncher.Value) { ((BaseUnityPlugin)this).Logger.LogInfo((object)$"configReplaceECMWithPlasmaBombLauncher: {configReplaceECMWithPlasmaBombLauncher.Value}"); } configReplaceMissileOption = ((BaseUnityPlugin)this).Config.Bind<ReplaceMissile>("Weapons.Toggles", "ReplaceMissileOption", ReplaceMissile.HOBS, "Replace 6B-VII FURY missiles with either keep as default, Unguided artillery rocket pods or HOBS tracking missiles."); ((BaseUnityPlugin)this).Logger.LogInfo((object)$"configReplaceMissileOption: {configReplaceMissileOption.Value}"); InitHarmony(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"ImprovedVRUI has fully loaded and is ready to go!"); } private void InitHarmony() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown Harmony val = new Harmony("x17.hotds.improved_vr_ui"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Patching with harmony..."); val.PatchAll(); SceneManager.sceneLoaded += OnSceneLoaded; } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) SceneManager.sceneLoaded -= OnSceneLoaded; ((MonoBehaviour)this).StartCoroutine(InitAfterFrame(scene)); } private IEnumerator InitAfterFrame(Scene scene) { //IL_000e: 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) yield return null; Modify_CampaignGenerationSettings(); } private WeaponBlueprint findWeaponBlueprint(List<WeaponBlueprint> weapons, string nameMatch) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("nameMatch: " + nameMatch)); foreach (WeaponBlueprint weapon in weapons) { ((BaseUnityPlugin)this).Logger.LogInfo((object)((Object)weapon).name); if (((Object)weapon).name.Equals(nameMatch)) { return weapon; } } return null; } private UnitBlueprint findUnitBlueprint(List<UnitBlueprint> bluePrints, string identifier) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("identifier: " + identifier)); foreach (UnitBlueprint bluePrint in bluePrints) { ((BaseUnityPlugin)this).Logger.LogInfo((object)((Object)bluePrint).name); if (bluePrint.identifier.Equals(identifier)) { return bluePrint; } } return null; } private void improvedFuryMissiles(WeaponBlueprint bp) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) WeaponSettings weapon = bp.weapon; DamageSettings damage = bp.damage; ProjectileSettings projectile = bp.projectile; bp.displayName = "6B-VII-M FURY MISSILES"; bp.description = "A modernized variant of the Fury, the addition of High-Off-Boresight target cueing and locking enhances the reliable Yellowjacket into an unparalleled weapon of slaughter.\n\nAdditionally, it can be used as a defensive anti-torpedo weapon by a competent pilot."; bp.perceivedRange = 0.3f; weapon.fireMode = (FireMode)1; weapon.rateOfFire = 0.04f; weapon.minRateOfFire = 0.03f; weapon.roundsPerBurst = 3; weapon.burstCooldown = 1f; weapon.aiIgnoresHeat = false; damage.areaDamageRadius = 10f; projectile.maxRange = 2400f; projectile.muzzleVelocity = 250f; projectile.steeringDelay = 0.1f; projectile.steeringDrunkenForce = 30f; projectile.steeringForce = 3000f; projectile.steeringLeadFactor = 5f; projectile.rangeDeterminesDetonation = true; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Patched Fury Missiles"); } private void furyRockets(WeaponBlueprint furyMissiles) { //IL_0035: 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) furyMissiles.displayName = "5A-VI FEROCITY ROCKETS"; furyMissiles.description = "\"...with each pass the wing of Interceptors unleashed a hail of rockets into the traitor fleet, stripping shields, shattering armor, and snuffing out forfeit lives.\""; furyMissiles.perceivedRange = 0.4f; furyMissiles.weapon.aiIgnoresHeat = false; furyMissiles.weapon.leadIndicatorType = (LeadIndicatorType)1; furyMissiles.weapon.requiresLock = false; furyMissiles.weapon.roundsPerBurst = 3; furyMissiles.weapon.fireMode = (FireMode)1; furyMissiles.weapon.rateOfFire = 0f; furyMissiles.weapon.burstCooldown = 0.2f; furyMissiles.weapon.maxHeat = 15f; furyMissiles.weapon.spread = 1f; furyMissiles.weapon.playerSpread = 0.8f; furyMissiles.weapon.autoaimAngle = 4f; furyMissiles.projectile.maxRange = 3000f; furyMissiles.projectile.muzzleVelocity = 1500f; furyMissiles.projectile.steeringDrunkenForce = 30f; furyMissiles.projectile.rangeDeterminesDetonation = false; furyMissiles.projectile.minDetonationTimer = furyMissiles.projectile.maxRange / furyMissiles.projectile.muzzleVelocity * 2f; furyMissiles.projectile.maxDetonationTimer = furyMissiles.projectile.maxRange / furyMissiles.projectile.muzzleVelocity * 2f; furyMissiles.damage.hullDamage = 30f; furyMissiles.weapon.lockTime = -1f; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Patched Fury Missiles"); } private void vulcanAC(WeaponBlueprint bp) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) bp.displayName = "MG-2820 VULCAN"; WeaponSettings weapon = bp.weapon; ProjectileSettings projectile = bp.projectile; DamageSettings damage = bp.damage; bp.damage.shieldDamage = 5f; bp.perceivedShieldDamage = 0.3f; weapon.ignoresAimPoint = true; weapon.fireMode = (FireMode)1; weapon.roundsPerBurst = 10; weapon.burstCooldown = 1f; weapon.rateOfFire = 0.04f; weapon.minRateOfFire = 0.03f; bp.leadIndicator = bp.crosshair; weapon.spread = 0.8f; weapon.playerSpread = 0.45f; projectile.maxRange = 2500f; bp.perceivedRange = 0.25f; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Patched AC"); } private void vulcanAC_idea2(WeaponBlueprint bp) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) bp.displayName = "MG-2820 VULCAN"; bp.description = "The MG-2820 VULCAN rotary cannon fires kinetic slugs at a shorter range in return for higher damage output. The coolant system struggles with the increased heat produced."; bp.damage.shieldDamage = 5f; bp.perceivedShieldDamage = 0.3f; WeaponSettings weapon = bp.weapon; weapon.fireMode = (FireMode)0; weapon.rateOfFire = 0.05f; weapon.minRateOfFire = 0.04f; weapon.overheatTime = 2f; weapon.maxHeat = 12f; weapon.aiIgnoresHeat = false; weapon.spread = 0.8f; weapon.playerSpread = 0.45f; ProjectileSettings projectile = bp.projectile; projectile.minArmRange = 0f; projectile.maxRange = 2500f; bp.perceivedRange = 0.25f; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Patched AC"); } private void longRifleToPPC(WeaponBlueprint longRifle, WeaponBlueprint donor) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) longRifle.displayName = "Plasma Projector Cannon"; longRifle.description = "A prototype energy weapon with high damage potential, but relies on the skill and discipline of the pilot to be truly effective. The power and coolant cycles are still being worked on, so the pilot must manually pace the rate of fire and avoid double-taps."; longRifle.shortName = "PPC"; longRifle.damage.shieldDamage = 5f; longRifle.projectilePrefab = donor.projectilePrefab; longRifle.muzzleFlashPrefab = donor.muzzleFlashPrefab; longRifle.impactType = (ImpactType)3; DamageSettings damage = longRifle.damage; damage.areaDamageRadius = 20f; damage.hullDamage = 150f; longRifle.perceivedHullDamage = 0.95f; damage.shieldDamage = 100f; longRifle.perceivedShieldDamage = 0.3f; damage.subsystemDamage = 10f; WeaponSettings weapon = longRifle.weapon; weapon.rateOfFire = 0.1f; weapon.minRateOfFire = 1f; weapon.heatPerRound = 1f; weapon.heatDecayPerSecond = -1f; weapon.maxHeat = 1.1f; weapon.overheatTime = 5f; weapon.aiIgnoresHeat = false; weapon.aiRateOfFireMultiplier = 1f; weapon.autoaimAngle = 2.5f; longRifle.leadIndicator = longRifle.crosshair; weapon.spread = 0.4f; ProjectileSettings projectile = longRifle.projectile; projectile.bouncesOffShields = false; projectile.shieldResponse = (ShieldResponse)0; projectile.muzzleVelocity = 12000f; projectile.maxRange = 8000f; projectile.maxDetonationTimer = projectile.maxRange / projectile.muzzleVelocity; projectile.minDetonationTimer = projectile.maxRange / projectile.muzzleVelocity; longRifle.perceivedRange = 0.75f; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Patched LongRifle"); } private void energySG(WeaponBlueprint bp, WeaponBlueprint shuriken) { bp.displayName = "XM-FLC-M2 Scattergun"; bp.description = "The addition of a stronger focusing field and the use of transuranic metals in the projectile greatly improves anti-shield effect and lessens dispersion."; bp.projectilePrefab = shuriken.projectilePrefab; bp.muzzleFlashPrefab = shuriken.muzzleFlashPrefab; bp.perceivedRange = 0.3f; bp.perceivedShieldDamage = 0.4f; bp.damage.shieldDamage = 12f; WeaponSettings weapon = bp.weapon; weapon.spread = 2.5f; weapon.playerSpread = 1f; weapon.maxAutoAimDistance = 2500f; ProjectileSettings projectile = bp.projectile; projectile.maxRange = 3500f; projectile.bouncesOffShields = false; projectile.minDetonationTimer = projectile.maxRange / projectile.muzzleVelocity; projectile.maxDetonationTimer = projectile.maxRange / projectile.muzzleVelocity; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Patched Shotty"); } private void sluggerSG(WeaponBlueprint bp) { bp.displayName = "DG-FLC-M1 SLUG"; bp.perceivedRange = 0.1f; bp.perceivedShieldDamage = 0.24f; bp.damage.shieldDamage = 25f; bp.damage.hullDamage = 50f; WeaponSettings weapon = bp.weapon; weapon.spread = 0.1f; weapon.playerSpread = 0.1f; weapon.roundsPerBurst = 1; ProjectileSettings projectile = bp.projectile; projectile.maxRange = 4500f; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Patched Shotty"); } private void bolter(WeaponBlueprint bp, WeaponBlueprint arty) { float num = 0.333f; bp.displayName = "BOLTER"; bp.projectilePrefab = arty.projectilePrefab; bp.muzzleFlashPrefab = arty.muzzleFlashPrefab; bp.perceivedRange = 0.5f; bp.perceivedShieldDamage = 0.25f; bp.damage.shieldDamage = 50f; bp.damage.hullDamage = 200f; WeaponSettings weapon = bp.weapon; weapon.minSpread = 0f; weapon.spread = 0.1f; weapon.playerSpread = 0.1f; weapon.roundsPerBurst = 1; weapon.rateOfFire = num; weapon.minRateOfFire = num; weapon.heatPerRound = 1f; weapon.maxHeat = 3f; weapon.overheatTime = 5f; ProjectileSettings projectile = bp.projectile; projectile.muzzleVelocity = 4500f; projectile.maxRange = 4500f; projectile.rangeDeterminesDetonation = true; CameraSettings camera = bp.camera; camera.shakePerRound = 2.3f; camera.shakeDurationPerRound = num; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Patched in holy bolter"); } private void flakGun(WeaponBlueprint bp) { bp.displayName = "BOFORS DEEZ NUTS"; DamageSettings damage = bp.damage; damage.areaDamageRadius = 200f; damage.hullDamage = 40f; damage.shieldDamage = 35f; damage.subsystemDamage = 10f; WeaponSettings weapon = bp.weapon; weapon.spread = 1f; weapon.playerSpread = 0.2f; weapon.leadTimeModifier = 0.59f; ProjectileSettings projectile = bp.projectile; projectile.isFlak = true; projectile.collisionDelay = 0.017f; projectile.minDetonationTimer = -0.05f; projectile.maxDetonationTimer = 0.05f; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Patched BOFORS"); } private void plasmaBombLauncher(WeaponBlueprint bp) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) bp.displayName = "Plasma Bomber"; DamageSettings damage = bp.damage; damage.areaDamageRadius = 200f; damage.hullDamage = 60f; damage.shieldDamage = 40f; damage.subsystemDamage = 30f; WeaponSettings weapon = bp.weapon; weapon.fireMode = (FireMode)0; weapon.rateOfFire = 0.33f; weapon.minRateOfFire = 0.33f; weapon.overheatTime = 2f; weapon.maxHeat = 6f; weapon.spread = 1f; weapon.playerSpread = 0.2f; weapon.leadTimeModifier = 0.59f; ProjectileSettings projectile = bp.projectile; projectile.maxRange = 4000f; projectile.muzzleVelocity = 1000f; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Patched BOFORS"); } private void plasmaBombLauncher_mk2(WeaponBlueprint bp, WeaponBlueprint donor1) { //IL_0053: 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) bp.displayName = "XVe-08a \"Dessicator\"\nPlasma Bomb Launcher"; bp.description = "Bottled plasma projected at speed using esoteric mechanics privy only to the Emperor himself. Make the traitors feel his wrath even in death."; bp.perceivedHullDamage = 0.9f; bp.perceivedShieldDamage = 0.6f; bp.muzzleFlashPrefab = donor1.muzzleFlashPrefab; bp.projectilePrefab = donor1.projectilePrefab; bp.firingAudioClips = donor1.firingAudioClips; bp.impactType = (ImpactType)3; DamageSettings damage = bp.damage; damage.areaDamageRadius = 50f; damage.hullDamage = 150f; damage.shieldDamage = 100f; damage.subsystemDamage = 30f; WeaponSettings weapon = bp.weapon; weapon.fireMode = (FireMode)1; weapon.rateOfFire = 0.1f; weapon.minRateOfFire = 0.1f; weapon.burstCooldown = 0.66f; weapon.aiIgnoresHeat = false; weapon.heatPerRound = 1f; weapon.maxHeat = 4f; weapon.overheatTime = 4f; weapon.heatDecayPerSecond = 0f; weapon.autoaimAngle = 2f; weapon.spread = 0.2f; weapon.playerSpread = 0.2f; weapon.leadTimeModifier = 0.59f; ProjectileSettings projectile = bp.projectile; projectile.maxRange = 4000f; projectile.muzzleVelocity = 1000f; CameraSettings camera = bp.camera; camera.shakePerRound = 0.45f; camera.shakeDurationPerRound = 2f; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Patched ECM into PlasmaBomb_mk2"); } private void useful_PDS(WeaponBlueprint bp, WeaponBlueprint donor) { //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_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_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_0073: Expected O, but got Unknown //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_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_0091: Expected O, but got Unknown //IL_0093: 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_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Expected O, but got Unknown //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_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Expected O, but got Unknown //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_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_00f4: Expected O, but got Unknown //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Expected O, but got Unknown //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: 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) //IL_0138: Expected O, but got Unknown //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_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Expected O, but got Unknown //IL_0166: Unknown result type (might be due to invalid IL or missing references) bp.displayName = "PR.MK5a Point Defense Cannon"; bp.description = "After the engineers responsible for the PR.MK4 were executed for their failure, their successors were extremely motivated to meet project objectives.\n\nThey delivered."; bp.damage.shieldDamage = 5f; bp.perceivedShieldDamage = 0.3f; bp.projectilePrefab = donor.projectilePrefab; bp.impactType = (ImpactType)1; bp.allowedTargets = (UnitType)820; bp.targetScoreModifiers = new List<TargetScoreModifier> { new TargetScoreModifier { unitType = (UnitType)2, modifier = 200f }, new TargetScoreModifier { unitType = (UnitType)4, modifier = 300f }, new TargetScoreModifier { unitType = (UnitType)128, modifier = -200f }, new TargetScoreModifier { unitType = (UnitType)256, modifier = -200f }, new TargetScoreModifier { unitType = (UnitType)16, modifier = -200f }, new TargetScoreModifier { unitType = (UnitType)512, modifier = -500f }, new TargetScoreModifier { unitType = (UnitType)1024, modifier = -400f }, new TargetScoreModifier { unitType = (UnitType)32, modifier = -100f } }; WeaponSettings weapon = bp.weapon; weapon.fireMode = (FireMode)0; weapon.rateOfFire = 0.14f; weapon.minRateOfFire = 0.13f; weapon.overheatTime = 1f; weapon.maxHeat = 8f; weapon.heatPerRound = 1f; weapon.heatDecayPerSecond = -1f; weapon.aiLeadFactor = 0.99f; weapon.aiLeadFactorSweepTime = 10f; weapon.maxFireTime = 9f; weapon.requiresClearShotOnTarget = true; weapon.aiWillAutoaim = true; weapon.maxAutoAimDistance = 1800f; weapon.roundsPerBurst = 8; weapon.burstCooldown = 0.75f; weapon.lockAngle = 4f; weapon.aiIgnoresHeat = false; weapon.spread = 0.005f; weapon.minSpread = 0.001f; weapon.playerSpread = 0.3f; ProjectileSettings projectile = bp.projectile; projectile.collisionDelay = 0f; projectile.minArmRange = 0f; projectile.minRange = 1f; projectile.maxRange = 1800f; projectile.muzzleVelocity = 2200f; projectile.isFlak = true; projectile.collisionDelay = 0.017f; projectile.minDetonationTimer = -0.05f; projectile.maxDetonationTimer = 0.05f; projectile.bouncesOffShields = true; projectile.steeringMaxSpeed = 100f; bp.perceivedRange = 0.3f; DamageSettings damage = bp.damage; damage.hullDamage = 2f; damage.shieldDamage = 5f; damage.subsystemDamage = 1f; damage.areaDamageRadius = 20f; damage.hullDamageCapitalMultiplier = 1f; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Patched PDC"); } private void improvedDestroyerTorps(WeaponBlueprint bp) { bp.displayName = "AF-2M TORPEDO"; ProjectileSettings projectile = bp.projectile; projectile.steeringMaxSpeed = 1500f; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Patched AF-2 TORPEDO"); } private void modify_interceptor(UnitBlueprint bp, WeaponBlueprint beam) { bp.turretGroups[2].validWeaponBlueprints.Add(beam); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Patched Imp Interceptor"); } private void plasmaBeam(WeaponBlueprint ecm, WeaponBlueprint lance) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) ecm.displayName = "Plasma Beam"; ecm.projectilePrefab = lance.projectilePrefab; DamageSettings damage = ecm.damage; damage.hullDamage = 350f; damage.shieldDamage = 350f; damage.subsystemDamage = 25f; WeaponSettings weapon = ecm.weapon; weapon.fireMode = (FireMode)0; weapon.rateOfFire = 0.13f; weapon.minRateOfFire = 0.09f; weapon.heatDecayPerSecond = 0f; weapon.heatPerRound = 1f; weapon.overheatTime = 2f; weapon.maxHeat = 4f; weapon.spread = 1f; weapon.playerSpread = 0.2f; weapon.leadTimeModifier = 0.59f; ProjectileSettings projectile = ecm.projectile; projectile.minRange = 1f; projectile.maxRange = 1500f; projectile.muzzleVelocity = 9000f; projectile.rangeDeterminesDetonation = true; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Patched ECM into BEAM"); } private void bombsToBeam(WeaponBlueprint bomb, WeaponBlueprint lance) { //IL_0025: 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_00bc: Unknown result type (might be due to invalid IL or missing references) bomb.displayName = "Nightfire Plasma Beam"; bomb.description = "\"In the void,\nthe warmth of a sun for but a moment,\nthen forever cold.\""; bomb.projectilePrefab = lance.projectilePrefab; bomb.impactType = (ImpactType)0; bomb.leadIndicator = null; DamageSettings damage = bomb.damage; damage.hullDamage = 450f; damage.shieldDamage = 450f; damage.subsystemDamage = 25f; WeaponSettings weapon = bomb.weapon; weapon.leadIndicatorType = (LeadIndicatorType)1; weapon.minAttackSpeedFactor = 0f; weapon.burstCooldown = 1f; weapon.roundsPerBurst = 3; weapon.maxAmmo = 6; weapon.roundsOnCollect = 6; weapon.ignoresAimPoint = false; weapon.zeroDistance = 2500f; weapon.aiFiringAngle = 3f; weapon.aiLeadFactorSweepTime = 0.1f; weapon.fireMode = (FireMode)1; weapon.rateOfFire = 0.13f; weapon.minRateOfFire = 0.09f; weapon.threatPerRound = 100f; weapon.heatDecayPerSecond = 0f; weapon.heatPerRound = 1f; weapon.overheatTime = 10f; weapon.maxHeat = 3f; weapon.turretAimSpeedMultiplier = 1f; weapon.minSpread = 0.19f; weapon.spread = 0.2f; weapon.playerSpread = 0.2f; weapon.leadTimeModifier = 0.59f; ProjectileSettings projectile = bomb.projectile; projectile.tumbles = false; projectile.minRange = 1f; projectile.maxRange = 2500f; projectile.muzzleVelocity = 9000f; projectile.rangeDeterminesDetonation = true; projectile.minDetonationTimer = 6f; projectile.maxDetonationTimer = 0f; CameraSettings camera = bomb.camera; camera.shakePerRound = 0.35f; camera.shakeDurationPerRound = 4f; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Patched Bombs into BEAM"); } private void torpToCoilgun(WeaponBlueprint torp, WeaponBlueprint bomb, WeaponBlueprint shotty, WeaponBlueprint arty) { //IL_005b: 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_0168: Unknown result type (might be due to invalid IL or missing references) torp.displayName = "Experimental Coil Gun \"S.I.N\""; torp.description = "When asked by Admirals who S.I.N was, the Emperor would only say \"The meanest son of a bitch in space\". A mystery that he has taken to the grave..."; torp.firingAudioClips = arty.firingAudioClips; torp.interiorFiringClips = arty.interiorFiringClips; torp.projectilePrefab = arty.projectilePrefab; torp.muzzleFlashPrefab = arty.muzzleFlashPrefab; torp.lockTargetCrosshair = null; torp.lockTargetToneCrosshair = null; torp.impactType = (ImpactType)5; torp.crosshair = bomb.crosshair; torp.leadIndicator = bomb.leadIndicator; torp.perceivedHullDamage = 0.95f; torp.perceivedShieldDamage = 0.95f; torp.perceivedRange = 1f; DamageSettings damage = torp.damage; damage.hullDamage = 3750f; damage.shieldDamage = 1500f; damage.subsystemDamage = 100f; damage.areaDamageRadius = 40f; WeaponSettings weapon = torp.weapon; weapon.leadIndicatorType = (LeadIndicatorType)2; weapon.minAttackSpeedFactor = 0f; weapon.burstCooldown = 1f; weapon.roundsPerBurst = 1; weapon.maxAmmo = 2; weapon.roundsOnCollect = 2; weapon.ignoresAimPoint = false; weapon.zeroDistance = 4500f; weapon.aiFiringAngle = 1f; weapon.aiLeadFactor = 1f; weapon.aiLeadFactorSweepTime = 0.1f; weapon.lockTime = -1f; weapon.requiresLock = false; weapon.aiWillAutoaim = true; weapon.ignoresAimPoint = true; weapon.requiresClearShotOnTarget = true; weapon.usesTargetCamera = false; weapon.fireMode = (FireMode)0; weapon.rateOfFire = 1f; weapon.minRateOfFire = 1f; weapon.threatPerRound = 500f; weapon.heatDecayPerSecond = 0f; weapon.heatPerRound = 1f; weapon.overheatTime = 20f; weapon.maxHeat = 1f; weapon.turretAimSpeedMultiplier = 1f; weapon.minSpread = 0.01f; weapon.spread = 0.01f; weapon.playerSpread = 0.01f; weapon.leadTimeModifier = 1f; ProjectileSettings projectile = torp.projectile; projectile.tumbles = false; projectile.minRange = 1f; projectile.maxRange = 18000f; projectile.muzzleVelocity = 4500f; projectile.rangeDeterminesDetonation = true; projectile.collisionDelay = 0f; projectile.noTargetAirburstDelay = 0f; projectile.impactForce = 300f; projectile.steeringForce = 0f; projectile.steeringDrunkenForce = 0f; projectile.steeringMaxSpeed = 0f; projectile.maxSteeringAngle = 0f; projectile.minDetonationTimer = 6f; projectile.maxDetonationTimer = 6f; CameraSettings camera = torp.camera; camera.shakePerRound = 0.65f; camera.shakeDurationPerRound = 2f; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Patched Torp to SIN"); } private void Modify_CampaignGenerationSettings() { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Modify_CampaignGenerationSettings started"); bool flag = (Object)(object)CampaignGenerationSettings.Instance != (Object)null; ((BaseUnityPlugin)this).Logger.LogInfo((object)$"exists: {flag}"); List<WeaponBlueprint> allAvailableWeapons = CampaignGenerationSettings.Instance.allAvailableWeapons; ((BaseUnityPlugin)this).Logger.LogInfo((object)$"blueprints Count {allAvailableWeapons.Count}"); if (configReplaceMissileOption.Value != 0) { WeaponBlueprint val = findWeaponBlueprint(allAvailableWeapons, "wpn_imp_fighter_lightmissile"); if (configReplaceMissileOption.Value == ReplaceMissile.HOBS) { improvedFuryMissiles(val); } else if (configReplaceMissileOption.Value == ReplaceMissile.FEROCITY) { furyRockets(val); } } if (configReplaceBlunderBussWithScattergun.Value) { WeaponBlueprint val2 = findWeaponBlueprint(allAvailableWeapons, "wpn_fed_fighter_shuriken"); WeaponBlueprint val3 = findWeaponBlueprint(allAvailableWeapons, "wpn_imp_fighter_shotgun"); if ((Object)(object)val3 != (Object)null && (Object)(object)val2 != (Object)null) { energySG(val3, val2); } } WeaponBlueprint val4 = findWeaponBlueprint(allAvailableWeapons, "wpn_imp_fighter_automaticrifle"); if (configReplaceAutorifleWithVulcan.Value && (Object)(object)val4 != (Object)null) { vulcanAC_idea2(val4); } if (configReplaceImpCapitalPDS.Value && (Object)(object)val4 != (Object)null) { WeaponBlueprint val5 = findWeaponBlueprint(allAvailableWeapons, "wpn_imp_capital_antifighter"); if ((Object)(object)val5 != (Object)null) { useful_PDS(val5, val4); } } if (configReplaceBombsWithBeam.Value) { WeaponBlueprint val6 = findWeaponBlueprint(allAvailableWeapons, "wpn_imp_frigate_beam"); WeaponBlueprint val7 = findWeaponBlueprint(allAvailableWeapons, "wpn_imp_fighter_unguidedbomb"); if ((Object)(object)val7 != (Object)null && (Object)(object)val6 != (Object)null) { bombsToBeam(val7, val6); } } if (configReplaceECMWithPlasmaBombLauncher.Value) { WeaponBlueprint val8 = findWeaponBlueprint(allAvailableWeapons, "wpn_imp_fighter_ecmbomb"); WeaponBlueprint val9 = findWeaponBlueprint(allAvailableWeapons, "wpn_fed_destroyer_artillery"); if ((Object)(object)val8 != (Object)null) { plasmaBombLauncher(val8); if ((Object)(object)val9 != (Object)null) { plasmaBombLauncher_mk2(val8, val9); } } } if (configReplaceLongRifleWithPPC.Value) { WeaponBlueprint val10 = findWeaponBlueprint(allAvailableWeapons, "wpn_fed_battlecruiser_artillery"); WeaponBlueprint val11 = findWeaponBlueprint(allAvailableWeapons, "wpn_imp_fighter_marksmanrifle"); if ((Object)(object)val11 != (Object)null && (Object)(object)val10 != (Object)null) { longRifleToPPC(val11, val10); } } WeaponBlueprint val12 = findWeaponBlueprint(allAvailableWeapons, "wpn_imp_fighter_torpedo"); if ((Object)(object)val12 != (Object)null) { val12.weapon.maxAmmo = 2; val12.weapon.roundsOnCollect = 2; } } } [HarmonyPatch(typeof(CUITurretHeatDisplay), "OnRenderPolygons")] public class CUITurretHeatDisplay_OnRenderPolygons { private static void Postfix(Material m, Camera cam, CUITurretHeatDisplay __instance) { //IL_0035: 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_004d: Invalid comparison between Unknown and I4 //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: 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_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0122: 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_0126: 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) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) if (__instance.slot > 2) { return; } TurretGroup val = ((Unit)Fighter.player).weaponSystem.turretGroups[__instance.slot]; if ((cam.cullingMask & LayerMask.op_Implicit(__instance.renderLayer)) != 0 && (int)Game.Instance.combatState == 4) { GL.Color(Globals.Instance.uiSettings.cockpitHeatDisplayColor); Color cockpitHeatDisplayColor = Globals.Instance.uiSettings.cockpitHeatDisplayColor; float num = 15f; SteamVR_Camera val2 = ((CentauriCamera)Game.cameras.cockpitCam).steamVRCameras[0]; Vector3 position = ((Component)val2).transform.position; Vector3 forward = ((Component)val2).transform.forward; Vector3 right = ((Component)val2).transform.right; Vector3 up = ((Component)val2).transform.up; Vector3 val3 = Quaternion.AngleAxis(12.5f, right) * forward; Vector3 val4 = Quaternion.AngleAxis(2.5f, up) * val3; Vector3 val5 = Quaternion.AngleAxis(-2.5f, up) * val3; Vector3 val6 = ((__instance.slot == 0) ? val4 : val5); Vector3 val7 = position + val6 * num; bool flag = VrUtils.isPlayerLookingForward(); if ((!flag && val.overheatRemaining <= 0f) || Time.time % (__instance.flashInterval * 2f) > __instance.flashInterval) { __instance.value = ((!__instance.invertValue) ? __instance.value : (1f - __instance.value)); VrUtils.drawHeatCircle(__instance.slot, __instance.value); } if (!flag) { VrUtils.drawHullCircle(); VrUtils.drawShieldCircle(); } VrUtils.drawJoyStickPosCircle(); } } } [HarmonyPatch(typeof(CUICockpitFPVIndicator), "OnPostRenderCockpitLines")] public class CUICockpitFPVIndicator_OnPostRenderCockpitLines { private static bool Prefix(Material m, Camera cam, CUICockpitFPVIndicator __instance) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Invalid comparison between Unknown and I4 //IL_0022: 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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: 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_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_00ca: 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_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_00ef: 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_00f9: 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_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0106: 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_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_018c: 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_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: 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_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: 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_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_021e: 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_022a: Unknown result type (might be due to invalid IL or missing references) //IL_0235: 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_0238: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Fighter.player != (Object)null && (int)Game.Instance.combatState == 4 && (cam.cullingMask & LayerMask.op_Implicit(__instance.layers)) != 0) { SteamVR_Camera val = ((CentauriCamera)Game.cameras.cockpitCam).steamVRCameras[0]; Vector3 position = ((Component)val).transform.position; WeaponSystem weaponSystem = ((Unit)Fighter.player).weaponSystem; float num = 24f; float num2 = 10f; float num3 = 10f; Color val2 = default(Color); ((Color)(ref val2))..ctor(0.2f, 0.7f, 0.2f, 0.7f); Vector3 position2 = ((Unit)Fighter.player).position; Vector3 val3 = ((Unit)Fighter.player).velocity; Vector3 val4 = position2 + ((Vector3)(ref val3)).normalized * 2000f; Vector3 val5 = val4 - ((Component)cam).transform.position; val3 = ((Component)Fighter.player).transform.up; Quaternion val6 = Quaternion.LookRotation(val5, ((Vector3)(ref val3)).normalized); float num4 = 1f; float num5 = Vector3.Angle(val4 - position2, ((Component)Fighter.player).transform.forward); if (num5 > num) { num4 = 0f; } val2.a *= num4; GLRenderer.DrawArc(val4, val4 - ((Component)cam).transform.position, ((Component)cam).transform.up, 0f, 360f, num2, num2, val2, 8); GL.Vertex(val4 + val6 * new Vector3(-1f, 0f, 0f) * num2); GL.Vertex(val4 + val6 * new Vector3(0f - num3, 0f, 0f) * num2); GL.Vertex(val4 + val6 * new Vector3(1f, 0f, 0f) * num2); GL.Vertex(val4 + val6 * new Vector3(num3, 0f, 0f) * num2); Vector3 val7 = val4 - position; Vector3 val8 = weaponSystem.GetZeroPoint() - position; VrUtils.DrawLine(val4, weaponSystem.GetZeroPoint()); } return false; } private static void Postfix(Material m, Camera cam, CUICockpitFPVIndicator __instance) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Invalid comparison between Unknown and I4 //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_0093: 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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: 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_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_020e: 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_0215: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_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_031b: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_0332: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_034f: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)Fighter.player != (Object)null) || (int)Game.Instance.combatState != 4 || !((Object)(object)Game.cameras.activeCam == (Object)(object)Game.cameras.cockpitCam) || (cam.cullingMask & LayerMask.op_Implicit(__instance.layers)) == 0) { return; } SteamVR_Camera val = ((CentauriCamera)Game.cameras.cockpitCam).steamVRCameras[0]; Vector3 position = ((Component)val).transform.position; Vector3 val2 = ((Component)val).transform.up; Vector3 normalized = ((Vector3)(ref val2)).normalized; val2 = ((Component)val).transform.forward; Vector3 normalized2 = ((Vector3)(ref val2)).normalized; if (!VrUtils.isPlayerLookingForward()) { VrUtils.drawPrimaryCircle(); VrUtils.drawSelectedWeaponCircle(); } VrUtils.drawFedMovementVectors(); Fighter player = Fighter.player; if ((Object)(object)player == (Object)null) { return; } Unit target = ((Unit)player).target; if ((Object)(object)target == (Object)null || target.team == ((Unit)player).team) { return; } TurretGroup activeGroup = ((Unit)player).weaponSystem.activeGroup; string name = ((Object)activeGroup.weaponBlueprint).name; if (activeGroup.weaponBlueprint.weapon.requiresLock) { if (name.Equals("wpn_imp_fighter_lightmissile")) { VrUtils.drawHmdLockOnCircle(activeGroup.weaponBlueprint.weapon.lockAngle); } else { VrUtils.drawForwardLockOnCircle(activeGroup.weaponBlueprint.weapon.lockAngle); } return; } VrUtils.drawForwardLockOnCircle(activeGroup.weaponBlueprint.weapon.autoaimAngle); WeaponSystem weaponSystem = ((Unit)Fighter.player).weaponSystem; WeaponBlueprint weaponBlueprint = weaponSystem.activeGroup.weaponBlueprint; float maxRange = weaponBlueprint.projectile.maxRange; Vector3 averageTurretPosition = weaponSystem.activeGroup.averageTurretPosition; Vector3 val3 = ((!weaponBlueprint.projectile.inheritsVelocity) ? Vector3.zero : ((Unit)Fighter.player).velocity); float leadTime = Centauri.GetLeadTime(target.position, target.velocity, averageTurretPosition, val3, weaponSystem.activeGroup.weaponBlueprint.projectile.muzzleVelocity); Vector3 val4 = target.position + target.velocity * leadTime; float num = Vector3.Distance(val4, averageTurretPosition); float num2 = VrUtils.circleRadiusFromAngleAlpha(weaponBlueprint.weapon.playerSpread, num); Color val5 = default(Color); ((Color)(ref val5))..ctor(1f, 1f, 0f, 0.5f); GLRenderer.DrawCircle(val4, normalized2, normalized, num2, num2, val5, 24); float value = 0f; if (num < maxRange * 2f && num > maxRange) { value = 1f - (num - maxRange) / maxRange; } else if (num < maxRange) { value = 1f; } if (VrUtils.isPlayerLookingForward()) { VrUtils.drawForwardRangeArc(activeGroup.weaponBlueprint.weapon.autoaimAngle, value); } else { VrUtils.drawPrimaryCircleRangeArc(value); } Vector3 val6 = val4 - position; Vector3 val7 = weaponSystem.GetZeroPoint() - position; float num3 = Vector3.Angle(val6, val7); if (num3 < 20f) { VrUtils.DrawLine(val4, weaponSystem.GetZeroPoint()); } } } [HarmonyPatch(typeof(WeaponSystem), "Update")] public class WeaponSystem_Update { private static bool Prefix() { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0179: 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_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_01b3: 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_01ba: 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_01c0: 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_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: 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_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: 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_01fe: Unknown result type (might be due to invalid IL or missing references) Fighter player = Fighter.player; if ((Object)(object)player == (Object)null) { return true; } SteamVR_Camera val = ((CentauriCamera)Game.cameras.cockpitCam).steamVRCameras[0]; if ((Object)(object)val == (Object)null) { return true; } Unit target = ((Unit)player).target; if ((Object)(object)target == (Object)null) { return true; } if (target.team == ((Unit)player).team) { return true; } TurretGroup activeGroup = ((Unit)player).weaponSystem.activeGroup; if (activeGroup == null) { return true; } if (activeGroup.overheatRemaining != 0f) { return true; } if (activeGroup.ammo == 0) { return true; } if ((Object)(object)activeGroup.weaponBlueprint == (Object)null) { return true; } if (!((Object)activeGroup.weaponBlueprint).name.Equals("wpn_imp_fighter_lightmissile")) { return true; } float lockTime = activeGroup.weaponBlueprint.weapon.lockTime; if (lockTime <= 0f) { return true; } float num = activeGroup.weaponBlueprint.weapon.lockAngle / 2f; if (num <= 0f) { return true; } float maxRange = activeGroup.maxRange; float num2 = Vector3.Distance(((Unit)player).position, target.position); if (!(num2 < maxRange)) { return true; } Vector3 position = ((Component)val).transform.position; Vector3 offsetPlayerLookVector = VrUtils.getOffsetPlayerLookVector(); Vector3 val2 = position + offsetPlayerLookVector * maxRange - ((CentauriCamera)Game.cameras.cockpitCam).position; Vector3 val3 = target.position - ((CentauriCamera)Game.cameras.cockpitCam).position; float num3 = Vector3.Angle(val3, val2); if (num3 < num) { WeaponSystem weaponSystem = ((Unit)player).weaponSystem; weaponSystem.currentLockTime += Time.deltaTime; } else { ((Unit)player).weaponSystem.currentLockTime = 0f; } if (((Unit)player).weaponSystem.currentLockTime >= lockTime) { activeGroup.lockState = (LockState)2; } else if (((Unit)player).weaponSystem.currentLockTime > 0f) { activeGroup.lockState = (LockState)1; } else { activeGroup.lockState = (LockState)0; } return false; } } [HarmonyPatch(typeof(ControlSystem), "GetUnitUnderCrosshair")] public class ControlSystem_GetUnitUnderCrosshair { private static bool Prefix(ref Unit __result) { if (!VrUtils.isPlayerLookingForward()) { __result = GetUnitUnderHMDCrosshair(); return false; } return true; } private static Unit GetUnitUnderHMDCrosshair() { //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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Invalid comparison between Unknown and I4 //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00af: 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_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: 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_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) Fighter player = Fighter.player; Vector3 offsetPlayerLookVector = VrUtils.getOffsetPlayerLookVector(); float num = 0f; Unit result = null; LinkedListNode<Unit> linkedListNode = Unit.allUnits.First; while (linkedListNode != null) { Unit value = linkedListNode.Value; if (!value.isTargetable || (Object)(object)value == (Object)(object)player) { linkedListNode = linkedListNode.Next; continue; } if ((int)value.unitType == 4096) { linkedListNode = linkedListNode.Next; continue; } if ((int)value.unitType == 2 && value.team == ((Unit)player).team) { linkedListNode = linkedListNode.Next; continue; } Vector3 normalized = ((Vector3)(ref offsetPlayerLookVector)).normalized; Vector3 val = ((Component)value).transform.position - ((CentauriCamera)Game.cameras.cockpitCam).transform.position; float num2 = Vector3.Dot(normalized, ((Vector3)(ref val)).normalized); bool flag = true; Vector3 val2 = value.position - ((Unit)player).position; if (Object.op_Implicit((Object)(object)value.parent) && ((Vector3)(ref val2)).sqrMagnitude > value.parent.maxSubsystemTargetingRange * value.parent.maxSubsystemTargetingRange) { flag = false; } if (value.isTargetable && flag && num2 > num) { num = num2; result = value; } linkedListNode = linkedListNode.Next; } return result; } } [HarmonyPatch(typeof(CUICockpitWingmenStatusTable), "Awake")] public class CUICockpitWingmenStatusTable_Awake { private static bool Prefix(CUICockpitWingmenStatusTable __instance) { Transform transform = ((Component)((Component)__instance.wingmenPanel).transform.parent).transform; Transform transform2 = ((Component)__instance.capitalPanel).transform; VrUtils.changeCapitalsPanelTransform(transform2); VrUtils.changeWingmenPanelTransform(transform); return true; } } [HarmonyPatch(typeof(CUICockpitWingmenStatusTable), "LateUpdate")] public class CUICockpitWingmenStatusTable_LateUpdate { private static bool Prefix(CUICockpitWingmenStatusTable __instance) { Transform transform = ((Component)((Component)__instance.capitalPanel).transform.parent).transform; VrUtils.changeFleetStatusTransform(transform); return true; } } [HarmonyPatch(typeof(CUICockpitOffscreenIndicator), "GetRotation")] public class CUICockpitOffscreenIndicator_GetRotation { private static bool Prefix(ref Quaternion __result) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) if (VrUtils.isPlayerLookingForward()) { return true; } __result = Quaternion.LookRotation(VrUtils.primaryHmdVector, ((Unit)Fighter.player).target.position - ((Unit)Fighter.player).position); return false; } } [HarmonyPatch(typeof(CUICockpitOffscreenIndicator), "GetProjectedPos")] public class CUICockpitOffscreenIndicator_GetProjectedPos { private static bool Prefix(ref Vector3 __result) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: 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_003b: 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_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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) if (VrUtils.isPlayerLookingForward()) { return true; } Vector3 cockpitCameraPosition = ((Unit)Fighter.player).weaponSystem.cockpitCameraPosition; Vector3 primaryHmdPosition = VrUtils.primaryHmdPosition; Vector3 val = primaryHmdPosition - cockpitCameraPosition; Vector3 val2 = ((Vector3)(ref val)).normalized * 2000f; __result = val2 + cockpitCameraPosition; return false; } } [HarmonyPatch(typeof(TurretGroup), "AddHeat")] public class TurretGroup_AddHeat { private static bool Prefix(TurretGroup __instance, ref float rawHeat) { rawHeat *= __instance.unit.weaponSystem.statHeatGenerationMultiplier; __instance.heat += rawHeat; if (__instance.heat >= __instance.weaponBlueprint.weapon.maxHeat - 0.01f) { if (WeaponSystem.allowAutomaticReload) { __instance.Overheat(); } if (__instance.weaponBlueprint.shortName.Equals("PPC")) { __instance.Overheat(); } } Messenger<Unit, float>.Broadcast("OnHeatAdded", __instance.unit, __instance.heat); return false; } } [HarmonyPatch(typeof(HUDIconPriorityTarget), "RenderWidget")] public class HUDIconPriorityTarget_RenderWidget { private static bool Prefix(HUDIconPriorityTarget __instance) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_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_0034: Expected I4, but got Unknown PriorityTargetIconType priorityIconType = __instance.priorityIconType; if (1 == 0) { } bool result = (priorityIconType - 6) switch { 0 => false, 1 => false, 2 => false, 3 => false, 4 => false, 5 => false, 6 => false, 7 => false, _ => true, }; if (1 == 0) { } return result; } } [HarmonyPatch(typeof(CUIVitalityBar), "DrawBar")] public class CUIVitalityBar_DrawBar { private static bool Prefix(Vector3 pos, Quaternion facing, float value, Color filledColor, Color emptyColor, CUIVitalityBar __instance) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Invalid comparison between Unknown and I4 //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_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_0053: 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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_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_008d: 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_0099: 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_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) //IL_00b3: 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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: 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_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: 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_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0122: 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_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) if ((int)Game.Instance.combatState != 4) { return true; } float widgetScale = __instance.widgetScale; float barHeight = __instance.barHeight; float barWidth = __instance.barWidth; float num = barHeight * 0.5f; float num2 = barWidth * value; Vector3 val = pos - VrUtils.VRCamPosition; Vector3 normalized = ((Vector3)(ref val)).normalized; Quaternion val2 = Quaternion.LookRotation(normalized, VrUtils.VRCamUp); GL.Color(filledColor); GL.Vertex(pos + val2 * (new Vector3(0f, num, 0f) * widgetScale)); GL.Vertex(pos + val2 * (new Vector3(num2, num, 0f) * widgetScale)); GL.Vertex(pos + val2 * (new Vector3(num2, 0f - num, 0f) * widgetScale)); GL.Vertex(pos + val2 * (new Vector3(0f, 0f - num, 0f) * widgetScale)); GL.Color(emptyColor); GL.Vertex(pos + val2 * (new Vector3(num2, num, 0f) * widgetScale)); GL.Vertex(pos + val2 * (new Vector3(barWidth, num, 0f) * widgetScale)); GL.Vertex(pos + val2 * (new Vector3(barWidth, 0f - num, 0f) * widgetScale)); GL.Vertex(pos + val2 * (new Vector3(num2, 0f - num, 0f) * widgetScale)); return false; } } internal static class VrUtils { private static readonly float hmdRenderDistance = 45f; private static readonly float hudRenderDistance = 20f; private static readonly float hudHmdSwitchAngle = 5f; private static readonly float primaryHmdCircleAlpha = 1.203f; private static readonly float primaryHmdCircleRadius = circleRadiusFromAngleAlpha(primaryHmdCircleAlpha); private static readonly float secondaryHmdCircleAlpha = 0.6531f; private static readonly float secondaryHmdCircleRadius = circleRadiusFromAngleAlpha(secondaryHmdCircleAlpha); private static Color primaryHmdColor = new Color(0.941f, 0.392f, 0f, 1f); private static Color hudGreen = new Color(0.2f, 0.7f, 0.2f, 0.5f); private static Color hullGreen = new Color(0.2f, 1f, 0.2f, 1f); private static Color shieldBlue = new Color(0.2f, 0.6f, 1f, 1f); private static Color fedBlue = new Color(0f, 0.392f, 0.941f, 1f); private static Color dangerRed = new Color(1f, 0.1f, 0.1f, 1f); private static Color leadPointColor = new Color(1f, 1f, 0f, 0.5f); private static SteamVR_Camera VRCam => ((CentauriCamera)Game.cameras.cockpitCam).steamVRCameras[0]; public static Vector3 VRCamPosition => ((Component)VRCam).transform.position; public static Vector3 VRCamForward => ((Component)VRCam).transform.forward; public static Vector3 VRCamRight => ((Component)VRCam).transform.right; public static Vector3 VRCamUp => ((Component)VRCam).transform.up; public static Quaternion VRCamRot => ((Component)VRCam).transform.rotation; public static Vector3 primaryHmdVector { get { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Quaternion.AngleAxis(10f, VRCamRight) * VRCamForward; return ((Vector3)(ref val)).normalized; } } private static Vector3 primaryHmdVectorLeft { get { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Quaternion.AngleAxis(-15f, VRCamUp) * VRCamForward; return ((Vector3)(ref val)).normalized; } } private static Vector3 primaryHmdVectorRight { get { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Quaternion.AngleAxis(15f, VRCamUp) * VRCamForward; return ((Vector3)(ref val)).normalized; } } private static Vector3 secondaryHmdVector { get { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Quaternion.AngleAxis(12.5f, VRCamRight) * VRCamForward; return ((Vector3)(ref val)).normalized; } } private static Vector3 secondaryHmdVectorLeft { get { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Quaternion.AngleAxis(-2.5f, VRCamUp) * secondaryHmdVector; return ((Vector3)(ref val)).normalized; } } private static Vector3 secondaryHmdVectorRight { get { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Quaternion.AngleAxis(2.5f, VRCamUp) * secondaryHmdVector; return ((Vector3)(ref val)).normalized; } } private static Vector3 secondaryHmdVectorBottom { get { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Quaternion.AngleAxis(0.5f, VRCamRight) * secondaryHmdVector; return ((Vector3)(ref val)).normalized; } } public static Vector3 primaryHmdPosition => VRCamPosition + primaryHmdVector * hmdRenderDistance; private static Vector3 primaryHmdLeftPosition => VRCamPosition + primaryHmdVectorLeft * hmdRenderDistance; private static Vector3 primaryHmdRightPosition => VRCamPosition + primaryHmdVectorRight * hmdRenderDistance; private static Vector3 secondaryHmdLeftPosition => VRCamPosition + secondaryHmdVectorLeft * hmdRenderDistance; private static Vector3 secondaryHmdRightPosition => VRCamPosition + secondaryHmdVectorRight * hmdRenderDistance; private static Vector3 secondaryHmdBottomPosition => VRCamPosition + secondaryHmdVectorBottom * hmdRenderDistance; private static Vector3 playerFighterPosition => ((Unit)Fighter.player).position; private static Vector3 playerFighterForward { get { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) Ray ray = ((CentauriCamera)Game.cameras.cockpitCam).GetRay(); return ((Ray)(ref ray)).direction; } } private static Vector3 playerFighterUp { get { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) Vector3 up = ((Component)Fighter.player).transform.up; return ((Vector3)(ref up)).normalized; } } private static Vector3 playerFighterHullForward { get { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) Vector3 forward = ((Component)Fighter.player).transform.forward; return ((Vector3)(ref forward)).normalized; } } private static Vector3 playerFighterHudZeroPoint => VRCamPosition + playerFighterForward * hudRenderDistance; private static float circleRadiusFromAngleTheta(float angleTheta) { float angleAlpha = (float)((double)angleTheta / 2.0); return circleRadiusFromAngleAlpha(angleAlpha); } public static float circleRadiusFromAngleAlpha(float angleAlpha) { double a = (double)angleAlpha * (Math.PI / 180.0); float num = hmdRenderDistance; return (float)((double)num * Math.Sin(a)); } public static float circleRadiusFromAngleAlpha(float angleAlpha, float distance) { double a = (double)angleAlpha * (Math.PI / 180.0); return (float)((double)distance * Math.Sin(a)); } public static Vector3 getOffsetPlayerLookVector() { //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_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) return Quaternion.AngleAxis(10f, VRCamRight) * VRCamForward; } public static float getAngleBetweenPLV_VectorPosition(Vector3 vectorPosition) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_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) Vector3 offsetPlayerLookVector = getOffsetPlayerLookVector(); return Vector3.Angle(offsetPlayerLookVector, vectorPosition); } public static bool isPlayerLookingForward() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) float angleBetweenPLV_VectorPosition = getAngleBetweenPLV_VectorPosition(playerFighterHullForward); if (angleBetweenPLV_VectorPosition < hudHmdSwitchAngle) { return true; } return false; } public static void drawPrimaryCircle() { //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_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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) float num = 1.5f; Color val = primaryHmdColor; GLRenderer.DrawCircle(primaryHmdPosition, primaryHmdVector, VRCamUp, num, num, val, 32); } public static void drawPrimaryCircleRangeArc(float value) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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) float num = 1.5f; float num2 = value * 360f; GLRenderer.DrawArc(primaryHmdPosition, primaryHmdVector, VRCamRight, 1f, num2, num * 1.03f, num * 1.03f, new Color(1f, 1f, 0f, 0.5f), 20); } public static void drawHmdLockOnCircle(float lockOnAngleTheta) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: 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) float num = circleRadiusFromAngleTheta(lockOnAngleTheta); Color val = primaryHmdColor; GLRenderer.DrawCircle(primaryHmdPosition, primaryHmdVector, VRCamUp, num, num, val, 32); } public static void drawHmdLockOnCircleFilled(float lockOnAngleTheta) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) float num = circleRadiusFromAngleTheta(lockOnAngleTheta); Color val = primaryHmdColor; GLRenderer.DrawFilledPolygonCircle(primaryHmdPosition, primaryHmdVector, VRCamUp, 64, 100f, num, num * 1.005f, val, Color.clear); } public static void drawForwardLockOnCircle(float lockOnAngleTheta) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) float num = circleRadiusFromAngleAlpha(lockOnAngleTheta); Color val = primaryHmdColor; Vector3 val2 = VRCamPosition + playerFighterHullForward * hmdRenderDistance; GLRenderer.DrawCircle(val2, playerFighterHullForward, playerFighterUp, num, num, val, 32); } public static void drawForwardRangeArc(float lockOnAngleTheta, float value) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: 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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) float num = circleRadiusFromAngleAlpha(lockOnAngleTheta); Vector3 val = VRCamPosition + playerFighterHullForward * hmdRenderDistance; float num2 = value * 360f; GLRenderer.DrawArc(val, playerFighterHullForward, playerFighterUp, 1f, num2, num * 1.03f, num * 1.03f, new Color(1f, 1f, 0f, 0.5f), 32); } public static void drawForwardLockOnCircleFilled(float lockOnAngleTheta) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_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) float num = circleRadiusFromAngleAlpha(lockOnAngleTheta); Color val = primaryHmdColor; Vector3 val2 = VRCamPosition + playerFighterHullForward * hmdRenderDistance; GLRenderer.DrawFilledPolygonCircle(val2, playerFighterForward, VRCamUp, 64, 100f, num, num * 1.01f, val, Color.clear); } public static void drawSelectedWeaponCircle() { //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_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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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_0052: Unknown result type (might be due to invalid IL or missing references) int activeGroupIndex = ((Unit)Fighter.player).weaponSystem.activeGroupIndex; if (activeGroupIndex >= 0 && activeGroupIndex < 4) { Vector3 val = (Vector3)(activeGroupIndex switch { 1 => secondaryHmdLeftPosition, 2 => secondaryHmdBottomPosition, _ => secondaryHmdRightPosition, }); float num = secondaryHmdCircleRadius * 1.2f; Color val2 = primaryHmdColor; GLRenderer.DrawCircle(val, primaryHmdVector, VRCamUp, num, num, val2, 32); } } public static void drawHeatCircle(int slot, float value) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) if (slot >= 0 && slot < 3) { Vector3 val = ((slot != 0) ? secondaryHmdLeftPosition : secondaryHmdRightPosition); float num = secondaryHmdCircleRadius; Color cockpitHeatDisplayColor = Globals.Instance.uiSettings.cockpitHeatDisplayColor; GLRenderer.DrawFilledPolygonCircle(val, primaryHmdVector, VRCamRight, 20, value, num * 0.6f, num * 1.1f, cockpitHeatDisplayColor, Color.clear); } } public static void drawRangeCircle() { //IL_0033: 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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0095: 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_009a: 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_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_00aa: 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_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: 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_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) Fighter player = Fighter.player; if ((Object)(object)player == (Object)null) { return; } Unit target = ((Unit)player).target; if (!((Object)(object)target == (Object)null) && target.team != ((Unit)player).team) { WeaponSystem weaponSystem = ((Unit)Fighter.player).weaponSystem; WeaponBlueprint weaponBlueprint = weaponSystem.activeGroup.weaponBlueprint; float maxRange = weaponBlueprint.projectile.maxRange; Vector3 averageTurretPosition = weaponSystem.activeGroup.averageTurretPosition; Vector3 val = ((!weaponBlueprint.projectile.inheritsVelocity) ? Vector3.zero : ((Unit)Fighter.player).velocity); float leadTime = Centauri.GetLeadTime(target.position, target.velocity, averageTurretPosition, val, weaponSystem.activeGroup.weaponBlueprint.projectile.muzzleVelocity); Vector3 val2 = target.position + target.velocity * leadTime; float num = Vector3.Distance(val2, averageTurretPosition); float num2 = circleRadiusFromAngleAlpha(3f, num); float num3 = 0f; if (num < maxRange * 2f && num > maxRange) { num3 = 1f - (num - maxRange) / maxRange; } else if (num < maxRange) { num3 = 1f; } GLRenderer.DrawArc(val2, VRCamForward, VRCamRight, 0f, 90f, num2 * 1.15f, num2 * 1.15f, new Color(1f, 1f, 0f, 0.5f), 20); } } public static void drawHullCircle() { //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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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_003e: Unknown result type (might be due to invalid IL or missing references) float num = secondaryHmdCircleRadius; Color val = hullGreen; float strength = ((Unit)Fighter.player).hull.strength; GLRenderer.DrawFilledPolygonCircle(secondaryHmdBottomPosition, primaryHmdVector, VRCamRight, 20, strength, num * 0.4f, num * 0.7f, val, Color.clear); } public static void drawShieldCircle() { //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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: 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) float num = secondaryHmdCircleRadius; Color val = shieldBlue; if (((Behaviour)((Unit)Fighter.player).shields).enabled) { float strength = ((Unit)Fighter.player).shields.strength; GLRenderer.DrawFilledPolygonCircle(secondaryHmdBottomPosition, primaryHmdVector, VRCamRight, 20, strength, num * 0.9f, num * 1f, val, Color.clear); } } public static void drawJoyStickPosCircle() { //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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_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_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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_0051: 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_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //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_008d: Unknown result type (might be due to invalid IL or missing