using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Logging;
using EngineerRedux.States.Engi;
using EngineerRedux.States.Turret;
using EngineerRedux.Utils;
using EntityStates;
using EntityStates.Engi.EngiWeapon;
using EntityStates.EngiTurret.EngiTurretWeapon;
using Microsoft.CodeAnalysis;
using R2API;
using R2API.Utils;
using RoR2;
using RoR2.Projectile;
using RoR2.Skills;
using UnityEngine;
using UnityEngine.AddressableAssets;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("EngineerRedux")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+ae08499602dc923810faa45299afe3361b92d68d")]
[assembly: AssemblyProduct("EngineerRedux")]
[assembly: AssemblyTitle("EngineerRedux")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.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;
}
}
}
internal static class Log
{
internal static ManualLogSource logSource;
internal static void Init(ManualLogSource logSource)
{
Log.logSource = logSource;
}
internal static void Debug(object data)
{
logSource.LogDebug(data);
}
internal static void Error(object data)
{
logSource.LogError(data);
}
internal static void Fatal(object data)
{
logSource.LogFatal(data);
}
internal static void Info(object data)
{
logSource.LogInfo(data);
}
internal static void Message(object data)
{
logSource.LogMessage(data);
}
internal static void Warning(object data)
{
logSource.LogWarning(data);
}
}
namespace EngineerRedux
{
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
[BepInPlugin("Saik.EngineerRedux", "EngineerRedux", "1.0.4")]
public class EngineerReduxPlugin : BaseUnityPlugin
{
public const string PluginGUID = "Saik.EngineerRedux";
public const string PluginAuthor = "Saik";
public const string PluginName = "EngineerRedux";
public const string PluginVersion = "1.0.4";
public static EngineerReduxPlugin Instance;
private void Awake()
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: 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_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_0158: 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_017c: Unknown result type (might be due to invalid IL or missing references)
//IL_019a: Unknown result type (might be due to invalid IL or missing references)
//IL_019f: Unknown result type (might be due to invalid IL or missing references)
//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
//IL_01ed: 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_02b4: Unknown result type (might be due to invalid IL or missing references)
//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
//IL_0319: Unknown result type (might be due to invalid IL or missing references)
//IL_0356: Unknown result type (might be due to invalid IL or missing references)
//IL_035b: Unknown result type (might be due to invalid IL or missing references)
//IL_0367: Unknown result type (might be due to invalid IL or missing references)
//IL_036c: Unknown result type (might be due to invalid IL or missing references)
//IL_038b: Unknown result type (might be due to invalid IL or missing references)
//IL_03bb: Unknown result type (might be due to invalid IL or missing references)
//IL_041e: Unknown result type (might be due to invalid IL or missing references)
//IL_0423: Unknown result type (might be due to invalid IL or missing references)
//IL_042f: Unknown result type (might be due to invalid IL or missing references)
//IL_0434: Unknown result type (might be due to invalid IL or missing references)
//IL_0453: Unknown result type (might be due to invalid IL or missing references)
Instance = this;
Log.Init(((BaseUnityPlugin)this).Logger);
SkillManager.Init();
UnlockableDef unlockableDef = Addressables.LoadAssetAsync<UnlockableDef>((object)"RoR2/Base/Engi/Skills.Engi.WalkerTurret.asset").WaitForCompletion();
SteppedSkillDef val = ScriptableObject.CreateInstance<SteppedSkillDef>();
((SkillDef)val).activationStateMachineName = "Weapon";
((SkillDef)val).beginSkillCooldownOnSkillEnd = true;
((SkillDef)val).canceledFromSprinting = true;
((SkillDef)val).cancelSprintingOnActivation = true;
((SkillDef)val).interruptPriority = (InterruptPriority)0;
((SkillDef)val).baseRechargeInterval = 0f;
((SkillDef)val).rechargeStock = 0;
((SkillDef)val).requiredStock = 0;
((SkillDef)val).stockToConsume = 0;
EngineerRedux.States.Engi.GaussPrimaryState.Init();
((SkillDef)val).activationState = new SerializableEntityStateType(typeof(EngineerRedux.States.Engi.GaussPrimaryState));
((SkillDef)val).icon = Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/Commando/CommandoBodyFirePistol.asset").WaitForCompletion().icon;
val.stepCount = 2;
val.stepGraceDuration = 3f;
bool flag = default(bool);
ContentAddition.AddEntityState(typeof(EngineerRedux.States.Engi.GaussPrimaryState), ref flag);
SkillManager.AddEngiPrimary((SkillDef)(object)val, "GaussCannon", "Fire <style=cIsDamage>2x70% damage</style> bullets, 3 times per second.");
SkillDef val2 = ScriptableObject.CreateInstance<SkillDef>();
val2.activationStateMachineName = "Weapon";
((SkillDef)val).beginSkillCooldownOnSkillEnd = true;
val2.canceledFromSprinting = true;
val2.cancelSprintingOnActivation = true;
val2.interruptPriority = (InterruptPriority)0;
val2.baseRechargeInterval = 0f;
val2.rechargeStock = 0;
val2.requiredStock = 0;
val2.stockToConsume = 0;
EngineerRedux.States.Engi.BeamPrimaryState.Init();
val2.activationState = new SerializableEntityStateType(typeof(EngineerRedux.States.Engi.BeamPrimaryState));
val2.icon = Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/Commando/CommandoBodyFireFMJ.asset").WaitForCompletion().icon;
ContentAddition.AddEntityState(typeof(EngineerRedux.States.Engi.BeamPrimaryState), ref flag);
SkillManager.AddEngiPrimary(val2, "LaserBeam", "Fire two continuous lasers that deal <style=cIsDamage>2x40% damage</style>, 5 times per second. <style=cIsUtility>Slows</style> enemies by <style=cIsUtility>50%</style> on hit.", unlockableDef);
SkillDef skillDef = Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/Engi/EngiBodyPlaceTurret.asset").WaitForCompletion();
TurretBodyStats turretBodyStats = new TurretBodyStats(195f, 58.5f, 0.9f, 0.18f, 30f, 0f);
SkillManager.AddEngiTurretBody(skillDef, "StationaryTurret", "Summon a stationary turret with <style=cIsUtility>High health</style>, but <style=cIsUtility>cannot move</style>.", turretBodyStats);
SkillDef skillDef2 = Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/Engi/EngiBodyPlaceWalkerTurret.asset").WaitForCompletion();
TurretBodyStats turretBodyStats2 = new TurretBodyStats(130f, 39f, 0.6f, 0.12f, 0f, 8f);
SkillManager.AddEngiTurretBody(skillDef2, "MobileTurret", "Summon a mobile turret with <style=cIsUtility>decent health and movement</style>.", turretBodyStats2, unlockableDef);
SkillDef val3 = ScriptableObject.CreateInstance<SkillDef>();
val3.activationStateMachineName = "Weapon";
val3.interruptPriority = (InterruptPriority)0;
val3.baseRechargeInterval = 2f;
val3.attackSpeedBuffsRestockSpeed = true;
val3.baseMaxStock = 4;
val3.rechargeStock = 4;
val3.requiredStock = 1;
val3.stockToConsume = 1;
val3.dontAllowPastMaxStocks = true;
val3.beginSkillCooldownOnSkillEnd = true;
val3.canceledFromSprinting = false;
val3.cancelSprintingOnActivation = false;
EngineerRedux.States.Turret.GrenadePrimaryState.Init();
val3.activationState = new SerializableEntityStateType(typeof(EngineerRedux.States.Turret.GrenadePrimaryState));
val3.icon = Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/Engi/EngiBodyFireGrenade.asset").WaitForCompletion().icon;
ContentAddition.AddEntityState(typeof(EngineerRedux.States.Turret.GrenadePrimaryState), ref flag);
SkillManager.AddEngiTurretWeapon(val3, "TurretGrenadeLauncher", "Charge up to 4 grenades, dealing <style=cIsDamage>100% damage</style> each.");
SkillDef val4 = ScriptableObject.CreateInstance<SkillDef>();
val4.activationStateMachineName = "Weapon";
val4.interruptPriority = (InterruptPriority)0;
val4.fullRestockOnAssign = true;
val4.beginSkillCooldownOnSkillEnd = false;
val4.canceledFromSprinting = false;
val4.cancelSprintingOnActivation = false;
val4.baseRechargeInterval = 0f;
val4.activationState = new SerializableEntityStateType(typeof(EngineerRedux.States.Turret.GaussPrimaryState));
val4.icon = Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/Commando/CommandoBodyFirePistol.asset").WaitForCompletion().icon;
ContentAddition.AddEntityState(typeof(EngineerRedux.States.Turret.GaussPrimaryState), ref flag);
SkillManager.AddEngiTurretWeapon(val4, "TurretGaussCannon", "Fire <style=cIsDamage>70% damage</style> bullets, 3 times per second.", null, isDefaultVariant: true);
SkillDef val5 = ScriptableObject.CreateInstance<SkillDef>();
val5.activationStateMachineName = "Weapon";
val5.interruptPriority = (InterruptPriority)0;
val5.fullRestockOnAssign = true;
val5.beginSkillCooldownOnSkillEnd = false;
val5.canceledFromSprinting = false;
val5.cancelSprintingOnActivation = true;
val5.baseRechargeInterval = 0f;
val5.baseMaxStock = 1;
val5.rechargeStock = 1;
val5.requiredStock = 1;
val5.stockToConsume = 1;
EngineerRedux.States.Turret.BeamPrimaryState.Init();
val5.activationState = new SerializableEntityStateType(typeof(EngineerRedux.States.Turret.BeamPrimaryState));
val5.icon = Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/Commando/CommandoBodyFireFMJ.asset").WaitForCompletion().icon;
ContentAddition.AddEntityState(typeof(EngineerRedux.States.Turret.BeamPrimaryState), ref flag);
SkillManager.AddEngiTurretWeapon(val5, "TurretLaserBeam", "Fire a continuous laser that deals <style=cIsDamage>40% damage</style>, 5 times per second. <style=cIsUtility>Slows</style> enemies by <style=cIsUtility>50%</style> on hit.", unlockableDef);
}
}
}
namespace EngineerRedux.Utils
{
public static class SkillManager
{
private static GameObject engiBodyPrefab;
private static SkillLocator engiSkillLocator;
private static SkillFamily engiPrimarySkillFamily;
private static SkillFamily engiSpecialSkillFamily;
private static SkillFamily engiTurretWeaponSkillFamily;
private static GameObject turretBodyPrefab;
private static SkillLocator turretSkillLocator;
private static SkillFamily turretPrimarySkillFamily;
public static void Init()
{
//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_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_00d0: 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_00d8: 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_0103: Unknown result type (might be due to invalid IL or missing references)
Log.Info("Initializing SkillManager");
engiBodyPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Engi/EngiBody.prefab").WaitForCompletion();
turretBodyPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Engi/EngiTurretBody.prefab").WaitForCompletion();
engiSkillLocator = engiBodyPrefab.GetComponent<SkillLocator>();
turretSkillLocator = turretBodyPrefab.GetComponent<SkillLocator>();
engiPrimarySkillFamily = engiSkillLocator.primary.skillFamily;
engiSpecialSkillFamily = engiSkillLocator.special.skillFamily;
turretPrimarySkillFamily = turretSkillLocator.primary.skillFamily;
engiTurretWeaponSkillFamily = CreateSkillFamily(engiBodyPrefab, "TurretWeapon", "ENGI_REDUX_TURRET_WEAPON_SLOT");
ContentAddition.AddSkillFamily(engiTurretWeaponSkillFamily);
Variant[] array = Array.Empty<Variant>();
Variant[] variants = engiSpecialSkillFamily.variants;
foreach (Variant val in variants)
{
if (val.skillDef is TurretBodySkillDef)
{
Array.Resize(ref array, array.Length + 1);
array[^1] = val;
}
}
engiSpecialSkillFamily.variants = array;
MasterSummon.onServerMasterSummonGlobal += OnServerMasterSummonGlobal;
}
public static SkillFamily CreateSkillFamily(GameObject bodyPrefab, string skillFamilyName, string skillSlotToken)
{
Log.Debug("Creating skill family " + skillFamilyName + ".");
SkillFamily val = ScriptableObject.CreateInstance<SkillFamily>();
((Object)val).name = ((Object)bodyPrefab).name + skillFamilyName;
val.variants = Array.Empty<Variant>();
GenericSkill val2 = bodyPrefab.AddComponent<GenericSkill>();
val2.skillName = skillFamilyName;
val2.hideInCharacterSelect = true;
val2._skillFamily = val;
if (!string.IsNullOrEmpty(skillSlotToken))
{
val2.loadoutTitleToken = skillSlotToken;
string text = Regex.Replace(skillFamilyName, "(\\B[A-Z])", " $1");
LanguageAPI.Add(skillSlotToken, text);
}
return val;
}
public static SkillFamily AddSkillToFamily(SkillDef skillDef, SkillFamily skillFamily, UnlockableDef unlockableDef = null, bool isDefaultVariant = false)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Expected O, but got Unknown
//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_00b3: 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)
Log.Debug($"Adding skill {skillDef.skillName} to skill family index {skillFamily.catalogIndex}.");
Variant val = default(Variant);
val.skillDef = skillDef;
((Variant)(ref val)).viewableNode = new Node(skillDef.skillNameToken, false, (Node)null);
Variant val2 = val;
if ((Object)(object)unlockableDef == (Object)null)
{
val2.unlockableName = string.Empty;
}
else
{
val2.unlockableDef = unlockableDef;
}
Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1);
if (skillFamily.variants.Length < 1)
{
throw new InvalidOperationException("Skill family variants array has invalid length after resizing. This should never happen.");
}
uint num = (uint)(skillFamily.variants.Length - 1);
skillFamily.variants[num] = val2;
if (isDefaultVariant)
{
skillFamily.defaultVariantIndex = num;
}
return skillFamily;
}
public static void AddLanguageTokens(SkillDef skillDef, string skillName, string skillDescription)
{
Log.Debug("Adding language tokens for skill " + skillName + ".");
if (!string.IsNullOrEmpty(skillName) && !string.IsNullOrEmpty(skillDescription))
{
string text = "ENGI_REDUX_" + Regex.Replace(skillName, "(\\B[A-Z])", "_$1").ToUpper() + "_NAME";
string text2 = "ENGI_REDUX_" + Regex.Replace(skillName, "(\\B[A-Z])", "_$1").ToUpper() + "_DESC";
skillDef.skillName = text;
skillDef.skillNameToken = text;
skillDef.skillDescriptionToken = text2;
string text3 = Regex.Replace(skillName, "(\\B[A-Z])", " $1");
LanguageAPI.Add(text, text3);
LanguageAPI.Add(text2, skillDescription);
}
}
public static SkillDef AddEngiPrimary(SkillDef skillDef, string skillName, string skillDescription, UnlockableDef unlockableDef = null, bool isDefaultVariant = false)
{
Log.Debug("Adding primary skill " + skillName + " to Engi's loadout.");
if (!Object.op_Implicit((Object)(object)engiBodyPrefab) || !Object.op_Implicit((Object)(object)engiSkillLocator) || !Object.op_Implicit((Object)(object)engiPrimarySkillFamily))
{
Init();
}
if (string.IsNullOrWhiteSpace(skillDef.activationStateMachineName))
{
skillDef.activationStateMachineName = "Weapon";
}
if (!string.IsNullOrEmpty(skillName) && !string.IsNullOrEmpty(skillDescription))
{
AddLanguageTokens(skillDef, skillName, skillDescription);
}
AddSkillToFamily(skillDef, engiPrimarySkillFamily, unlockableDef, isDefaultVariant);
ContentAddition.AddSkillDef(skillDef);
return skillDef;
}
public static SkillDef AddEngiTurretWeapon(SkillDef turretSkillDef, string skillName, string skillDescription, UnlockableDef unlockableDef = null, bool isDefaultVariant = false)
{
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
Log.Debug("Adding turret weapon skill " + skillName + " to Engi's loadout.");
if (!Object.op_Implicit((Object)(object)engiBodyPrefab) || !Object.op_Implicit((Object)(object)engiSkillLocator) || !Object.op_Implicit((Object)(object)engiTurretWeaponSkillFamily) || !Object.op_Implicit((Object)(object)turretPrimarySkillFamily))
{
Init();
}
if (string.IsNullOrEmpty(turretSkillDef.activationStateMachineName))
{
turretSkillDef.activationStateMachineName = "Weapon";
}
TurretWeaponSkillDef turretWeaponSkillDef = ScriptableObject.CreateInstance<TurretWeaponSkillDef>();
((SkillDef)turretWeaponSkillDef).icon = turretSkillDef.icon;
((SkillDef)turretWeaponSkillDef).skillName = turretSkillDef.skillName;
((SkillDef)turretWeaponSkillDef).skillNameToken = turretSkillDef.skillNameToken;
((SkillDef)turretWeaponSkillDef).skillDescriptionToken = turretSkillDef.skillDescriptionToken;
((SkillDef)turretWeaponSkillDef).keywordTokens = turretSkillDef.keywordTokens;
turretWeaponSkillDef.SetSelectedPrimarySkillDef(turretSkillDef);
((SkillDef)turretWeaponSkillDef).activationState = new SerializableEntityStateType(typeof(Idle));
((SkillDef)turretWeaponSkillDef).activationStateMachineName = "Weapon";
if (!string.IsNullOrEmpty(skillName) && !string.IsNullOrEmpty(skillDescription))
{
AddLanguageTokens((SkillDef)(object)turretWeaponSkillDef, skillName, skillDescription);
}
AddSkillToFamily((SkillDef)(object)turretWeaponSkillDef, engiTurretWeaponSkillFamily, unlockableDef);
AddSkillToFamily(turretSkillDef, turretPrimarySkillFamily);
ContentAddition.AddSkillDef((SkillDef)(object)turretWeaponSkillDef);
ContentAddition.AddSkillDef(turretSkillDef);
return (SkillDef)(object)turretWeaponSkillDef;
}
public static SkillDef AddEngiTurretBody(SkillDef skillDef, string skillName, string skillDescription, TurretBodyStats turretBodyStats, UnlockableDef unlockableDef = null, bool isDefaultVariant = false)
{
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
Log.Debug("Adding turret body skill " + skillName + " to Engi's loadout.");
if (!Object.op_Implicit((Object)(object)engiBodyPrefab) || !Object.op_Implicit((Object)(object)engiSkillLocator) || !Object.op_Implicit((Object)(object)engiSpecialSkillFamily))
{
Init();
}
TurretBodySkillDef turretBodySkillDef = ScriptableObject.CreateInstance<TurretBodySkillDef>();
((SkillDef)turretBodySkillDef).skillName = skillDef.skillName;
((SkillDef)turretBodySkillDef).skillNameToken = skillDef.skillNameToken;
((SkillDef)turretBodySkillDef).skillDescriptionToken = skillDef.skillDescriptionToken;
((SkillDef)turretBodySkillDef).keywordTokens = skillDef.keywordTokens;
((SkillDef)turretBodySkillDef).icon = skillDef.icon;
((SkillDef)turretBodySkillDef).activationStateMachineName = skillDef.activationStateMachineName;
((SkillDef)turretBodySkillDef).activationState = skillDef.activationState;
((SkillDef)turretBodySkillDef).interruptPriority = skillDef.interruptPriority;
((SkillDef)turretBodySkillDef).baseRechargeInterval = skillDef.baseRechargeInterval;
((SkillDef)turretBodySkillDef).baseMaxStock = skillDef.baseMaxStock;
((SkillDef)turretBodySkillDef).rechargeStock = skillDef.rechargeStock;
((SkillDef)turretBodySkillDef).requiredStock = skillDef.requiredStock;
((SkillDef)turretBodySkillDef).stockToConsume = skillDef.stockToConsume;
((SkillDef)turretBodySkillDef).attackSpeedBuffsRestockSpeed = skillDef.attackSpeedBuffsRestockSpeed;
((SkillDef)turretBodySkillDef).attackSpeedBuffsRestockSpeed_Multiplier = skillDef.attackSpeedBuffsRestockSpeed_Multiplier;
((SkillDef)turretBodySkillDef).resetCooldownTimerOnUse = skillDef.resetCooldownTimerOnUse;
((SkillDef)turretBodySkillDef).fullRestockOnAssign = skillDef.fullRestockOnAssign;
((SkillDef)turretBodySkillDef).dontAllowPastMaxStocks = skillDef.dontAllowPastMaxStocks;
((SkillDef)turretBodySkillDef).beginSkillCooldownOnSkillEnd = skillDef.beginSkillCooldownOnSkillEnd;
((SkillDef)turretBodySkillDef).isCooldownBlockedUntilManuallyReset = skillDef.isCooldownBlockedUntilManuallyReset;
((SkillDef)turretBodySkillDef).cancelSprintingOnActivation = skillDef.cancelSprintingOnActivation;
((SkillDef)turretBodySkillDef).forceSprintDuringState = skillDef.forceSprintDuringState;
((SkillDef)turretBodySkillDef).canceledFromSprinting = skillDef.canceledFromSprinting;
((SkillDef)turretBodySkillDef).isCombatSkill = skillDef.isCombatSkill;
((SkillDef)turretBodySkillDef).mustKeyPress = skillDef.mustKeyPress;
((SkillDef)turretBodySkillDef).triggeredByPressRelease = skillDef.triggeredByPressRelease;
((SkillDef)turretBodySkillDef).autoHandleLuminousShot = skillDef.autoHandleLuminousShot;
((SkillDef)turretBodySkillDef).suppressSkillActivation = skillDef.suppressSkillActivation;
((SkillDef)turretBodySkillDef).hideStockCount = skillDef.hideStockCount;
((SkillDef)turretBodySkillDef).hideCooldown = skillDef.hideCooldown;
turretBodySkillDef.SetTurretBodyStats(turretBodyStats);
if (!string.IsNullOrEmpty(skillName) && !string.IsNullOrEmpty(skillDescription))
{
AddLanguageTokens((SkillDef)(object)turretBodySkillDef, skillName, skillDescription);
}
AddSkillToFamily((SkillDef)(object)turretBodySkillDef, engiSpecialSkillFamily, unlockableDef);
ContentAddition.AddSkillDef((SkillDef)(object)turretBodySkillDef);
return (SkillDef)(object)turretBodySkillDef;
}
private static void OnServerMasterSummonGlobal(MasterSummonReport report)
{
//IL_0001: 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)
CharacterBody summonBodyInstance = report.summonBodyInstance;
if (summonBodyInstance.baseNameToken != "ENGITURRET_BODY_NAME")
{
return;
}
Log.Debug("Turret summoned, applying stats and skills.");
CharacterBody leaderBodyInstance = report.leaderBodyInstance;
SkillLocator skillLocator = leaderBodyInstance.skillLocator;
TurretBodySkillDef turretBodySkillDef = null;
TurretWeaponSkillDef turretWeaponSkillDef = null;
GenericSkill[] allSkills = skillLocator.AllSkills;
foreach (GenericSkill val in allSkills)
{
if (val.skillDef is TurretBodySkillDef)
{
turretBodySkillDef = val.skillDef as TurretBodySkillDef;
}
if (val.skillDef is TurretWeaponSkillDef)
{
turretWeaponSkillDef = val.skillDef as TurretWeaponSkillDef;
}
}
if ((Object)(object)turretBodySkillDef != (Object)null)
{
summonBodyInstance.baseMaxHealth = turretBodySkillDef.TurretBodyStats.MaxHealth;
summonBodyInstance.levelMaxHealth = turretBodySkillDef.TurretBodyStats.MaxHealthInc;
summonBodyInstance.baseRegen = turretBodySkillDef.TurretBodyStats.HealthRegen;
summonBodyInstance.levelRegen = turretBodySkillDef.TurretBodyStats.HealthRegenInc;
summonBodyInstance.baseArmor = turretBodySkillDef.TurretBodyStats.Armor;
summonBodyInstance.baseMoveSpeed = turretBodySkillDef.TurretBodyStats.Movespeed;
if ((Object)(object)turretWeaponSkillDef != (Object)null)
{
summonBodyInstance.skillLocator.primary.SetBaseSkill(turretWeaponSkillDef.SelectedPrimarySkillDef);
}
}
}
}
public class TurretBodySkillDef : SkillDef
{
public TurretBodyStats TurretBodyStats { get; private set; }
public void SetTurretBodyStats(TurretBodyStats turretBodyStats)
{
TurretBodyStats = turretBodyStats;
}
}
public struct TurretBodyStats
{
public static readonly TurretBodyStats Default = new TurretBodyStats
{
MaxHealth = 130f,
MaxHealthInc = 39f,
HealthRegen = 0.6f,
HealthRegenInc = 0.12f,
Armor = 0f,
Movespeed = 7f
};
public float MaxHealth;
public float MaxHealthInc;
public float HealthRegen;
public float HealthRegenInc;
public float Armor;
public float Movespeed;
public TurretBodyStats(float maxHealth = 130f, float maxHealthInc = 39f, float healthRegen = 0.6f, float healthRegenInc = 0.12f, float armor = 0f, float movespeed = 7f)
{
MaxHealth = maxHealth;
MaxHealthInc = maxHealthInc;
HealthRegen = healthRegen;
HealthRegenInc = healthRegenInc;
Armor = armor;
Movespeed = movespeed;
}
}
public class TurretWeaponSkillDef : SkillDef
{
public SkillDef SelectedPrimarySkillDef { get; private set; }
public void SetSelectedPrimarySkillDef(SkillDef skillDef)
{
SelectedPrimarySkillDef = skillDef;
}
}
}
namespace EngineerRedux.States.Turret
{
public class BeamPrimaryState : BaseSkillState
{
private static float fireFrequency = 5f;
private static float damageCoefficient = 0.4f;
private static float procCoefficient = 1f;
private static float force = 0f;
private static float maxRange = 300f;
private static GameObject hitEffectPrefab;
private static GameObject tracerEffectPrefab;
private static string laserStartSoundString = "Play_engi_r_walkingTurret_laser_start";
private static string laserLoopSoundString = "Play_engi_r_walkingTurret_laser_loop";
private static string laserEndSoundString = "Play_engi_r_walkingTurret_laser_end";
private Transform muzzleInstance;
private GameObject laserInstance;
private Transform laserInstanceEndpoint;
private float timeSinceLastFired;
public static void Init()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_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)
hitEffectPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Common/VFX/Hitspark1.prefab").WaitForCompletion();
tracerEffectPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Engi/LaserEngiTurret.prefab").WaitForCompletion();
}
public override void OnEnter()
{
//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_0017: 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_00a3: Unknown result type (might be due to invalid IL or missing references)
((BaseState)this).OnEnter();
Transform modelTransform = ((EntityState)this).GetModelTransform();
Ray aimRay = ((BaseState)this).GetAimRay();
((BaseState)this).StartAimMode(aimRay, 3f, false);
Util.PlaySound(laserStartSoundString, ((EntityState)this).gameObject);
if (!Object.op_Implicit((Object)(object)modelTransform))
{
return;
}
ChildLocator component = ((Component)modelTransform).GetComponent<ChildLocator>();
if (Object.op_Implicit((Object)(object)component))
{
muzzleInstance = component.FindChild("Muzzle");
if (Object.op_Implicit((Object)(object)muzzleInstance) && Object.op_Implicit((Object)(object)tracerEffectPrefab))
{
laserInstance = Object.Instantiate<GameObject>(tracerEffectPrefab, muzzleInstance.position, muzzleInstance.rotation);
laserInstance.transform.parent = ((EntityState)this).transform;
laserInstanceEndpoint = laserInstance.GetComponent<ChildLocator>().FindChild("LaserEnd");
}
}
}
public override void FixedUpdate()
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: 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_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: 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)
((EntityState)this).FixedUpdate();
Ray aimRay = ((BaseState)this).GetAimRay();
((BaseState)this).StartAimMode(aimRay, 2f, false);
Util.PlaySound(laserLoopSoundString, ((EntityState)this).gameObject);
Vector3 aimEndPoint = GetAimEndPoint(aimRay);
if (Object.op_Implicit((Object)(object)laserInstance) && Object.op_Implicit((Object)(object)laserInstanceEndpoint) && Object.op_Implicit((Object)(object)muzzleInstance))
{
laserInstance.transform.position = muzzleInstance.position;
laserInstance.transform.rotation = Quaternion.LookRotation(((Ray)(ref aimRay)).direction);
laserInstanceEndpoint.position = aimEndPoint;
}
timeSinceLastFired += Time.fixedDeltaTime;
float num = 1f / (fireFrequency * ((EntityState)this).characterBody.attackSpeed);
if (timeSinceLastFired >= num)
{
FireBullet(aimRay, muzzleInstance.position);
timeSinceLastFired = 0f;
}
if (((EntityState)this).isAuthority && !((EntityState)this).inputBank.skill1.down)
{
((EntityState)this).outer.SetNextStateToMain();
}
}
public override void OnExit()
{
((EntityState)this).OnExit();
Util.PlaySound(laserEndSoundString, ((EntityState)this).gameObject);
if (Object.op_Implicit((Object)(object)laserInstance))
{
Object.Destroy((Object)(object)laserInstance);
}
}
public override InterruptPriority GetMinimumInterruptPriority()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
return (InterruptPriority)2;
}
private Vector3 GetAimEndPoint(Ray aimRay)
{
//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_0014: 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_0030: 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_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//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)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
Vector3 point = ((Ray)(ref aimRay)).GetPoint(maxRange);
RaycastHit val = default(RaycastHit);
if (Util.CharacterRaycast(((EntityState)this).gameObject, aimRay, ref val, maxRange, LayerMask.op_Implicit(LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask) | LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask)), (QueryTriggerInteraction)0))
{
point = ((RaycastHit)(ref val)).point;
}
return point;
}
private void FireBullet(Ray aimRay, Vector3 muzzlePosition)
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Expected O, but got Unknown
//IL_002e: 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_0035: 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_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)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: 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_00d8: 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_00e9: Unknown result type (might be due to invalid IL or missing references)
if (((EntityState)this).isAuthority)
{
BulletAttack val = new BulletAttack();
val.owner = ((EntityState)this).gameObject;
val.weapon = ((EntityState)this).gameObject;
val.origin = muzzlePosition;
Vector3 aimEndPoint = GetAimEndPoint(aimRay);
Vector3 val2 = aimEndPoint - muzzlePosition;
val.aimVector = ((Vector3)(ref val2)).normalized;
val.minSpread = 0f;
val.maxSpread = ((EntityState)this).characterBody.spreadBloomAngle;
val.damage = damageCoefficient * ((BaseState)this).damageStat;
val.force = force;
val.falloffModel = (FalloffModel)0;
val.hitEffectPrefab = hitEffectPrefab;
val.isCrit = Util.CheckRoll(((BaseState)this).critStat, ((EntityState)this).characterBody.master);
val.radius = 0.1f;
val.smartCollision = true;
val.procCoefficient = procCoefficient;
val.damageType = DamageTypeCombo.op_Implicit((DamageType)8);
val.damageType.damageSource = (DamageSource)1;
val.maxDistance = maxRange;
val.Fire();
}
}
}
public class GaussPrimaryState : FireGauss
{
}
public class GrenadePrimaryState : BaseState
{
private static GameObject effectPrefab;
private static GameObject projectilePrefab;
private static float damageCoefficient = 1f;
private static float baseDuration = 0.05f;
private static float arcAngle = -3f;
private static float spreadBloomValue = 0.2f;
private static string attackSoundString = "Play_engi_M1_shot";
private static int fireGrenadeStateHash = Animator.StringToHash("FireGauss");
private static int fireGrenadeParamHash = Animator.StringToHash("FireGauss.playbackRate");
private float duration;
private Transform modelTransform;
private Ray projectileRay;
public static void Init()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_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)
effectPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Common/VFX/MuzzleflashSmokeRing.prefab").WaitForCompletion();
projectilePrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Engi/EngiGrenadeProjectile.prefab").WaitForCompletion();
}
public override void OnEnter()
{
((BaseState)this).OnEnter();
duration = baseDuration / base.attackSpeedStat;
modelTransform = ((EntityState)this).GetModelTransform();
((BaseState)this).StartAimMode(2f, false);
FireGrenade();
}
public override void FixedUpdate()
{
((EntityState)this).FixedUpdate();
if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= duration)
{
((EntityState)this).outer.SetNextStateToMain();
}
}
public override void OnExit()
{
((EntityState)this).OnExit();
}
public override InterruptPriority GetMinimumInterruptPriority()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
return (InterruptPriority)1;
}
private void FireGrenade()
{
//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_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_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_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: 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_0139: Unknown result type (might be due to invalid IL or missing references)
//IL_013b: Unknown result type (might be due to invalid IL or missing references)
//IL_0142: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_014f: Unknown result type (might be due to invalid IL or missing references)
//IL_0154: Unknown result type (might be due to invalid IL or missing references)
//IL_0159: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_0162: 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_0181: Unknown result type (might be due to invalid IL or missing references)
//IL_0188: Unknown result type (might be due to invalid IL or missing references)
//IL_018a: Unknown result type (might be due to invalid IL or missing references)
//IL_018f: Unknown result type (might be due to invalid IL or missing references)
//IL_01df: Unknown result type (might be due to invalid IL or missing references)
//IL_01ee: 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_01f7: Unknown result type (might be due to invalid IL or missing references)
Util.PlaySound(attackSoundString, ((EntityState)this).gameObject);
projectileRay = ((BaseState)this).GetAimRay();
((EntityState)this).PlayAnimation("Gesture", fireGrenadeStateHash, fireGrenadeParamHash, duration);
string text = "Muzzle";
if (Object.op_Implicit((Object)(object)effectPrefab))
{
EffectManager.SimpleMuzzleFlash(effectPrefab, ((EntityState)this).gameObject, text, false);
}
if (((EntityState)this).isAuthority)
{
float num = Random.Range(0f, ((EntityState)this).characterBody.spreadBloomAngle);
float num2 = Random.Range(0f, 360f);
Vector3 up = Vector3.up;
Vector3 val = Vector3.Cross(up, ((Ray)(ref projectileRay)).direction);
Vector3 val2 = Quaternion.Euler(0f, 0f, num2) * (Quaternion.Euler(num, 0f, 0f) * Vector3.forward);
float y = val2.y;
val2.y = 0f;
float num3 = Mathf.Atan2(val2.z, val2.x) * 57.29578f - 90f;
float num4 = Mathf.Atan2(y, ((Vector3)(ref val2)).magnitude) * 57.29578f + arcAngle;
Vector3 val3 = Quaternion.AngleAxis(num3, up) * (Quaternion.AngleAxis(num4, val) * ((Ray)(ref projectileRay)).direction);
FireProjectileInfo val4 = default(FireProjectileInfo);
val4.projectilePrefab = projectilePrefab;
val4.position = ((Ray)(ref projectileRay)).origin;
val4.rotation = Util.QuaternionSafeLookRotation(val3);
val4.owner = ((EntityState)this).gameObject;
val4.damage = base.damageStat * damageCoefficient;
val4.force = 0f;
val4.crit = Util.CheckRoll(base.critStat, ((EntityState)this).characterBody.master);
val4.damageTypeOverride = DamageTypeCombo.GenericPrimary;
FireProjectileInfo val5 = val4;
ProjectileManager.instance.FireProjectile(val5);
}
((EntityState)this).characterBody.AddSpreadBloom(spreadBloomValue);
}
}
}
namespace EngineerRedux.States.Engi
{
public class BeamPrimaryState : BaseSkillState
{
private static float fireFrequency = 5f;
private static float damageCoefficient = 0.4f;
private static float procCoefficient = 1f;
private static float force = 0f;
private static float maxRange = 300f;
private static GameObject hitEffectPrefab;
private static GameObject tracerEffectPrefab;
private static string laserStartSoundString = "Play_engi_r_walkingTurret_laser_start";
private static string laserLoopSoundString = "Play_engi_r_walkingTurret_laser_loop";
private static string laserEndSoundString = "Play_engi_r_walkingTurret_laser_end";
private static int chargeStateHash = Animator.StringToHash("ChargeGrenades");
private static int emptyStateHash = Animator.StringToHash("Empty");
private Transform leftMuzzleInstance;
private Transform rightMuzzleInstance;
private GameObject leftLaserInstance;
private Transform leftLaserInstanceEndpoint;
private GameObject rightLaserInstance;
private Transform rightLaserInstanceEndpoint;
private float timeSinceLastFired;
public static void Init()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_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)
hitEffectPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Common/VFX/Hitspark1.prefab").WaitForCompletion();
tracerEffectPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Engi/LaserEngiTurret.prefab").WaitForCompletion();
}
public override void OnEnter()
{
//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_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
//IL_012d: Unknown result type (might be due to invalid IL or missing references)
((BaseState)this).OnEnter();
Transform modelTransform = ((EntityState)this).GetModelTransform();
Ray aimRay = ((BaseState)this).GetAimRay();
((BaseState)this).StartAimMode(aimRay, 3f, false);
((EntityState)this).PlayAnimation("Gesture, Additive", chargeStateHash);
Util.PlaySound(laserStartSoundString, ((EntityState)this).gameObject);
if (!Object.op_Implicit((Object)(object)modelTransform))
{
return;
}
ChildLocator component = ((Component)modelTransform).GetComponent<ChildLocator>();
if (Object.op_Implicit((Object)(object)component))
{
leftMuzzleInstance = component.FindChild("MuzzleLeft");
rightMuzzleInstance = component.FindChild("MuzzleRight");
if (Object.op_Implicit((Object)(object)leftMuzzleInstance) && Object.op_Implicit((Object)(object)rightMuzzleInstance) && Object.op_Implicit((Object)(object)tracerEffectPrefab))
{
leftLaserInstance = Object.Instantiate<GameObject>(tracerEffectPrefab, leftMuzzleInstance.position, leftMuzzleInstance.rotation);
leftLaserInstance.transform.parent = ((EntityState)this).transform;
leftLaserInstanceEndpoint = leftLaserInstance.GetComponent<ChildLocator>().FindChild("LaserEnd");
rightLaserInstance = Object.Instantiate<GameObject>(tracerEffectPrefab, rightMuzzleInstance.position, rightMuzzleInstance.rotation);
rightLaserInstance.transform.parent = ((EntityState)this).transform;
rightLaserInstanceEndpoint = rightLaserInstance.GetComponent<ChildLocator>().FindChild("LaserEnd");
}
}
}
public override void FixedUpdate()
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: 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_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: 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_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_0165: Unknown result type (might be due to invalid IL or missing references)
//IL_0176: Unknown result type (might be due to invalid IL or missing references)
//IL_017d: Unknown result type (might be due to invalid IL or missing references)
((EntityState)this).FixedUpdate();
Ray aimRay = ((BaseState)this).GetAimRay();
((BaseState)this).StartAimMode(aimRay, 2f, false);
Util.PlaySound(laserLoopSoundString, ((EntityState)this).gameObject);
Vector3 aimEndPoint = GetAimEndPoint(aimRay);
if (Object.op_Implicit((Object)(object)leftLaserInstance) && Object.op_Implicit((Object)(object)leftLaserInstanceEndpoint) && Object.op_Implicit((Object)(object)leftMuzzleInstance))
{
leftLaserInstance.transform.position = leftMuzzleInstance.position;
leftLaserInstance.transform.rotation = Quaternion.LookRotation(((Ray)(ref aimRay)).direction);
leftLaserInstanceEndpoint.position = aimEndPoint;
}
if (Object.op_Implicit((Object)(object)rightLaserInstance) && Object.op_Implicit((Object)(object)rightLaserInstanceEndpoint) && Object.op_Implicit((Object)(object)rightMuzzleInstance))
{
rightLaserInstance.transform.position = rightMuzzleInstance.position;
rightLaserInstance.transform.rotation = Quaternion.LookRotation(((Ray)(ref aimRay)).direction);
rightLaserInstanceEndpoint.position = aimEndPoint;
}
timeSinceLastFired += Time.fixedDeltaTime;
float num = 1f / (fireFrequency * ((EntityState)this).characterBody.attackSpeed);
if (timeSinceLastFired >= num)
{
FireBullet(aimRay, leftMuzzleInstance.position, "MuzzleLeft");
FireBullet(aimRay, rightMuzzleInstance.position, "MuzzleRight");
timeSinceLastFired = 0f;
}
if (((EntityState)this).isAuthority && !((EntityState)this).inputBank.skill1.down)
{
((EntityState)this).outer.SetNextStateToMain();
}
}
public override void OnExit()
{
((EntityState)this).OnExit();
((EntityState)this).PlayAnimation("Gesture, Additive", emptyStateHash);
Util.PlaySound(laserEndSoundString, ((EntityState)this).gameObject);
if (Object.op_Implicit((Object)(object)leftLaserInstance))
{
Object.Destroy((Object)(object)leftLaserInstance);
}
if (Object.op_Implicit((Object)(object)rightLaserInstance))
{
Object.Destroy((Object)(object)rightLaserInstance);
}
}
public override InterruptPriority GetMinimumInterruptPriority()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
return (InterruptPriority)2;
}
private Vector3 GetAimEndPoint(Ray aimRay)
{
//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_0014: 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_0030: 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_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//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)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
Vector3 point = ((Ray)(ref aimRay)).GetPoint(maxRange);
RaycastHit val = default(RaycastHit);
if (Util.CharacterRaycast(((EntityState)this).gameObject, aimRay, ref val, maxRange, LayerMask.op_Implicit(LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask) | LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask)), (QueryTriggerInteraction)0))
{
point = ((RaycastHit)(ref val)).point;
}
return point;
}
private void FireBullet(Ray aimRay, Vector3 muzzlePosition, string targetMuzzle)
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Expected O, but got Unknown
//IL_002e: 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_0035: 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_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)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: 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_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_00f0: Unknown result type (might be due to invalid IL or missing references)
if (((EntityState)this).isAuthority)
{
BulletAttack val = new BulletAttack();
val.owner = ((EntityState)this).gameObject;
val.weapon = ((EntityState)this).gameObject;
val.origin = muzzlePosition;
Vector3 aimEndPoint = GetAimEndPoint(aimRay);
Vector3 val2 = aimEndPoint - muzzlePosition;
val.aimVector = ((Vector3)(ref val2)).normalized;
val.minSpread = 0f;
val.maxSpread = ((EntityState)this).characterBody.spreadBloomAngle;
val.damage = damageCoefficient * ((BaseState)this).damageStat;
val.force = force;
val.falloffModel = (FalloffModel)0;
val.muzzleName = targetMuzzle;
val.hitEffectPrefab = hitEffectPrefab;
val.isCrit = Util.CheckRoll(((BaseState)this).critStat, ((EntityState)this).characterBody.master);
val.radius = 0.1f;
val.smartCollision = true;
val.procCoefficient = procCoefficient;
val.damageType = DamageTypeCombo.op_Implicit((DamageType)8);
val.damageType.damageSource = (DamageSource)1;
val.maxDistance = maxRange;
val.Fire();
}
}
}
public class GaussPrimaryState : BaseSkillState, IStepSetter
{
private static float baseDuration = 0.175f;
private static float damageCoefficient = 0.7f;
private static float force = 200f;
private static float maxRange = 300f;
private static float recoilAmplitude = 1f;
private static float trajectoryAimAssistMultiplier = 0.75f;
private static GameObject muzzleEffectPrefab;
private static GameObject hitEffectPrefab;
private static GameObject tracerEffectPrefab;
private static string attackSoundString = "Play_engi_R_turret_shot";
private float duration;
private Transform modelTransform;
private int step;
public static void Init()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
muzzleEffectPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Engi/MuzzleflashEngiTurret.prefab").WaitForCompletion();
hitEffectPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Engi/ImpactEngiTurret.prefab").WaitForCompletion();
tracerEffectPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Engi/TracerEngiTurret.prefab").WaitForCompletion();
}
void IStepSetter.SetStep(int i)
{
step = i;
}
public override void OnEnter()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
((BaseState)this).OnEnter();
duration = baseDuration / ((BaseState)this).attackSpeedStat;
modelTransform = ((EntityState)this).GetModelTransform();
Ray aimRay = ((BaseState)this).GetAimRay();
((BaseState)this).StartAimMode(aimRay, 3f, false);
if (step % 2 == 0)
{
FireBullet(aimRay, "MuzzleLeft");
((EntityState)this).PlayCrossfade("Gesture Left Cannon, Additive", "FireGrenadeLeft", 0.1f);
}
else
{
FireBullet(aimRay, "MuzzleRight");
((EntityState)this).PlayCrossfade("Gesture Right Cannon, Additive", "FireGrenadeRight", 0.1f);
}
}
public override void FixedUpdate()
{
((EntityState)this).FixedUpdate();
if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= duration)
{
((EntityState)this).outer.SetNextStateToMain();
}
}
public override void OnExit()
{
((EntityState)this).OnExit();
}
public override InterruptPriority GetMinimumInterruptPriority()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
return (InterruptPriority)2;
}
private Vector3 GetAimEndPoint(Ray aimRay)
{
//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_0014: 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_0030: 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_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//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)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
Vector3 point = ((Ray)(ref aimRay)).GetPoint(maxRange);
RaycastHit val = default(RaycastHit);
if (Util.CharacterRaycast(((EntityState)this).gameObject, aimRay, ref val, maxRange, LayerMask.op_Implicit(LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask) | LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask)), (QueryTriggerInteraction)0))
{
point = ((RaycastHit)(ref val)).point;
}
return point;
}
private void FireBullet(Ray aimRay, string targetMuzzle)
{
//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_00c9: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Expected O, but got Unknown
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: 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_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
//IL_01b5: 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_005d: Unknown result type (might be due to invalid IL or missing references)
Util.PlaySound(attackSoundString, ((EntityState)this).gameObject);
Vector3 val = Vector3.zero;
if (Object.op_Implicit((Object)(object)modelTransform))
{
ChildLocator component = ((Component)modelTransform).GetComponent<ChildLocator>();
if (Object.op_Implicit((Object)(object)component))
{
Transform val2 = component.FindChild(targetMuzzle);
if (Object.op_Implicit((Object)(object)val2))
{
val = val2.position;
}
}
}
((BaseState)this).AddRecoil(-0.4f * recoilAmplitude, -0.8f * recoilAmplitude, -0.3f * recoilAmplitude, 0.3f * recoilAmplitude);
if (Object.op_Implicit((Object)(object)muzzleEffectPrefab))
{
EffectManager.SimpleMuzzleFlash(muzzleEffectPrefab, ((EntityState)this).gameObject, targetMuzzle, false);
}
if (((EntityState)this).isAuthority)
{
BulletAttack val3 = new BulletAttack();
val3.owner = ((EntityState)this).gameObject;
val3.weapon = ((EntityState)this).gameObject;
val3.origin = val;
Vector3 aimEndPoint = GetAimEndPoint(aimRay);
Vector3 val4 = aimEndPoint - val;
val3.aimVector = ((Vector3)(ref val4)).normalized;
val3.minSpread = 0f;
val3.maxSpread = ((EntityState)this).characterBody.spreadBloomAngle;
val3.damage = damageCoefficient * ((BaseState)this).damageStat;
val3.force = force;
val3.tracerEffectPrefab = tracerEffectPrefab;
val3.muzzleName = targetMuzzle;
val3.hitEffectPrefab = hitEffectPrefab;
val3.isCrit = Util.CheckRoll(((BaseState)this).critStat, ((EntityState)this).characterBody.master);
val3.radius = 0.15f;
val3.smartCollision = true;
val3.trajectoryAimAssistMultiplier = trajectoryAimAssistMultiplier;
val3.damageType = DamageTypeCombo.GenericPrimary;
val3.Fire();
}
}
}
public class GrenadePrimaryState : ChargeGrenades
{
}
}