using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using EntityStates;
using EntityStates.Captain.Weapon;
using EntityStates.Merc;
using JetBrains.Annotations;
using On.RoR2;
using R2API;
using R2API.Utils;
using Rewired.ComponentControls.Effects;
using RoR2;
using RoR2.Navigation;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.UI;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.Rendering;
[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 = "")]
[assembly: AssemblyCompany("WubsSkills")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("WubsSkills")]
[assembly: AssemblyTitle("WubsSkills")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace WubsSkills;
internal class Assets
{
public static AssetBundle MainAssetBundle;
public static T Load<T>(string name) where T : Object
{
return MainAssetBundle.LoadAsset<T>(name);
}
public static void PopulateAssets()
{
Assembly executingAssembly = Assembly.GetExecutingAssembly();
if ((Object)(object)MainAssetBundle == (Object)null)
{
using (Stream stream = executingAssembly.GetManifestResourceStream("WubsSkills.AssetBundle." + "WubsSkills".ToLower() + "assets"))
{
MainAssetBundle = AssetBundle.LoadFromStream(stream);
}
}
}
}
internal class Behaviour : MonoBehaviour
{
private CharacterBody body;
private void Awake()
{
body = ((Component)this).GetComponent<CharacterBody>();
}
}
internal class CapDroneTracker : MonoBehaviour
{
private CharacterBody body;
private bool droneDead = true;
public bool hasDroneMember;
public float missileFireInterval = 0.085f;
public float missileDist = 1.5f;
private float droneStopwatch = MainPlugin.capSecondaryDroneCooldown.Value;
private float memberStopwatch;
public MinionGroup minionGroup;
private bool secondarySelected;
private bool canSpawn = true;
public int minionCount;
private void Awake()
{
body = ((Component)this).GetComponent<CharacterBody>();
}
private void Start()
{
canSpawn = Object.op_Implicit((Object)(object)body.master.playerCharacterMasterController);
secondarySelected = body.skillLocator.secondary.skillDef.skillNameToken == "WUBSSKILLSCAP_M2";
if (secondarySelected && canSpawn)
{
MinionOwnership.onMinionGroupChangedGlobal += OnMinionGroupChangedGlobal;
}
}
private void OnDisable()
{
if (secondarySelected && canSpawn)
{
MinionOwnership.onMinionGroupChangedGlobal -= OnMinionGroupChangedGlobal;
}
}
private void OnMinionGroupChangedGlobal(MinionOwnership minion)
{
CheckMembers();
}
private void CheckMembers()
{
//IL_001b: 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)
if (minionGroup == null)
{
minionGroup = MinionGroup.FindGroup(((NetworkBehaviour)body.master).netId);
}
if (minionGroup == null)
{
hasDroneMember = false;
return;
}
int num = 0;
MinionOwnership[] members = minionGroup.members;
foreach (MinionOwnership val in members)
{
if (!Object.op_Implicit((Object)(object)val))
{
continue;
}
CharacterMaster component = ((Component)val).GetComponent<CharacterMaster>();
if (!Object.op_Implicit((Object)(object)component))
{
continue;
}
CharacterBody val2 = component.GetBody();
if (Object.op_Implicit((Object)(object)val2) && ((Enum)val2.bodyFlags).HasFlag((Enum)(object)(BodyFlags)2))
{
hasDroneMember = true;
if (!val2.baseNameToken.Contains("TURRET"))
{
num++;
}
}
}
if (num > 0)
{
minionCount = num;
}
else
{
hasDroneMember = false;
}
}
private void FixedUpdate()
{
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: 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_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Expected O, but got Unknown
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Expected O, but got Unknown
//IL_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Expected O, but got Unknown
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
if (!secondarySelected || !canSpawn)
{
return;
}
if (NetworkServer.active && droneDead)
{
droneStopwatch += Time.fixedDeltaTime;
if (droneStopwatch >= MainPlugin.capSecondaryDroneCooldown.Value)
{
droneStopwatch = 0f;
droneDead = false;
MasterSummon val = new MasterSummon
{
masterPrefab = Prefabs.capDroneMaster,
position = Utils.FindNearestNodePosition(((Component)this).transform.position, (GraphType)0),
rotation = Quaternion.identity,
summonerBodyObject = ((Component)this).gameObject,
ignoreTeamMemberLimit = true
};
if (body.level >= 25f)
{
}
CharacterMaster val2 = val.Perform();
val2.onBodyDestroyed += CharacterMaster_onBodyDestroyed;
Deployable val3 = ((Component)val2).gameObject.AddComponent<Deployable>();
val3.onUndeploy = new UnityEvent();
val3.onUndeploy.AddListener(new UnityAction(val2.TrueKill));
body.master.AddDeployable(val3, Prefabs.capDrone);
}
}
memberStopwatch += Time.fixedDeltaTime;
if (memberStopwatch >= 0.1f)
{
memberStopwatch = 0f;
CheckMembers();
}
}
private void CharacterMaster_onBodyDestroyed(CharacterBody body)
{
droneDead = true;
}
}
internal class CapDroneSkillDef : SkillDef
{
private class InstanceData : BaseSkillInstanceData
{
public CapDroneTracker behaviour;
}
public override BaseSkillInstanceData OnAssigned([NotNull] GenericSkill skillSlot)
{
return (BaseSkillInstanceData)(object)new InstanceData
{
behaviour = ((Component)skillSlot).GetComponent<CapDroneTracker>()
};
}
public override float GetRechargeInterval([NotNull] GenericSkill skillSlot)
{
InstanceData instanceData = (InstanceData)(object)skillSlot.skillInstanceData;
CapDroneTracker behaviour = instanceData.behaviour;
base.baseRechargeInterval = MainPlugin.capSecondaryCooldown.Value + 1.5f * (float)behaviour.minionCount;
float num = ((skillSlot.cooldownOverride > 0f) ? skillSlot.cooldownOverride : base.baseRechargeInterval);
float finalRechargeInterval = Mathf.Min(num, Mathf.Max(0.5f, num * skillSlot.cooldownScale - skillSlot.flatCooldownReduction)) + skillSlot.temporaryCooldownPenalty;
skillSlot.finalRechargeInterval = finalRechargeInterval;
return ((SkillDef)this).GetRechargeInterval(skillSlot);
}
internal static bool IsExecutable([NotNull] GenericSkill skillSlot)
{
InstanceData instanceData = (InstanceData)(object)skillSlot.skillInstanceData;
CapDroneTracker behaviour = instanceData.behaviour;
return behaviour.hasDroneMember;
}
public override bool CanExecute([NotNull] GenericSkill skillSlot)
{
return IsExecutable(skillSlot) && ((SkillDef)this).CanExecute(skillSlot);
}
public override bool IsReady([NotNull] GenericSkill skillSlot)
{
return ((SkillDef)this).IsReady(skillSlot) && IsExecutable(skillSlot);
}
}
internal class Hook
{
internal static void Hooks()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
HealthComponent.TakeDamage += new hook_TakeDamage(HealthComponent_TakeDamage);
}
private static void HealthComponent_TakeDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Invalid comparison between Unknown and I4
if ((int)damageInfo.damageColorIndex == 9 && Object.op_Implicit((Object)(object)self.body) && self.body.baseNameToken == "WUBSSKILLS_DRONE_NAME")
{
damageInfo.rejected = true;
}
orig.Invoke(self, damageInfo);
}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.Dragonyck.WubsSkills", "WubsSkills", "1.0.0")]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
public class MainPlugin : BaseUnityPlugin
{
public const string MODUID = "com.Dragonyck.WubsSkills";
public const string MODNAME = "WubsSkills";
public const string VERSION = "1.0.0";
public const string MODKEY = "WUBSSKILLS";
internal static ConfigFile captainCfg;
internal static ConfigEntry<bool> enableCap;
internal static ConfigEntry<bool> enableCapSecondary;
internal static ConfigEntry<float> capSecondaryCooldown;
internal static ConfigEntry<float> capSecondaryDamage;
internal static ConfigEntry<float> capSecondaryDroneCooldown;
private void Awake()
{
CreateConfigs();
Assets.PopulateAssets();
Prefabs.CreatePrefabs();
RegisterStates();
Hook.Hooks();
GameObject val = null;
SkillLocator val2 = null;
if (enableCap.Value)
{
val = Prefabs.Load<GameObject>("RoR2/Base/Captain/CaptainBody.prefab");
val.AddComponent<CapDroneTracker>();
val2 = val.GetComponent<SkillLocator>();
if (enableCapSecondary.Value)
{
CaptainSecondarySetup(val2);
}
}
}
private void RegisterStates()
{
//IL_0003: 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_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: 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)
bool flag = default(bool);
ContentAddition.AddEntityState<BaseSkill>(ref flag);
ContentAddition.AddEntityState<CharacterMain>(ref flag);
ContentAddition.AddEntityState<MeleeSkillState>(ref flag);
ContentAddition.AddEntityState<BasicMeleeSkillState>(ref flag);
ContentAddition.AddEntityState<CaptainSecondary>(ref flag);
}
private void CreateConfigs()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
captainCfg = new ConfigFile(Paths.ConfigPath + "\\WubsSkills\\Captain.cfg", true);
enableCap = captainCfg.Bind<bool>("General", "Enable Captain Skills", true, (ConfigDescription)null);
enableCapSecondary = captainCfg.Bind<bool>("Captain", "Enable Extra Artillery", true, (ConfigDescription)null);
capSecondaryCooldown = captainCfg.Bind<float>("Captain", "Extra Artillery Cooldown", 8f, (ConfigDescription)null);
capSecondaryDamage = captainCfg.Bind<float>("Captain", "Extra Artillery Damage", 1f, (ConfigDescription)null);
capSecondaryDroneCooldown = captainCfg.Bind<float>("Captain", "Extra Artillery Drone Cooldown", 45f, (ConfigDescription)null);
}
private void CaptainSecondarySetup(SkillLocator skillLocator)
{
LanguageAPI.Add("WUBSSKILLSCAP_M2", "Extra Artillery");
LanguageAPI.Add("WUBSSKILLSCAP_M2_DESCRIPTION", "Gain a passive drone that respawns every <style=cIsUtility>" + capSecondaryDroneCooldown.Value + "s</style>. Fire missiles from all of your drones for <style=cIsDamage>4x" + capSecondaryDamage.Value * 100f + "% damage</style>. Must have an active drone to activate. Increased cooldown for each ally drone.");
SkillDef skillDef = Utils.NewSkillDef<CapDroneSkillDef>(typeof(CaptainSecondary), "Weapon", 1, capSecondaryCooldown.Value, beginSkillCooldownOnSkillEnd: true, canceledFromSprinting: false, fullRestockOnAssign: false, (InterruptPriority)1, isCombatSkill: true, mustKeyPress: true, cancelSprintingOnActivation: false, 1, 1, 1, Assets.Load<Sprite>("capSecondary"), "WUBSSKILLSCAP_M2_DESCRIPTION", "WUBSSKILLSCAP_M2", Array.Empty<string>());
Utils.AddAlt(skillLocator.secondary.skillFamily, skillDef);
}
}
internal class Prefabs
{
internal static GameObject capDroneBody;
internal static GameObject capDroneMaster;
internal static GameObject missileProjectile;
internal static DeployableSlot capDrone;
internal static int CapDroneDeployableCount(CharacterMaster master, int count)
{
return 1;
}
internal static void CreatePrefabs()
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
//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_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_0167: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
//IL_0185: 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_01a1: Unknown result type (might be due to invalid IL or missing references)
//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
//IL_0281: Unknown result type (might be due to invalid IL or missing references)
//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
if (MainPlugin.enableCap.Value)
{
capDrone = DeployableAPI.RegisterDeployableSlot(new GetDeployableSameSlotLimit(CapDroneDeployableCount));
missileProjectile = Instantiate("RoR2/Base/Common/MissileProjectile.prefab", "WUBSSKILLSMissileProjectile", registerNetwork: true);
missileProjectile.GetComponent<ProjectileController>().procCoefficient = 0.75f;
ContentAddition.AddProjectile(missileProjectile);
LanguageAPI.Add("WUBSSKILLS_DRONE_NAME", "Rusty");
capDroneBody = Instantiate("RoR2/Base/Drones/Drone1Body.prefab", "CapDroneBody", registerNetwork: true);
CharacterBody component = capDroneBody.GetComponent<CharacterBody>();
component.baseDamage = 9f;
component.baseMaxHealth = 135f;
component.baseNameToken = "WUBSSKILLS_DRONE_NAME";
component.portraitIcon = (Texture)(object)Assets.Load<Sprite>("droneportrait").texture;
capDroneBody.GetComponent<HealthComponent>().health = component.baseMaxHealth;
ModelLocator component2 = capDroneBody.GetComponent<ModelLocator>();
ChildLocator component3 = ((Component)component2.modelTransform).GetComponent<ChildLocator>();
((Component)component3.FindChild("Muzzle")).transform.localPosition = new Vector3(0f, 2.5f, -0.4f);
CharacterModel component4 = ((Component)component2.modelTransform).GetComponent<CharacterModel>();
EnumerableExtensions.ForEachTry<Renderer>((IEnumerable<Renderer>)((Component)component2.modelTransform).GetComponentsInChildren<Renderer>(), (Action<Renderer>)delegate(Renderer x)
{
((Component)x).gameObject.SetActive(false);
}, (IDictionary<Renderer, Exception>)null);
GameObject val = Object.Instantiate<GameObject>(Assets.Load<GameObject>("droneMdl"), component2.modelTransform.position, Quaternion.identity, component2.modelTransform);
val.transform.localPosition = Vector3.up * 0.2f;
val.transform.localScale = Vector3.one * 0.65f;
val.transform.localRotation = Quaternion.Euler(Vector3.up * 200f);
component3 = val.GetComponent<ChildLocator>();
Material material = Load<Material>("RoR2/Base/Common/TrimSheets/matTrimSheetAlien2Lichen.mat");
((Component)component3.FindChild("base")).GetComponent<Renderer>().material = material;
((Component)component3.FindChild("drone")).GetComponent<Renderer>().material = Load<Material>("RoR2/Base/Common/TrimSheets/matTrimSheetConstruction.mat");
((Component)component3.FindChild("hat")).GetComponent<Renderer>().material = Load<Material>("RoR2/Base/Common/TrimSheets/matTrimSheetAlien1BossEmissionDirty.mat");
((Component)component3.FindChild("weapon")).GetComponent<Renderer>().material = material;
MeshRenderer[] componentsInChildren = val.GetComponentsInChildren<MeshRenderer>();
List<RendererInfo> list = new List<RendererInfo>();
MeshRenderer[] array = componentsInChildren;
foreach (MeshRenderer val2 in array)
{
list.Add(new RendererInfo
{
renderer = (Renderer)(object)val2,
defaultMaterial = ((Renderer)val2).material,
ignoreOverlays = false,
defaultShadowCastingMode = (ShadowCastingMode)1,
hideOnDeath = false
});
}
component4.baseRendererInfos = list.ToArray();
ContentAddition.AddBody(capDroneBody);
capDroneMaster = Instantiate("RoR2/Base/Drones/Drone1Master.prefab", "CapDroneMaster", registerNetwork: true);
CharacterMaster component5 = capDroneMaster.GetComponent<CharacterMaster>();
component5.bodyPrefab = capDroneBody;
Object.Destroy((Object)(object)capDroneMaster.GetComponent<SetDontDestroyOnLoad>());
ContentAddition.AddMaster(capDroneMaster);
}
}
internal static T Load<T>(string path)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
return Addressables.LoadAssetAsync<T>((object)path).WaitForCompletion();
}
internal static GameObject Instantiate(string path, string name, bool registerNetwork = false)
{
return PrefabAPI.InstantiateClone(Load<GameObject>(path), name, registerNetwork);
}
internal static GameObject Instantiate(GameObject obj, string name, bool registerNetwork = false)
{
return PrefabAPI.InstantiateClone(obj, name, registerNetwork);
}
}
internal class BaseSkill : BaseSkillState
{
private float duration;
private float baseDuration = 0.35f;
public override void OnEnter()
{
((BaseState)this).OnEnter();
duration = baseDuration / ((BaseState)this).attackSpeedStat;
}
public override void FixedUpdate()
{
((EntityState)this).FixedUpdate();
if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority)
{
((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;
}
}
internal class BasicMeleeSkillState : BaseSkillState
{
private float duration = 0.2f;
private Vector3 dir;
private OverlapAttack attack;
private float damageCoefficient = 4.2f;
private GameObject hitEffectPrefab = null;
private bool parried;
public Animator animator;
private uint ID;
private string hitboxGroupName = "";
public override void OnEnter()
{
((BaseState)this).OnEnter();
animator = ((EntityState)this).GetModelAnimator();
if (!animator.GetBool("slide"))
{
((BaseState)this).StartAimMode(1f, true);
}
((EntityState)this).PlayAnimation("LeftArm, Override", "MeleeAttack");
AkSoundEngine.PostEvent(ID, ((EntityState)this).gameObject);
attack = ((BaseState)this).InitMeleeOverlap(damageCoefficient, hitEffectPrefab, ((EntityState)this).GetModelTransform(), hitboxGroupName);
}
public override void FixedUpdate()
{
((EntityState)this).FixedUpdate();
if (((EntityState)this).isAuthority)
{
attack.Fire((List<HurtBox>)null);
}
if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority)
{
((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;
}
}
internal class CaptainSecondary : BaseSkillState
{
private float duration = 0.35f;
private CapDroneTracker droneTracker;
private List<CharacterBody> drones = new List<CharacterBody>();
private float damageCoefficient = MainPlugin.capSecondaryDamage.Value;
private float stopwatch;
private int fireCount;
private GameObject projectilePrefab = Prefabs.Load<GameObject>("RoR2/Base/Drones/MicroMissileProjectile.prefab");
private Animator animator;
private float fireInterval => droneTracker.missileFireInterval;
public override void OnEnter()
{
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
((BaseState)this).OnEnter();
droneTracker = ((EntityState)this).GetComponent<CapDroneTracker>();
if (droneTracker.minionGroup == null)
{
((EntityState)this).outer.SetNextStateToMain();
return;
}
AkSoundEngine.PostEvent(CallAirstrikeBase.fireAirstrikeSoundString, ((EntityState)this).gameObject);
animator = ((EntityState)this).GetModelAnimator();
animator.SetBool(SetupAirstrike.PrepAirstrikeHash, true);
((EntityState)this).PlayCrossfade("Gesture, Override", SetupAirstrike.PrepAirstrikeHash, 0.1f);
((EntityState)this).PlayCrossfade("Gesture, Additive", SetupAirstrike.PrepAirstrikeHash, 0.1f);
MinionOwnership[] members = droneTracker.minionGroup.members;
foreach (MinionOwnership val in members)
{
if (!Object.op_Implicit((Object)(object)val))
{
continue;
}
CharacterMaster component = ((Component)val).GetComponent<CharacterMaster>();
if (Object.op_Implicit((Object)(object)component))
{
CharacterBody body = component.GetBody();
if (Object.op_Implicit((Object)(object)body) && ((Enum)body.bodyFlags).HasFlag((Enum)(object)(BodyFlags)2))
{
drones.Add(body);
}
}
}
FireMissiles();
}
private void FireMissiles()
{
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
fireCount++;
if (!((EntityState)this).isAuthority)
{
return;
}
foreach (CharacterBody drone in drones)
{
MissileUtils.FireMissile(drone.corePosition + Vector3.up * droneTracker.missileDist, ((EntityState)this).characterBody, default(ProcChainMask), (GameObject)null, ((BaseState)this).damageStat * damageCoefficient, ((BaseState)this).RollCrit(), Prefabs.missileProjectile, (DamageColorIndex)0, false);
}
}
public override void FixedUpdate()
{
((EntityState)this).FixedUpdate();
stopwatch += Time.fixedDeltaTime;
if (fireCount < 4 && stopwatch >= fireInterval)
{
stopwatch = 0f;
FireMissiles();
}
if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority)
{
((EntityState)this).outer.SetNextStateToMain();
}
}
public override void OnExit()
{
animator.SetBool(SetupAirstrike.PrepAirstrikeHash, false);
((EntityState)this).PlayCrossfade("Gesture, Override", CallAirstrike3.CallAirstrike3StateHash, 0.1f);
((EntityState)this).PlayCrossfade("Gesture, Additive", CallAirstrike3.CallAirstrike3StateHash, 0.1f);
((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;
}
}
internal class CharacterMain : GenericCharacterMain
{
}
internal class MeleeSkillState : BaseSkillState
{
public float attackDuration;
private bool hopped;
private bool hasSwung;
public bool isInHitPause;
public float hitPauseDuration;
public float hopVelocity;
public float hitPauseTimer;
public float stopwatch;
public HitStopCachedState hitStopCachedState;
public OverlapAttack overlapAttack;
public bool hasHit;
private bool hasAnimParameter;
private float attackSpeedScaling;
public Animator animator;
public virtual float baseAttackDuration => 0f;
public virtual float earlyExitDurationPercentage => 0f;
public virtual float damageCoefficient => 0f;
public virtual float forceMagnitude => 440f;
public virtual float rootMotionSpeed => 25f;
public virtual float baseHopVelocity => 4f;
public virtual string layerName => "Gesture, Override";
public virtual string animationStateName => "";
public virtual string animParameter => "M1";
public virtual string hitBoxGroupName => "";
public virtual string hitBoxActiveParameter => "Curve";
public virtual string swingMuzzle => "";
public virtual GameObject swingEffectPrefab => null;
public virtual bool hopOnHit => true;
public virtual bool rootMotion => false;
public virtual bool rootMotionWhileHitting => false;
public virtual string swingSound => "";
public virtual DamageType damageType => (DamageType)0;
public virtual DamageColorIndex damageColor => (DamageColorIndex)0;
public virtual Vector3 bonusForce => Vector3.zero;
public virtual GameObject hitEffectPrefab => null;
public override void OnEnter()
{
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
((BaseState)this).OnEnter();
attackSpeedScaling = Math.Min(((BaseState)this).attackSpeedStat, 6f);
attackDuration = baseAttackDuration / attackSpeedScaling;
hitPauseDuration = GroundLight.hitPauseDuration / attackSpeedScaling;
hopVelocity = baseHopVelocity / attackSpeedScaling;
animator = ((EntityState)this).GetModelAnimator();
animator.SetFloat(hitBoxActiveParameter, 0f);
overlapAttack = ((BaseState)this).InitMeleeOverlap(damageCoefficient, hitEffectPrefab, ((EntityState)this).GetModelTransform(), hitBoxGroupName);
overlapAttack.pushAwayForce = 1f;
overlapAttack.damageType = DamageTypeCombo.op_Implicit(damageType);
hasAnimParameter = !Utility.IsNullOrWhiteSpace(animParameter);
if (hasAnimParameter && !Utility.IsNullOrWhiteSpace(animationStateName))
{
((EntityState)this).PlayAnimation(layerName, animationStateName, animParameter, attackDuration, 0f);
}
}
public virtual Vector3 rootMotionDirection()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
return ((EntityState)this).characterDirection.forward;
}
public override void FixedUpdate()
{
//IL_0030: 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_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_0195: Unknown result type (might be due to invalid IL or missing references)
//IL_019a: Unknown result type (might be due to invalid IL or missing references)
((EntityState)this).FixedUpdate();
if (((EntityState)this).isAuthority)
{
bool flag = FireMeleeAttack(overlapAttack, animator, hitBoxActiveParameter, forceMagnitude, bonusForce);
hasHit = flag;
if (hasHit)
{
if (hopOnHit && !((EntityState)this).characterMotor.isGrounded && !hopped)
{
((BaseState)this).SmallHop(((EntityState)this).characterMotor, hopVelocity);
hopped = true;
}
if (!rootMotionWhileHitting && !isInHitPause && hasAnimParameter)
{
isInHitPause = true;
}
}
if (animator.GetFloat(hitBoxActiveParameter) > 0.1f && rootMotion && !isInHitPause)
{
Vector3 val = rootMotionDirection();
CharacterMotor characterMotor = ((EntityState)this).characterMotor;
characterMotor.rootMotion += val * rootMotionSpeed * Time.fixedDeltaTime;
}
if (hitPauseTimer >= hitPauseDuration && isInHitPause)
{
isInHitPause = false;
animator.speed = 1f;
}
if (!isInHitPause)
{
stopwatch += Time.fixedDeltaTime;
}
else
{
hitPauseTimer += Time.fixedDeltaTime;
((EntityState)this).characterMotor.velocity = Vector3.zero;
animator.speed = 0f;
}
if (stopwatch >= attackDuration * earlyExitDurationPercentage)
{
if (((EntityState)this).inputBank.skill1.down)
{
SetState();
}
if (stopwatch >= attackDuration)
{
BaseSkillState val2 = StateOverride();
if (val2 != null)
{
((EntityState)this).outer.SetNextState((EntityState)(object)val2);
}
else
{
((EntityState)this).outer.SetNextStateToMain();
}
return;
}
}
}
if (animator.GetFloat(hitBoxActiveParameter) >= 0.11f && !hasSwung)
{
hasSwung = true;
AkSoundEngine.PostEvent(swingSound, ((EntityState)this).gameObject);
if (Object.op_Implicit((Object)(object)swingEffectPrefab) && !Utility.IsNullOrWhiteSpace(swingMuzzle))
{
EffectManager.SimpleMuzzleFlash(swingEffectPrefab, ((EntityState)this).gameObject, swingMuzzle, false);
}
}
}
public bool FireMeleeAttack(OverlapAttack attack, Animator animator, string mecanimHitboxActiveParameter, float forceMagnitude, Vector3 bonusForce)
{
//IL_0042: 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_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_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)
bool result = false;
if (Object.op_Implicit((Object)(object)animator) && animator.GetFloat(mecanimHitboxActiveParameter) > 0.1f)
{
attack.forceVector = (Object.op_Implicit((Object)(object)((EntityState)this).characterDirection) ? ((EntityState)this).characterDirection.forward : ((EntityState)this).transform.forward) * forceMagnitude + bonusForce;
result = attack.Fire((List<HurtBox>)null);
}
return result;
}
public virtual void SetState()
{
}
public virtual BaseSkillState StateOverride()
{
return null;
}
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;
}
}
internal static class Extensions
{
public static GameObject NewSyringe(this GameObject g, params Material[] m)
{
((Renderer)g.GetComponentsInChildren<MeshRenderer>(false)[0]).material = m[0];
((Renderer)g.GetComponent<TrailRenderer>()).material = m[1];
((Renderer)g.GetComponent<ParticleSystemRenderer>()).material = m[2];
return g;
}
public static Material SwapTexture(this Material m, Texture2D t)
{
m.mainTexture = (Texture)(object)t;
return m;
}
public static GameObject SwapMaterials(this GameObject g, Material[] m)
{
Renderer[] componentsInChildren = g.GetComponentsInChildren<Renderer>();
for (int i = 0; i < componentsInChildren.Length; i++)
{
if (Object.op_Implicit((Object)(object)m[i]))
{
componentsInChildren[i].material = m[i];
}
}
return g;
}
public static float Mult(this float f, float mult = 100f)
{
return f * mult;
}
public static Color ToRGB255(this Color c, string title, string body)
{
//IL_0001: 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_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
return new Color(c.r / 255f, c.g / 255f, c.b / 255f);
}
public static void SetStrings(this TooltipProvider t, string title, string body)
{
t.overrideTitleText = title;
t.overrideBodyText = body;
}
}
internal class Utils
{
internal static void RecolorEffect(GameObject obj, Color color)
{
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
if (!Object.op_Implicit((Object)(object)obj))
{
return;
}
OmniEffect component = obj.GetComponent<OmniEffect>();
if (Object.op_Implicit((Object)(object)component))
{
Object.DestroyImmediate((Object)(object)obj.GetComponent<OmniEffect>());
}
Renderer[] componentsInChildren = obj.GetComponentsInChildren<Renderer>(Object.op_Implicit((Object)(object)component));
for (int i = 0; i < componentsInChildren.Length; i++)
{
((Component)componentsInChildren[i]).gameObject.SetActive(true);
if (Object.op_Implicit((Object)(object)componentsInChildren[i].material) && componentsInChildren[i].material.HasProperty("_TintColor"))
{
componentsInChildren[i].material.SetColor("_TintColor", color);
}
}
}
public static Vector3 FindNearestNodePosition(Vector3 targetPosition, GraphType nodeGraphType)
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_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_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_003a: 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_004a: Expected O, but got Unknown
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Expected O, but got Unknown
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
SpawnCard val = ScriptableObject.CreateInstance<SpawnCard>();
val.hullSize = (HullClassification)1;
val.nodeGraphType = nodeGraphType;
val.prefab = Prefabs.Load<GameObject>("RoR2/Base/Common/DirectorSpawnProbeHelperPrefab.prefab");
Vector3 result = targetPosition;
GameObject val2 = DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest(val, new DirectorPlacementRule
{
placementMode = (PlacementMode)3,
position = targetPosition
}, RoR2Application.rng));
if (Object.op_Implicit((Object)(object)val2))
{
result = val2.transform.position;
}
if (Object.op_Implicit((Object)(object)val2))
{
Object.Destroy((Object)(object)val2);
}
Object.Destroy((Object)(object)val);
return result;
}
public static Vector3 GetForwardDirection(Vector3 dir)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
Vector2 val = Util.Vector3XZToVector2XY(dir);
if (val != Vector2.zero)
{
((Vector2)(ref val)).Normalize();
Vector3 val2 = new Vector3(val.x, 0f, val.y);
return ((Vector3)(ref val2)).normalized;
}
return dir;
}
public static void PlayAnimation(GameObject g, string layerName, string animationStateName)
{
Animator component = g.GetComponent<Animator>();
if (Object.op_Implicit((Object)(object)component))
{
int layerIndex = component.GetLayerIndex(layerName);
component.speed = 1f;
component.Update(0f);
component.PlayInFixedTime(animationStateName, layerIndex, 0f);
}
}
public static void PlayAnimation(GameObject g, string layerName, string animationStateName, string playbackRateParam, float duration)
{
//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)
Animator component = g.GetComponent<Animator>();
if (Object.op_Implicit((Object)(object)component))
{
component.speed = 1f;
component.Update(0f);
int layerIndex = component.GetLayerIndex(layerName);
component.SetFloat(playbackRateParam, 1f);
component.PlayInFixedTime(animationStateName, layerIndex, 0f);
component.Update(0f);
AnimatorStateInfo currentAnimatorStateInfo = component.GetCurrentAnimatorStateInfo(layerIndex);
float length = ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).length;
component.SetFloat(playbackRateParam, length / duration);
}
}
public static void AnimatorPlayAnimation(Animator modelAnimator, string layerName, string animationStateName)
{
int layerIndex = modelAnimator.GetLayerIndex(layerName);
modelAnimator.speed = 1f;
modelAnimator.Update(0f);
modelAnimator.PlayInFixedTime(animationStateName, layerIndex, 0f);
}
public static void AnimatorPlayAnimation(Animator modelAnimator, string layerName, string animationStateName, string playbackRateParam, float duration)
{
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
modelAnimator.speed = 1f;
modelAnimator.Update(0f);
int layerIndex = modelAnimator.GetLayerIndex(layerName);
modelAnimator.SetFloat(playbackRateParam, 1f);
modelAnimator.PlayInFixedTime(animationStateName, layerIndex, 0f);
modelAnimator.Update(0f);
AnimatorStateInfo currentAnimatorStateInfo = modelAnimator.GetCurrentAnimatorStateInfo(layerIndex);
float length = ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).length;
modelAnimator.SetFloat(playbackRateParam, length / duration);
}
public static SkillDef NewSkillDef<T>(Type activationState, string activationStateMachineName, int baseMaxStock, float baseRechargeInterval, bool beginSkillCooldownOnSkillEnd, bool canceledFromSprinting, bool fullRestockOnAssign, InterruptPriority interruptPriority, bool isCombatSkill, bool mustKeyPress, bool cancelSprintingOnActivation, int rechargeStock, int requiredStock, int stockToConsume, Sprite icon, string skillDescriptionToken, string skillName, params string[] keywordTokens) where T : SkillDef
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
T val = ScriptableObject.CreateInstance<T>();
((SkillDef)val).activationState = new SerializableEntityStateType(activationState);
((SkillDef)val).activationStateMachineName = activationStateMachineName;
((SkillDef)val).baseMaxStock = baseMaxStock;
((SkillDef)val).baseRechargeInterval = baseRechargeInterval;
((SkillDef)val).beginSkillCooldownOnSkillEnd = beginSkillCooldownOnSkillEnd;
((SkillDef)val).canceledFromSprinting = canceledFromSprinting;
((SkillDef)val).fullRestockOnAssign = fullRestockOnAssign;
((SkillDef)val).interruptPriority = interruptPriority;
((SkillDef)val).isCombatSkill = isCombatSkill;
((SkillDef)val).mustKeyPress = mustKeyPress;
((SkillDef)val).cancelSprintingOnActivation = cancelSprintingOnActivation;
((SkillDef)val).rechargeStock = rechargeStock;
((SkillDef)val).requiredStock = requiredStock;
((SkillDef)val).stockToConsume = stockToConsume;
((SkillDef)val).icon = icon;
((SkillDef)val).skillDescriptionToken = skillDescriptionToken;
((SkillDef)val).skillName = skillName;
((SkillDef)val).skillNameToken = ((SkillDef)val).skillName;
((SkillDef)val).keywordTokens = keywordTokens;
ContentAddition.AddSkillDef((SkillDef)(object)val);
return (SkillDef)(object)val;
}
public static Color HexTo10(string hexColor)
{
//IL_0025: 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_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_0039: Unknown result type (might be due to invalid IL or missing references)
char[] array = hexColor.ToCharArray();
return new Color((float)(array[0] + array[1]), (float)(array[2] + array[3]), (float)(array[4] + array[5]), 255f) / 255f;
}
public static EntityStateMachine NewStateMachine<T>(GameObject obj, string customName) where T : EntityState
{
//IL_0021: 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_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
SerializableEntityStateType val = default(SerializableEntityStateType);
((SerializableEntityStateType)(ref val))..ctor(typeof(T));
EntityStateMachine val2 = obj.AddComponent<EntityStateMachine>();
val2.customName = customName;
val2.initialStateType = val;
val2.mainStateType = val;
return val2;
}
public static GenericSkill NewGenericSkill(GameObject obj, SkillDef skill)
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Expected O, but got Unknown
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
GenericSkill val = obj.AddComponent<GenericSkill>();
SkillFamily val2 = ScriptableObject.CreateInstance<SkillFamily>();
val2.variants = (Variant[])(object)new Variant[1];
val._skillFamily = val2;
SkillFamily skillFamily = val.skillFamily;
Variant[] variants = skillFamily.variants;
Variant val3 = new Variant
{
skillDef = skill
};
((Variant)(ref val3)).viewableNode = new Node(skill.skillNameToken, false, (Node)null);
variants[0] = val3;
ContentAddition.AddSkillFamily(skillFamily);
return val;
}
public static void AddAlt(SkillFamily skillFamily, SkillDef SkillDef)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Expected O, but got Unknown
//IL_004c: 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)
Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1);
Variant[] variants = skillFamily.variants;
int num = skillFamily.variants.Length - 1;
Variant val = new Variant
{
skillDef = SkillDef
};
((Variant)(ref val)).viewableNode = new Node(SkillDef.skillNameToken, false, (Node)null);
variants[num] = val;
}
public static BuffDef NewBuffDef(string name, bool stack, bool hidden, Sprite sprite, Color color)
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
BuffDef val = ScriptableObject.CreateInstance<BuffDef>();
((Object)val).name = name;
val.canStack = stack;
val.isHidden = hidden;
val.iconSprite = sprite;
val.buffColor = color;
ContentAddition.AddBuffDef(val);
return val;
}
public static ObjectScaleCurve AddScaleComponent(GameObject target, float timeMax)
{
ObjectScaleCurve val = target.AddComponent<ObjectScaleCurve>();
val.useOverallCurveOnly = true;
val.timeMax = timeMax;
val.overallCurve = AnimationCurve.Linear(0f, 0f, 1f, 1f);
return val;
}
public static RotateAroundAxis AddRotationComponent(GameObject target, float speed, RotationAxis axis)
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
RotateAroundAxis val = target.AddComponent<RotateAroundAxis>();
val.speed = (Speed)2;
val.fastRotationSpeed = speed;
val.rotateAroundAxis = axis;
return val;
}
public static GameObject NewDisplayModel(GameObject model, string name)
{
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Expected O, but got Unknown
GameObject val = PrefabAPI.InstantiateClone(model, name, false);
Animator componentInChildren = val.GetComponentInChildren<Animator>();
componentInChildren.runtimeAnimatorController = Assets.Load<RuntimeAnimatorController>("displayAnimator");
((Behaviour)val.GetComponentInChildren<CharacterModel>()).enabled = false;
SkinnedMeshRenderer[] componentsInChildren = val.GetComponentsInChildren<SkinnedMeshRenderer>(true);
foreach (SkinnedMeshRenderer val2 in componentsInChildren)
{
((Renderer)val2).material = new Material(((Renderer)val2).material);
((Renderer)val2).material.DisableKeyword("DITHER");
}
return val;
}
public static AnimateShaderAlpha AddShaderAlphaComponent(GameObject target, float timeMax, AnimationCurve curve, bool destroyOnEnd = true, bool disableOnEnd = false)
{
AnimateShaderAlpha val = target.AddComponent<AnimateShaderAlpha>();
val.timeMax = timeMax;
val.alphaCurve = curve;
val.destroyOnEnd = destroyOnEnd;
val.disableOnEnd = disableOnEnd;
return val;
}
internal static Sprite CreateSprite(Texture2D tex)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
return Sprite.Create(tex, new Rect(0f, 0f, (float)((Texture)tex).width, (float)((Texture)tex).height), new Vector2(0.5f, 0.5f), 128f);
}
internal static SkinDefInfo CreateNewSkinDefInfo(SkinnedMeshRenderer[] childList, GameObject rootObject, string skinName, string objectToEnable, RendererInfo[] rendererInfos, UnlockableDef unlockableDef = null)
{
//IL_0003: 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_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: 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)
SkinDefInfo result = default(SkinDefInfo);
result.BaseSkins = Array.Empty<SkinDef>();
result.MinionSkinReplacements = (MinionSkinReplacement[])(object)new MinionSkinReplacement[0];
result.ProjectileGhostReplacements = (ProjectileGhostReplacement[])(object)new ProjectileGhostReplacement[0];
List<GameObjectActivation> list = new List<GameObjectActivation>();
foreach (SkinnedMeshRenderer val in childList)
{
GameObjectActivation val2 = default(GameObjectActivation);
val2.gameObject = ((Component)val).gameObject;
val2.shouldActivate = ((Object)val).name.Contains(objectToEnable);
GameObjectActivation item = val2;
list.Add(item);
}
result.GameObjectActivations = list.ToArray();
result.Icon = Assets.MainAssetBundle.LoadAsset<Sprite>(objectToEnable);
result.MeshReplacements = (MeshReplacement[])(object)new MeshReplacement[0];
result.Name = skinName;
result.NameToken = skinName;
result.RendererInfos = rendererInfos;
result.RootObject = rootObject;
result.UnlockableDef = unlockableDef;
return result;
}
internal static T CopyComponent<T>(T original, GameObject destination) where T : Component
{
Type type = ((object)original).GetType();
Component val = destination.AddComponent(type);
FieldInfo[] fields = type.GetFields();
FieldInfo[] array = fields;
foreach (FieldInfo fieldInfo in array)
{
fieldInfo.SetValue(val, fieldInfo.GetValue(original));
}
return (T)(object)((val is T) ? val : null);
}
public static Sprite CreateSpriteFromTexture(Texture2D texture)
{
//IL_0025: 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)
if (Object.op_Implicit((Object)(object)texture))
{
return Sprite.Create(texture, new Rect(0f, 0f, (float)((Texture)texture).width, (float)((Texture)texture).height), new Vector2(0.5f, 0.5f));
}
return null;
}
public static GameObject FindInActiveObjectByName(string name)
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Invalid comparison between Unknown and I4
Transform[] array = Resources.FindObjectsOfTypeAll<Transform>();
for (int i = 0; i < array.Length; i++)
{
if ((int)((Object)array[i]).hideFlags == 0 && ((Object)array[i]).name == name)
{
return ((Component)array[i]).gameObject;
}
}
return null;
}
public static void CreateHitboxes(string name, Transform parent, Vector3[] sizes, Vector3[] positions)
{
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Expected O, but got Unknown
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: 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_0082: Unknown result type (might be due to invalid IL or missing references)
HitBoxGroup val = ((Component)parent).gameObject.AddComponent<HitBoxGroup>();
val.groupName = name;
List<HitBox> list = new List<HitBox>();
for (int i = 0; i < sizes.Length; i++)
{
GameObject val2 = new GameObject(name + (i + 1));
val2.transform.SetParent(parent);
val2.transform.localPosition = positions[i];
val2.transform.localRotation = Quaternion.Euler(Vector3.forward * 45f);
val2.transform.localScale = sizes[i];
HitBox item = val2.AddComponent<HitBox>();
val2.layer = LayerIndex.projectile.intVal;
list.Add(item);
}
val.hitBoxes = list.ToArray();
}
public static GameObject CreateHitbox(string name, Transform parent, Vector3 scale, Vector3 localPosition)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
//IL_001b: 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_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: 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)
GameObject val = new GameObject(name);
val.transform.SetParent(parent);
val.transform.localPosition = localPosition;
val.transform.localRotation = Quaternion.Euler(Vector3.forward * 45f);
val.transform.localScale = scale;
HitBoxGroup val2 = ((Component)parent).gameObject.AddComponent<HitBoxGroup>();
HitBox val3 = val.AddComponent<HitBox>();
val.layer = LayerIndex.projectile.intVal;
val2.hitBoxes = (HitBox[])(object)new HitBox[1] { val3 };
val2.groupName = name;
return val;
}
internal static EffectComponent RegisterEffect(GameObject effect, float duration, string soundName = "", bool applyScale = false, bool parentToReferencedTransform = true, bool positionAtReferencedTransform = true)
{
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
EffectComponent val = effect.GetComponent<EffectComponent>();
if (!Object.op_Implicit((Object)(object)val))
{
val = effect.AddComponent<EffectComponent>();
}
if (duration != -1f)
{
DestroyOnTimer component = effect.GetComponent<DestroyOnTimer>();
if (!Object.op_Implicit((Object)(object)component))
{
effect.AddComponent<DestroyOnTimer>().duration = duration;
}
else
{
component.duration = duration;
}
}
if (!Object.op_Implicit((Object)(object)effect.GetComponent<NetworkIdentity>()))
{
effect.AddComponent<NetworkIdentity>();
}
if (!Object.op_Implicit((Object)(object)effect.GetComponent<VFXAttributes>()))
{
effect.AddComponent<VFXAttributes>().vfxPriority = (VFXPriority)2;
}
val.applyScale = applyScale;
val.effectIndex = (EffectIndex)(-1);
val.parentToReferencedTransform = parentToReferencedTransform;
val.positionAtReferencedTransform = positionAtReferencedTransform;
val.soundName = soundName;
ContentAddition.AddEffect(effect);
return val;
}
public static Material InstantiateMaterial(Texture tex)
{
//IL_0022: 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)
Material val = Object.Instantiate<Material>(Prefabs.Load<Material>("RoR2/Base/Commando/matCommandoDualies.mat"));
if (Object.op_Implicit((Object)(object)val))
{
val.SetColor("_Color", Color.white);
val.SetTexture("_MainTex", tex);
val.SetColor("_EmColor", Color.black);
val.SetFloat("_EmPower", 0f);
val.SetTexture("_EmTex", (Texture)null);
val.SetFloat("_NormalStrength", 1f);
val.SetTexture("_NormalTex", (Texture)null);
return val;
}
return val;
}
public static Material InstantiateMaterial(Color color, Texture tex, Color emColor, float emPower, Texture emTex, float normStr, Texture normTex)
{
//IL_0037: 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)
Material val = Object.Instantiate<Material>(LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterBodies/CommandoBody").GetComponentInChildren<CharacterModel>().baseRendererInfos[0].defaultMaterial);
if (Object.op_Implicit((Object)(object)val))
{
val.SetColor("_Color", color);
val.SetTexture("_MainTex", tex);
val.SetColor("_EmColor", emColor);
val.SetFloat("_EmPower", emPower);
val.SetTexture("_EmTex", emTex);
val.SetFloat("_NormalStrength", 1f);
val.SetTexture("_NormalTex", normTex);
return val;
}
return val;
}
public static Material FindMaterial(string name)
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Invalid comparison between Unknown and I4
Material[] array = Resources.FindObjectsOfTypeAll<Material>();
for (int i = 0; i < array.Length; i++)
{
if ((int)((Object)array[i]).hideFlags == 0 && ((Object)array[i]).name == name)
{
return array[i];
}
}
return null;
}
}