using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using Chen.ChillDrone.Drone.States;
using Chen.GradiusMod;
using Chen.GradiusMod.Drones;
using Chen.GradiusMod.Items.GradiusOption;
using Chen.GradiusMod.Items.GradiusOption.Components;
using Chen.Helpers.GeneralHelpers;
using Chen.Helpers.LogHelpers;
using Chen.Helpers.UnityHelpers;
using EntityStates;
using EntityStates.EngiTurret.EngiTurretWeapon;
using On.RoR2;
using R2API;
using R2API.Utils;
using RoR2;
using RoR2.CharacterAI;
using RoR2.ContentManagement;
using RoR2.Skills;
using TILER2;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: InternalsVisibleTo("ChillDrone.Tests")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("ChillDrone")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("2.1.2.0")]
[assembly: AssemblyInformationalVersion("2.1.2")]
[assembly: AssemblyProduct("ChillDrone")]
[assembly: AssemblyTitle("ChillDrone")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.1.2.0")]
[module: UnverifiableCode]
namespace Chen.ChillDrone
{
internal class ContentProvider : GenericContentPackProvider
{
internal List<GameObject> bodyObjects = new List<GameObject>();
internal List<GameObject> masterObjects = new List<GameObject>();
protected override string ContentIdentifier()
{
return "com.Chen.ChillDrone";
}
protected override void LoadStaticContentAsyncActions(LoadStaticContentAsyncArgs args)
{
base.contentPack.bodyPrefabs.Add(bodyObjects.ToArray());
base.contentPack.masterPrefabs.Add(masterObjects.ToArray());
}
}
[BepInPlugin("com.Chen.ChillDrone", "ChillDrone", "2.1.3")]
[BepInDependency("com.bepis.r2api", "5.1.1")]
[BepInDependency("com.Chen.ChensHelpers", "1.1.3")]
[BepInDependency("com.Chen.ChensGradiusMod", "3.5.5")]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
[R2APISubmoduleDependency(new string[] { "DamageAPI", "RecalculateStatsAPI" })]
public class ModPlugin : BaseUnityPlugin
{
public const string ModVer = "2.1.3";
public const string ModName = "ChillDrone";
public const string ModGuid = "com.Chen.ChillDrone";
internal static ConfigFile cfgFile;
internal static Log Log;
internal static List<DroneInfo> dronesList = new List<DroneInfo>();
internal static AssetBundle assetBundle;
internal static ContentProvider contentProvider;
private void Awake()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Expected O, but got Unknown
//IL_005f: 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)
Log = new Log(((BaseUnityPlugin)this).Logger);
contentProvider = new ContentProvider();
Log.Debug((object)"Initializing config file...");
cfgFile = new ConfigFile(Path.Combine(Paths.ConfigPath, "com.Chen.ChillDrone.cfg"), true);
Log.Debug((object)"Loading asset bundle...");
BundleInfo val = default(BundleInfo);
((BundleInfo)(ref val))..ctor("Chen.ChillDrone.chilldrone_assets", (BundleType)0);
assetBundle = new AssetsManager(val).Register();
Extensions.ConvertShaders(assetBundle);
Log.Debug((object)"Registering Chill Drone...");
dronesList = DroneCatalog.Initialize("com.Chen.ChillDrone", cfgFile);
DroneCatalog.ScopedSetupAll(dronesList);
((GenericContentPackProvider)contentProvider).Initialize();
}
internal static bool DebugCheck()
{
return false;
}
}
}
namespace Chen.ChillDrone.Drone
{
internal class ChillDrone : Drone<ChillDrone>
{
private static readonly Lazy<InteractableSpawnCard> _iscBasis = new Lazy<InteractableSpawnCard>((Func<InteractableSpawnCard>)(() => Resources.Load<InteractableSpawnCard>("spawncards/interactablespawncard/iscBrokenDrone1")));
private static readonly Lazy<SkillDef> _skillBasis = new Lazy<SkillDef>((Func<SkillDef>)(() => Resources.Load<SkillDef>("skilldefs/drone1body/Drone1BodyGun")));
private static readonly Lazy<GameObject> _flameDroneMaster = new Lazy<GameObject>((Func<GameObject>)(() => Resources.Load<GameObject>("prefabs/charactermasters/FlameDroneMaster")));
public static ModdedDamageType chillOnHit { get; private set; }
public static BuffDef chillBuff { get; private set; }
public static InteractableSpawnCard iSpawnCard { get; private set; }
public override bool canHaveOptions => true;
private GameObject brokenObject { get; set; }
private DirectorCardHolder iDirectorCardHolder { get; set; }
private GameObject droneBody { get; set; }
private GameObject droneMaster { get; set; }
private static InteractableSpawnCard interactableSpawnCardBasis => _iscBasis.Value;
private static SkillDef skillBasis => _skillBasis.Value;
private static GameObject flameDroneMaster => _flameDroneMaster.Value;
protected override GameObject DroneCharacterMasterObject => droneMaster;
protected override void SetupConfig()
{
((Drone)this).spawnWeightWithMachinesArtifact = 0;
((Drone)this).SetupConfig();
}
protected override void SetupComponents()
{
//IL_0262: Unknown result type (might be due to invalid IL or missing references)
//IL_0267: Unknown result type (might be due to invalid IL or missing references)
//IL_027e: Unknown result type (might be due to invalid IL or missing references)
//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
//IL_0309: 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_0387: Unknown result type (might be due to invalid IL or missing references)
//IL_039f: Unknown result type (might be due to invalid IL or missing references)
//IL_03a9: Expected O, but got Unknown
//IL_03a9: Unknown result type (might be due to invalid IL or missing references)
//IL_03ab: Unknown result type (might be due to invalid IL or missing references)
//IL_03df: Unknown result type (might be due to invalid IL or missing references)
//IL_03e4: Unknown result type (might be due to invalid IL or missing references)
//IL_0528: Unknown result type (might be due to invalid IL or missing references)
//IL_052d: Unknown result type (might be due to invalid IL or missing references)
//IL_0549: Unknown result type (might be due to invalid IL or missing references)
//IL_0553: Expected O, but got Unknown
//IL_0572: Unknown result type (might be due to invalid IL or missing references)
//IL_0583: Unknown result type (might be due to invalid IL or missing references)
//IL_0594: Unknown result type (might be due to invalid IL or missing references)
//IL_05d7: Unknown result type (might be due to invalid IL or missing references)
//IL_05dc: Unknown result type (might be due to invalid IL or missing references)
//IL_05e7: Unknown result type (might be due to invalid IL or missing references)
//IL_05ee: Unknown result type (might be due to invalid IL or missing references)
//IL_05f5: Unknown result type (might be due to invalid IL or missing references)
//IL_05f7: Unknown result type (might be due to invalid IL or missing references)
//IL_05fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0605: Expected O, but got Unknown
//IL_0606: Unknown result type (might be due to invalid IL or missing references)
//IL_060b: Unknown result type (might be due to invalid IL or missing references)
//IL_0613: Unknown result type (might be due to invalid IL or missing references)
//IL_0615: Unknown result type (might be due to invalid IL or missing references)
//IL_061a: Unknown result type (might be due to invalid IL or missing references)
//IL_061c: Unknown result type (might be due to invalid IL or missing references)
//IL_0626: Expected O, but got Unknown
((Drone)this).SetupComponents();
LanguageAPI.Add("CHILL_DRONE_NAME", "Chill Drone");
LanguageAPI.Add("CHILL_DRONE_CONTEXT", "Repair Chill Drone");
LanguageAPI.Add("CHILL_DRONE_INTERACTABLE_NAME", "Broken Chill Drone");
brokenObject = PrefabAPI.InstantiateClone(((SpawnCard)interactableSpawnCardBasis).prefab, ((Drone)this).name + "Broken", true);
SummonMasterBehavior component = brokenObject.GetComponent<SummonMasterBehavior>();
droneMaster = PrefabAPI.InstantiateClone(component.masterPrefab, ((Drone)this).name + "Master", true);
ModPlugin.contentProvider.masterObjects.Add(droneMaster);
AISkillDriver[] components = droneMaster.GetComponents<AISkillDriver>();
foreach (AISkillDriver val in components)
{
Object.Destroy((Object)(object)val);
}
AISkillDriver[] array = Extensions.DeepCopyComponentsTo<AISkillDriver>(flameDroneMaster, droneMaster).ToArray();
array[1].maxDistance = EmitSlow.detectionDistance;
array[2].maxDistance = array[1].maxDistance + EmitSlow.detectionDistance * 0.5f;
array[3].minDistance = array[2].maxDistance;
Extensions.SetAllDriversToAimTowardsEnemies(array);
CharacterMaster component2 = droneMaster.GetComponent<CharacterMaster>();
droneBody = PrefabAPI.InstantiateClone(component2.bodyPrefab, ((Drone)this).name + "Body", true);
ModPlugin.contentProvider.bodyObjects.Add(droneBody);
CharacterBody component3 = droneBody.GetComponent<CharacterBody>();
component3.baseNameToken = "CHILL_DRONE_NAME";
component3.baseMaxHealth *= 0.9f;
component3.baseRegen *= 3f;
component3.baseDamage = 3f;
component3.baseCrit = 0f;
component3.baseArmor *= 1.3f;
component3.baseMoveSpeed *= 0.7f;
component3.levelMaxHealth *= 0.9f;
component3.levelRegen *= 3f;
component3.levelDamage = 1f;
component3.levelCrit = 0f;
component3.levelArmor *= 1.3f;
component3.levelMoveSpeed *= 0.7f;
component3.portraitIcon = ModPlugin.assetBundle.LoadAsset<Texture>("Assets/GEMO/texChillDrone.png");
GameObject val2 = ModPlugin.assetBundle.LoadAsset<GameObject>("Assets/GEMO/mdlChillDrone.prefab");
Quaternion localRotation = val2.transform.localRotation;
Extensions.ReplaceModel(droneBody, val2, false);
val2.transform.localRotation = localRotation;
Extensions.InitializeDroneModelComponents(val2, component3, 1.3f);
((Component)val2.transform.Find("PropellerLEffect")).gameObject.AddComponent<RotateObject>().rotationSpeed = new Vector3(0f, 0f, 900f);
((Component)val2.transform.Find("PropellerREffect")).gameObject.AddComponent<RotateObject>().rotationSpeed = new Vector3(0f, 0f, -900f);
SkillLocator component4 = droneBody.GetComponent<SkillLocator>();
bool flag = default(bool);
ContentAddition.AddEntityState<EmitSlow>(ref flag);
SkillDef val3 = Object.Instantiate<SkillDef>(skillBasis);
val3.activationState = new SerializableEntityStateType(typeof(EmitSlow));
val3.baseRechargeInterval = 4f;
val3.beginSkillCooldownOnSkillEnd = true;
val3.baseMaxStock = 1;
val3.fullRestockOnAssign = false;
ContentAddition.AddSkillDef(val3);
SkillFamily val4 = Object.Instantiate<SkillFamily>(component4.primary.skillFamily);
val4.variants = (Variant[])(object)new Variant[1];
Variant[] variants = val4.variants;
Variant val5 = new Variant
{
skillDef = val3
};
((Variant)(ref val5)).viewableNode = new Node("", false, (Node)null);
variants[0] = val5;
Reflection.SetFieldValue<SkillFamily>((object)component4.primary, "_skillFamily", val4);
ContentAddition.AddSkillFamily(val4);
CharacterDeathBehavior orAddComponent = Extensions.GetOrAddComponent<CharacterDeathBehavior>((Component)(object)component3);
orAddComponent.deathState = new SerializableEntityStateType(typeof(DeathState));
component2.bodyPrefab = droneBody;
component.masterPrefab = droneMaster;
PurchaseInteraction component5 = brokenObject.GetComponent<PurchaseInteraction>();
component5.cost = 80;
component5.Networkcost = component5.cost;
component5.contextToken = "CHILL_DRONE_CONTEXT";
component5.displayNameToken = "CHILL_DRONE_INTERACTABLE_NAME";
GenericDisplayNameProvider component6 = brokenObject.GetComponent<GenericDisplayNameProvider>();
component6.displayToken = "CHILL_DRONE_NAME";
GameObject val6 = ModPlugin.assetBundle.LoadAsset<GameObject>("Assets/GEMO/mdlChillDroneBroken.prefab");
Extensions.ReplaceModel(brokenObject, val6, false);
Highlight component7 = brokenObject.GetComponent<Highlight>();
component7.targetRenderer = (Renderer)(object)val6.GetComponentInChildren<MeshRenderer>();
EntityLocator val7 = val6.AddComponent<EntityLocator>();
val7.entity = brokenObject;
GameObject gameObject = ((Component)val6.transform.GetChild(0)).gameObject;
EntityLocator val8 = gameObject.AddComponent<EntityLocator>();
val8.entity = brokenObject;
GameObject gameObject2 = ((Component)brokenObject.transform.Find("ModelBase").Find("BrokenDroneVFX")).gameObject;
gameObject2.transform.parent = val6.transform;
GameObject gameObject3 = ((Component)gameObject2.transform.Find("Small Sparks, Mesh")).gameObject;
ShapeModule shape = gameObject3.GetComponent<ParticleSystem>().shape;
((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)13;
((ShapeModule)(ref shape)).meshShapeType = (ParticleSystemMeshShapeType)1;
((ShapeModule)(ref shape)).meshRenderer = (MeshRenderer)component7.targetRenderer;
GameObject gameObject4 = ((Component)gameObject2.transform.Find("Damage Point")).gameObject;
gameObject4.transform.localPosition = Vector3.zero;
gameObject4.transform.localRotation = Quaternion.identity;
gameObject4.transform.localScale = Vector3.one;
iSpawnCard = Object.Instantiate<InteractableSpawnCard>(interactableSpawnCardBasis);
((Object)iSpawnCard).name = "iscBroken" + ((Drone)this).name;
((SpawnCard)iSpawnCard).prefab = brokenObject;
DirectorCard card = new DirectorCard
{
spawnCard = (SpawnCard)(object)iSpawnCard,
selectionWeight = 2,
minimumStageCompletions = 0,
spawnDistance = (MonsterSpawnDistance)1,
preventOverhead = false
};
iDirectorCardHolder = new DirectorCardHolder
{
Card = card,
MonsterCategory = (MonsterCategory)0,
InteractableCategory = (InteractableCategory)5
};
}
protected override void SetupBehavior()
{
//IL_0037: 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_00b6: Expected O, but got Unknown
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Expected O, but got Unknown
((Drone)this).SetupBehavior();
Item<GradiusOption>.instance.SetToRotateOptions(((Object)droneMaster).name);
Item<GradiusOption>.instance.SetRotateOptionMultiplier(((Object)droneMaster).name, 1.2f);
chillOnHit = DamageAPI.ReserveDamageType();
chillBuff = ScriptableObject.CreateInstance<BuffDef>();
chillBuff.canStack = false;
chillBuff.isDebuff = true;
((Object)chillBuff).name = "Chill Drone - Chilled";
chillBuff.iconSprite = ModPlugin.assetBundle.LoadAsset<Sprite>("Assets/texBuffChill.png");
ContentAddition.AddBuffDef(chillBuff);
DirectorAPI.InteractableActions += DirectorAPI_InteractableActions;
RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(ChillDrone_GetStatCoefficients);
HealthComponent.TakeDamage += new hook_TakeDamage(HealthComponent_TakeDamage);
}
private void HealthComponent_TakeDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(self, damageInfo);
if (DamageAPI.HasModdedDamageType(damageInfo, chillOnHit))
{
self.body.AddTimedBuff(chillBuff, 1f);
}
}
private void ChillDrone_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args)
{
if (sender.HasBuff(chillBuff))
{
args.moveSpeedMultAdd -= 0.7f;
args.jumpPowerMultAdd -= 0.7f;
}
}
private void DirectorAPI_InteractableActions(DccsPool arg0, StageInfo arg1)
{
if (((StageInfo)(ref arg1)).CheckStage((Stage)32, Array.Empty<string>()) || ((StageInfo)(ref arg1)).CheckStage((Stage)256, Array.Empty<string>()))
{
Helpers.ForEachPoolEntryInDccsPool(arg0, (Action<PoolEntry>)delegate(PoolEntry poolEntry)
{
DirectorAPI.AddCard(poolEntry.dccs, iDirectorCardHolder);
});
}
}
internal static bool DebugCheck()
{
return false;
}
}
}
namespace Chen.ChillDrone.Drone.States
{
internal class DeathState : DroneDeathState
{
protected override bool SpawnInteractable { get; set; } = ((Drone)Drone<ChillDrone>.instance).canBeRepurchased;
protected override InteractableSpawnCard GetInteractableSpawnCard => ChillDrone.iSpawnCard;
}
internal class EmitSlow : BaseState
{
public static readonly float detectionDistance = 20f;
private static readonly float angularDetection = 60f;
private static readonly string muzzleString = "Muzzle";
private static readonly float maxDistance = detectionDistance * 2f;
private static readonly float duration = 5f;
private float stopwatch;
private float fireTimer;
private Transform modelTransform;
private BullseyeSearch enemyFinder;
private Ray aimRay;
private List<HurtBox> results = new List<HurtBox>();
private readonly List<GameObject> laserEffectInstances = new List<GameObject>();
private readonly List<Transform> laserEffectInstanceEndTransforms = new List<Transform>();
private Transform muzzleTransform;
private static FireBeam fireBeamInstance => new FireBeam();
private static GameObject laserPrefab => fireBeamInstance.laserPrefab;
private static string attackSoundString => fireBeamInstance.attackSoundString;
private static float fireFrequency => fireBeamInstance.fireFrequency;
private static GameObject effectPrefab => fireBeamInstance.effectPrefab;
private static float minSpread => fireBeamInstance.minSpread;
private static float maxSpread => fireBeamInstance.maxSpread;
private static float force => fireBeamInstance.force;
private static GameObject hitEffectPrefab => fireBeamInstance.hitEffectPrefab;
private void InitializeEnemyFinder()
{
//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_0012: 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_0028: 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_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: 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_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_0059: 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_0068: Expected O, but got Unknown
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
enemyFinder = new BullseyeSearch
{
viewer = ((EntityState)this).characterBody,
maxDistanceFilter = detectionDistance,
maxAngleFilter = angularDetection,
searchOrigin = ((Ray)(ref aimRay)).origin,
searchDirection = ((Ray)(ref aimRay)).direction,
filterByLoS = true,
sortMode = (SortMode)3,
teamMaskFilter = TeamMask.allButNeutral
};
if (Object.op_Implicit((Object)(object)((EntityState)this).teamComponent))
{
((TeamMask)(ref enemyFinder.teamMaskFilter)).RemoveTeam(((EntityState)this).teamComponent.teamIndex);
}
enemyFinder.RefreshCandidates();
results = enemyFinder.GetResults().ToList();
}
private void FireBullet(Ray laserRay)
{
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: 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)
//IL_0057: 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_0064: 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_007a: 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_008d: 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_00a9: 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_00bf: 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_00e2: 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_00f9: Expected O, but got Unknown
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
if (Object.op_Implicit((Object)(object)effectPrefab))
{
EffectManager.SimpleMuzzleFlash(effectPrefab, ((EntityState)this).gameObject, muzzleString, false);
}
if (((EntityState)this).isAuthority)
{
BulletAttack val = new BulletAttack
{
owner = ((EntityState)this).gameObject,
weapon = ((EntityState)this).gameObject,
origin = ((Ray)(ref laserRay)).origin,
aimVector = ((Ray)(ref laserRay)).direction,
minSpread = minSpread,
maxSpread = maxSpread,
bulletCount = 1u,
damage = base.damageStat,
procCoefficient = 1f / fireFrequency,
force = force,
muzzleName = muzzleString,
hitEffectPrefab = hitEffectPrefab,
isCrit = Util.CheckRoll(base.critStat, ((EntityState)this).characterBody.master),
HitEffectNormal = false,
maxDistance = maxDistance,
radius = 0f
};
DamageAPI.AddModdedDamageType(val, ChillDrone.chillOnHit);
val.Fire();
}
}
private void InitializeOptionDataStructure()
{
Item<GradiusOption>.instance.FireForAllOptions(((EntityState)this).characterBody, (Action<GameObject, OptionBehavior, GameObject, Vector3>)delegate(GameObject option, OptionBehavior behavior, GameObject _t, Vector3 _d)
{
if (behavior.O.ContainsKey("laserEffectInstances"))
{
List<GameObject> list = behavior.O["laserEffectInstances"] as List<GameObject>;
list.Clear();
}
else
{
behavior.O["laserEffectInstances"] = new List<GameObject>();
}
if (behavior.O.ContainsKey("laserEffectInstanceEndTransforms"))
{
List<Transform> list2 = behavior.O["laserEffectInstanceEndTransforms"] as List<Transform>;
list2.Clear();
}
else
{
behavior.O["laserEffectInstanceEndTransforms"] = new List<Transform>();
}
});
}
private void OptionsFire(Action<GameObject, OptionBehavior, GameObject, Vector3, List<GameObject>, List<Transform>> action)
{
Item<GradiusOption>.instance.FireForAllOptions(((EntityState)this).characterBody, (Action<GameObject, OptionBehavior, GameObject, Vector3>)delegate(GameObject option, OptionBehavior behavior, GameObject target, Vector3 direction)
{
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
if (behavior.O.ContainsKey("laserEffectInstances") && behavior.O.ContainsKey("laserEffectInstanceEndTransforms"))
{
List<GameObject> arg = behavior.O["laserEffectInstances"] as List<GameObject>;
List<Transform> arg2 = behavior.O["laserEffectInstanceEndTransforms"] as List<Transform>;
action(option, behavior, target, direction, arg, arg2);
}
});
}
private void OptionFireBullet(Ray laserRay, GameObject option)
{
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: 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_005d: 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_0072: 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_0084: 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_009c: 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_00bd: 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_00e4: 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_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Expected O, but got Unknown
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
if (Object.op_Implicit((Object)(object)effectPrefab))
{
Extensions.MuzzleEffect(option, effectPrefab, false);
}
if (((EntityState)this).isAuthority)
{
float damage = base.damageStat * Item<GradiusOption>.instance.damageMultiplier;
BulletAttack val = new BulletAttack
{
owner = ((EntityState)this).gameObject,
weapon = option,
origin = ((Ray)(ref laserRay)).origin,
aimVector = ((Ray)(ref laserRay)).direction,
minSpread = minSpread,
maxSpread = maxSpread,
bulletCount = 1u,
damage = damage,
procCoefficient = 1f / fireFrequency,
force = force * Item<GradiusOption>.instance.damageMultiplier,
muzzleName = muzzleString,
hitEffectPrefab = hitEffectPrefab,
isCrit = Util.CheckRoll(base.critStat, ((EntityState)this).characterBody.master),
HitEffectNormal = false,
maxDistance = maxDistance,
radius = 0f
};
DamageAPI.AddModdedDamageType(val, ChillDrone.chillOnHit);
val.Fire();
}
}
public override void OnEnter()
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: 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)
((BaseState)this).OnEnter();
InitializeOptionDataStructure();
Util.PlaySound(attackSoundString, ((EntityState)this).gameObject);
aimRay = ((BaseState)this).GetAimRay();
InitializeEnemyFinder();
if (!Object.op_Implicit((Object)(object)laserPrefab))
{
return;
}
modelTransform = ((EntityState)this).GetModelTransform();
if (!Object.op_Implicit((Object)(object)modelTransform))
{
return;
}
muzzleTransform = modelTransform.Find(muzzleString);
if (!Object.op_Implicit((Object)(object)muzzleTransform))
{
return;
}
for (int i = 0; i < results.Count; i++)
{
GameObject val = Object.Instantiate<GameObject>(laserPrefab, muzzleTransform.position, muzzleTransform.rotation);
val.transform.parent = muzzleTransform;
laserEffectInstances.Add(val);
laserEffectInstanceEndTransforms.Add(val.GetComponent<ChildLocator>().FindChild("LaserEnd"));
OptionsFire(delegate(GameObject option, OptionBehavior _b, GameObject _t, Vector3 _d, List<GameObject> laserEffects, List<Transform> laserEndTransforms)
{
GameObject val2 = Object.Instantiate<GameObject>(laserPrefab, option.transform);
val2.transform.parent = option.transform;
laserEffects.Add(val2);
laserEndTransforms.Add(val2.GetComponent<ChildLocator>().FindChild("LaserEnd"));
});
}
}
public override void FixedUpdate()
{
//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_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: 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_0137: 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_0164: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: Unknown result type (might be due to invalid IL or missing references)
//IL_0181: 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_01a4: Unknown result type (might be due to invalid IL or missing references)
//IL_019b: Unknown result type (might be due to invalid IL or missing references)
//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
((EntityState)this).FixedUpdate();
stopwatch += Time.fixedDeltaTime;
fireTimer += Time.fixedDeltaTime;
float num3 = fireFrequency * ((EntityState)this).characterBody.attackSpeed;
float num2 = 1f / num3;
Vector3 position = muzzleTransform.position;
Ray val3 = default(Ray);
RaycastHit val4 = default(RaycastHit);
for (int i = 0; i < results.Count; i++)
{
HurtBox hurtBox = results[i];
GameObject val = laserEffectInstances[i];
if (Object.op_Implicit((Object)(object)hurtBox) && Object.op_Implicit((Object)(object)hurtBox.healthComponent) && hurtBox.healthComponent.alive)
{
Transform val2 = laserEffectInstanceEndTransforms[i];
Vector3 position2 = ((Component)hurtBox).transform.position;
((Ray)(ref val3))..ctor(position, position2 - position);
if (fireTimer > num2)
{
FireBullet(val3);
}
if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val2))
{
Vector3 point = ((Ray)(ref val3)).GetPoint(maxDistance);
if (Util.CharacterRaycast(((EntityState)this).gameObject, val3, ref val4, maxDistance, LayerMask.op_Implicit(LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask) | LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask)), (QueryTriggerInteraction)0))
{
point = ((RaycastHit)(ref val4)).point;
}
val2.position = point;
}
OptionsFire(delegate(GameObject option, OptionBehavior _b, GameObject _t, Vector3 _d, List<GameObject> laserEffects, List<Transform> laserEndTransforms)
{
//IL_0019: 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)
//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_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: 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_0096: 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_009d: 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_009f: 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_00b1: 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_00dd: 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)
Transform val5 = laserEndTransforms[i];
Vector3 position3 = option.transform.position;
Vector3 position4 = ((Component)hurtBox).transform.position;
Ray laserRay = default(Ray);
((Ray)(ref laserRay))..ctor(position3, position4 - position3);
if (fireTimer > num2)
{
OptionFireBullet(laserRay, option);
}
if (Object.op_Implicit((Object)(object)laserEffects[i]) && Object.op_Implicit((Object)(object)val5))
{
Vector3 point2 = ((Ray)(ref laserRay)).GetPoint(maxDistance);
RaycastHit val6 = default(RaycastHit);
if (Physics.Raycast(position3, position4 - position3, ref val6, maxDistance, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask) | LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask), (QueryTriggerInteraction)0))
{
point2 = ((RaycastHit)(ref val6)).point;
}
val5.position = point2;
}
});
}
else if (Object.op_Implicit((Object)(object)val))
{
OptionsFire(delegate(GameObject option, OptionBehavior _b, GameObject _t, Vector3 _d, List<GameObject> laserEffects, List<Transform> laserEndTransforms)
{
EntityState.Destroy((Object)(object)laserEffects[i]);
laserEffects.RemoveAt(i);
laserEndTransforms.RemoveAt(i);
});
EntityState.Destroy((Object)(object)val);
results.RemoveAt(i);
laserEffectInstances.RemoveAt(i);
laserEffectInstanceEndTransforms.RemoveAt(i);
int num4 = i;
i = num4 - 1;
}
}
if (fireTimer > num2)
{
fireTimer = 0f;
}
if (((EntityState)this).isAuthority && (stopwatch >= duration || results.Count == 0))
{
((EntityState)this).outer.SetNextStateToMain();
}
}
public override void OnExit()
{
foreach (GameObject laserEffectInstance in laserEffectInstances)
{
if (Object.op_Implicit((Object)(object)laserEffectInstance))
{
EntityState.Destroy((Object)(object)laserEffectInstance);
}
}
laserEffectInstances.Clear();
laserEffectInstanceEndTransforms.Clear();
OptionsFire(delegate(GameObject _o, OptionBehavior _b, GameObject _t, Vector3 _d, List<GameObject> laserEffects, List<Transform> laserEndTransforms)
{
foreach (GameObject laserEffect in laserEffects)
{
if (Object.op_Implicit((Object)(object)laserEffect))
{
EntityState.Destroy((Object)(object)laserEffect);
}
}
laserEffects.Clear();
laserEndTransforms.Clear();
});
results.Clear();
((EntityState)this).OnExit();
}
}
}