using System;
using System.Collections.Generic;
using System.Diagnostics;
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 BepInEx.Logging;
using EntityStates;
using IL.RoR2;
using LunarConstruct.Enemies;
using LunarConstruct.Projectiles;
using LunarConstruct.SkillDefs;
using LunarConstruct.States;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using R2API;
using RoR2;
using RoR2.CharacterAI;
using RoR2.ExpansionManagement;
using RoR2.Navigation;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2BepInExPack.GameAssetPathsBetter;
using UnityEngine;
using UnityEngine.AddressableAssets;
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 = ".NET Standard 2.1")]
[assembly: AssemblyCompany("LunarConstruct")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LunarConstruct")]
[assembly: AssemblyTitle("LunarConstruct")]
[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;
}
}
}
namespace LunarConstruct
{
public static class Extensions
{
public static T GetRandom<T>(this List<T> list, Xoroshiro128Plus rng = null)
{
if (list.Count == 0)
{
return default(T);
}
if (rng == null)
{
return list[Random.RandomRangeInt(0, list.Count)];
}
return list[rng.RangeInt(0, list.Count)];
}
public static T GetRandom<T>(this T[] array)
{
int num = Random.Range(0, array.Length);
return array[num];
}
}
[BepInPlugin("HIFU.LunarConstruct", "LunarConstruct", "1.0.8")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Main : BaseUnityPlugin
{
public const string PluginGUID = "HIFU.LunarConstruct";
public const string PluginAuthor = "HIFU";
public const string PluginName = "LunarConstruct";
public const string PluginVersion = "1.0.8";
public static ExpansionDef SOTVExpansionDef;
public static ManualLogSource LCLogger;
public static AssetBundle lunarConstruct;
public static ConfigEntry<bool> useWolfoNameScheme { get; set; }
public void Awake()
{
//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_01a1: Unknown result type (might be due to invalid IL or missing references)
LCLogger = ((BaseUnityPlugin)this).Logger;
SOTVExpansionDef = Addressables.LoadAssetAsync<ExpansionDef>((object)RoR2_DLC1_Common.DLC1_asset).WaitForCompletion();
useWolfoNameScheme = ((BaseUnityPlugin)this).Config.Bind<bool>("Name", "Use WolfoQoL name scheme?", false, "Changes Lunar Construct's in-game name from Lunar Chimera to Lunar Chimera Construct.");
lunarConstruct = AssetBundle.LoadFromFile(Assembly.GetExecutingAssembly().Location.Replace("LunarConstruct.dll", "lunarconstruct"));
LunarShard.Init();
TeleportEffect.Init();
IEnumerable<Type> enumerable = from type in Assembly.GetExecutingAssembly().GetTypes()
where !type.IsAbstract && type.IsSubclassOf(typeof(SkillDefBase))
select type;
foreach (Type item in enumerable)
{
SkillDefBase skillDefBase = (SkillDefBase)Activator.CreateInstance(item);
skillDefBase.Create();
}
IEnumerable<Type> enumerable2 = from type in Assembly.GetExecutingAssembly().GetTypes()
where !type.IsAbstract && type.IsSubclassOf(typeof(EnemyBase))
select type;
foreach (Type item2 in enumerable2)
{
EnemyBase enemyBase = (EnemyBase)Activator.CreateInstance(item2);
enemyBase.Create();
}
IEnumerable<Type> enumerable3 = from type in Assembly.GetExecutingAssembly().GetTypes()
where !type.IsAbstract && type.IsSubclassOf(typeof(BaseState))
select type;
bool flag = default(bool);
foreach (Type item3 in enumerable3)
{
ContentAddition.AddEntityState(item3, ref flag);
}
}
}
}
namespace LunarConstruct.States
{
public class ChargeShardsState : BaseState
{
[SerializeField]
public string enterSoundString = "Play_minorConstruct_attack_chargeUp";
[SerializeField]
public string exitSoundString = "Stop_minorConstruct_attack_chargeUp";
[SerializeField]
public string animationLayerName = "Weapon";
[SerializeField]
public string animationStateName = "ChargeConstructBeam";
[SerializeField]
public string animationPlaybackRateParam = "ConstructBeam.playbackRate";
[SerializeField]
public string chargeEffectMuzzle = "Muzzle";
[SerializeField]
public GameObject chargeEffectPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/LunarGolem/ChargeLunarGolemTwinShot.prefab").WaitForCompletion();
[SerializeField]
public float baseDuration = 0.2f;
private float duration;
private GameObject chargeInstance;
public override void OnEnter()
{
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
((BaseState)this).OnEnter();
duration = baseDuration / base.attackSpeedStat;
((EntityState)this).PlayAnimation(animationLayerName, animationStateName, animationPlaybackRateParam, duration, 0f);
Util.PlaySound(enterSoundString, ((EntityState)this).gameObject);
Transform val = ((BaseState)this).FindModelChild(chargeEffectMuzzle);
if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)chargeEffectPrefab))
{
chargeInstance = Object.Instantiate<GameObject>(chargeEffectPrefab, val.position, val.rotation);
chargeInstance.transform.parent = ((EntityState)this).gameObject.transform;
ScaleParticleSystemDuration component = chargeInstance.GetComponent<ScaleParticleSystemDuration>();
if (Object.op_Implicit((Object)(object)component))
{
component.newDuration = duration;
}
}
}
public override void Update()
{
//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_002c: Unknown result type (might be due to invalid IL or missing references)
((EntityState)this).Update();
if (Object.op_Implicit((Object)(object)chargeInstance))
{
Ray aimRay = ((BaseState)this).GetAimRay();
chargeInstance.transform.forward = ((Ray)(ref aimRay)).direction;
}
}
public override void FixedUpdate()
{
((EntityState)this).FixedUpdate();
if (((EntityState)this).fixedAge > duration)
{
((EntityState)this).outer.SetNextState((EntityState)(object)new FireShardsState());
}
}
public override void OnExit()
{
Util.PlaySound(exitSoundString, ((EntityState)this).gameObject);
if (Object.op_Implicit((Object)(object)chargeInstance))
{
EntityState.Destroy((Object)(object)chargeInstance);
}
((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;
}
}
public class FireShardsState : BaseState
{
[SerializeField]
public GameObject effectPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/LunarSkillReplacements/MuzzleflashLunarNeedle.prefab").WaitForCompletion();
[SerializeField]
public GameObject projectilePrefab = LunarShard.projectile;
[SerializeField]
public float damageCoefficient = 1.5f;
[SerializeField]
public float force = 1800f;
[SerializeField]
public float minSpread = 4f;
[SerializeField]
public float maxSpread = 10f;
[SerializeField]
public float baseDuration = 1f / 60f;
[SerializeField]
public float recoilAmplitude = 1f;
[SerializeField]
public string attackSoundString = "Play_minorConstruct_attack_shoot";
[SerializeField]
public string targetMuzzle = "Muzzle";
[SerializeField]
public float bloom = 1f;
[SerializeField]
public string animationLayerName = "Weapon";
[SerializeField]
public string animationStateName = "FireConstructBeam";
protected float stopwatch;
protected float duration;
protected bool firedProjectile;
public override void OnEnter()
{
((BaseState)this).OnEnter();
stopwatch = 0f;
duration = baseDuration / base.attackSpeedStat;
if (Object.op_Implicit((Object)(object)((EntityState)this).characterBody))
{
((EntityState)this).characterBody.SetAimTimer(2f);
}
((EntityState)this).PlayAnimation(animationLayerName, animationStateName);
}
public override void OnExit()
{
((EntityState)this).OnExit();
}
public override void PlayAnimation(string layerName, string animationStateName)
{
Animator modelAnimator = ((EntityState)this).GetModelAnimator();
if (Object.op_Implicit((Object)(object)modelAnimator))
{
EntityState.PlayAnimationOnAnimator(modelAnimator, layerName, animationStateName);
}
}
public override void FixedUpdate()
{
((EntityState)this).FixedUpdate();
stopwatch += Time.fixedDeltaTime;
if (!firedProjectile)
{
firedProjectile = true;
FireProjectile();
DoFireEffects();
}
if (stopwatch >= duration && ((EntityState)this).isAuthority)
{
((EntityState)this).outer.SetNextStateToMain();
}
}
public void FireProjectile()
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: 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_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
if (((EntityState)this).isAuthority)
{
Ray aimRay = ((BaseState)this).GetAimRay();
((Ray)(ref aimRay)).direction = Util.ApplySpread(((Ray)(ref aimRay)).direction, minSpread, maxSpread, 1f, 1f, 0f, 0f);
ProjectileManager.instance.FireProjectile(projectilePrefab, ((Ray)(ref aimRay)).origin, Util.QuaternionSafeLookRotation(((Ray)(ref aimRay)).direction), ((EntityState)this).gameObject, base.damageStat * damageCoefficient, force, Util.CheckRoll(base.critStat, ((EntityState)this).characterBody.master), (DamageColorIndex)0, (GameObject)null, -1f, (DamageTypeCombo?)null);
}
}
public void DoFireEffects()
{
Util.PlaySound(attackSoundString, ((EntityState)this).gameObject);
((BaseState)this).AddRecoil(-2f * recoilAmplitude, -3f * recoilAmplitude, -1f * recoilAmplitude, 1f * recoilAmplitude);
if (Object.op_Implicit((Object)(object)effectPrefab))
{
EffectManager.SimpleMuzzleFlash(effectPrefab, ((EntityState)this).gameObject, targetMuzzle, false);
}
((EntityState)this).characterBody.AddSpreadBloom(bloom);
}
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;
}
}
}
namespace LunarConstruct.SkillDefs
{
public class FireShards : SkillDefBase<FireShards>
{
public override string NameToken => "LUNARCONSTRUCT_FIRESHARDS_NAME";
public override string DescToken => "LUNARCONSTRUCT_FIRESHARDS_DESC";
public override SerializableEntityStateType ActivationState => new SerializableEntityStateType(typeof(ChargeShardsState));
public override string ActivationStateMachineName => "Weapon";
public override int BaseMaxStock => 5;
public override float BaseRechargeInterval => 0.25f;
public override bool BeginSkillCooldownOnSkillEnd => true;
public override bool CanceledFromSprinting => false;
public override bool CancelSprintingOnActivation => true;
public override bool FullRestockOnAssign => true;
public override InterruptPriority SkillInterruptPriority => (InterruptPriority)0;
public override bool IsCombatSkill => true;
public override bool MustKeyPress => false;
public override int RechargeStock => 1;
public override Sprite Icon => null;
public override int StockToConsume => 1;
public override int RequiredStock => 5;
}
public abstract class SkillDefBase<T> : SkillDefBase where T : SkillDefBase<T>
{
public static T Instance { get; private set; }
public SkillDefBase()
{
if (Instance != null)
{
throw new InvalidOperationException("Singleton class \"" + typeof(T).Name + "\" inheriting SkillDefBase was instantiated twice");
}
Instance = this as T;
}
}
public abstract class SkillDefBase
{
public SkillDef SkillDef;
public abstract string NameToken { get; }
public abstract string DescToken { get; }
public abstract SerializableEntityStateType ActivationState { get; }
public abstract string ActivationStateMachineName { get; }
public abstract int BaseMaxStock { get; }
public abstract float BaseRechargeInterval { get; }
public abstract bool BeginSkillCooldownOnSkillEnd { get; }
public abstract bool CanceledFromSprinting { get; }
public abstract bool CancelSprintingOnActivation { get; }
public abstract bool FullRestockOnAssign { get; }
public abstract InterruptPriority SkillInterruptPriority { get; }
public abstract bool IsCombatSkill { get; }
public abstract bool MustKeyPress { get; }
public abstract int RechargeStock { get; }
public abstract Sprite Icon { get; }
public abstract int StockToConsume { get; }
public abstract int RequiredStock { get; }
public virtual void Create()
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_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)
SkillDef = ScriptableObject.CreateInstance<SkillDef>();
SkillDef.activationState = ActivationState;
SkillDef.activationStateMachineName = ActivationStateMachineName;
SkillDef.baseMaxStock = BaseMaxStock;
SkillDef.baseRechargeInterval = BaseRechargeInterval;
SkillDef.beginSkillCooldownOnSkillEnd = BeginSkillCooldownOnSkillEnd;
SkillDef.canceledFromSprinting = CanceledFromSprinting;
SkillDef.cancelSprintingOnActivation = CancelSprintingOnActivation;
SkillDef.fullRestockOnAssign = FullRestockOnAssign;
SkillDef.interruptPriority = SkillInterruptPriority;
SkillDef.isCombatSkill = IsCombatSkill;
SkillDef.mustKeyPress = MustKeyPress;
SkillDef.rechargeStock = RechargeStock;
SkillDef.icon = Icon;
SkillDef.skillNameToken = NameToken;
SkillDef.skillDescriptionToken = DescToken;
SkillDef.stockToConsume = StockToConsume;
SkillDef.requiredStock = RequiredStock;
ContentAddition.AddSkillDef(SkillDef);
}
}
}
namespace LunarConstruct.Projectiles
{
public static class LunarShard
{
public static GameObject projectile;
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_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_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_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_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Expected O, but got Unknown
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_014e: Unknown result type (might be due to invalid IL or missing references)
//IL_0153: Unknown result type (might be due to invalid IL or missing references)
//IL_0178: 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)
//IL_0181: Unknown result type (might be due to invalid IL or missing references)
//IL_0186: 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)
//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
projectile = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/MajorAndMinorConstruct/MinorConstructProjectile.prefab").WaitForCompletion(), "LunarConstructLunarShard");
AnimationCurve velocityOverLifetime = new AnimationCurve((Keyframe[])(object)new Keyframe[3]
{
new Keyframe(0f, 1f),
new Keyframe(2.5f, 0.5f),
new Keyframe(5f, 0.25f)
})
{
preWrapMode = (WrapMode)8,
postWrapMode = (WrapMode)8
};
ProjectileSimple component = projectile.GetComponent<ProjectileSimple>();
component.lifetime = 6f;
component.desiredForwardSpeed = 45f;
component.updateAfterFiring = true;
component.enableVelocityOverLifetime = true;
component.velocityOverLifetime = velocityOverLifetime;
component.lifetimeExpiredEffect = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/LunarGolem/MuzzleflashLunarGolemTwinShot.prefab").WaitForCompletion();
ProjectileSingleTargetImpact component2 = projectile.GetComponent<ProjectileSingleTargetImpact>();
component2.impactEffect = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Brother/OmniImpactVFXBrotherLunarShardExplosion.prefab").WaitForCompletion();
ProjectileController component3 = projectile.GetComponent<ProjectileController>();
component3.flightSoundLoop = null;
GameObject val = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/LunarExploder/LunarExploderShardGhost.prefab").WaitForCompletion(), "LunarConstructLunarShardGhost", false);
TrailRenderer component4 = ((Component)val.transform.GetChild(1)).GetComponent<TrailRenderer>();
component4.widthMultiplier = 1.25f;
((Renderer)component4).material = Addressables.LoadAssetAsync<Material>((object)"RoR2/DLC1/LunarSun/matLunarSunProjectileTrail.mat").WaitForCompletion();
ParticleSystem component5 = ((Component)val.transform.GetChild(5)).GetComponent<ParticleSystem>();
MainModule main = component5.main;
MinMaxGradient startColor = ((MainModule)(ref main)).startColor;
((MinMaxGradient)(ref startColor)).mode = (ParticleSystemGradientMode)0;
((MinMaxGradient)(ref startColor)).color = Color32.op_Implicit(new Color32((byte)0, (byte)12, (byte)238, byte.MaxValue));
component3.ghostPrefab = val;
PrefabAPI.RegisterNetworkPrefab(projectile);
}
}
public static class TeleportEffect
{
public static GameObject prefab;
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_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
prefab = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Junk/Parent/ParentTeleportEffect.prefab").WaitForCompletion(), "LunarConstructTeleport", false);
Transform child = prefab.transform.GetChild(0);
ParticleSystemRenderer component = ((Component)child.GetChild(0)).GetComponent<ParticleSystemRenderer>();
Texture2D val = Addressables.LoadAssetAsync<Texture2D>((object)"RoR2/Base/Common/ColorRamps/texRampLunarWispFire.png").WaitForCompletion();
Material val2 = Object.Instantiate<Material>(Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Parent/matParentTeleportPortal.mat").WaitForCompletion());
val2.SetTexture("_RemapTex", (Texture)(object)val);
((Renderer)component).sharedMaterial = val2;
((Component)child.GetChild(1)).gameObject.SetActive(false);
ParticleSystemRenderer component2 = ((Component)child.GetChild(3)).GetComponent<ParticleSystemRenderer>();
((Renderer)component2).sharedMaterial = val2;
((Component)component2).gameObject.transform.localScale = Vector3.one * 0.25f;
MainModule main = ((Component)child.GetChild(3)).GetComponent<ParticleSystem>().main;
((MainModule)(ref main)).duration = 0.17f;
((Component)child.GetChild(4)).gameObject.SetActive(false);
ContentAddition.AddEffect(prefab);
}
}
}
namespace LunarConstruct.Enemies
{
public abstract class EnemyBase<T> : EnemyBase where T : EnemyBase<T>
{
public static T Instance { get; private set; }
public EnemyBase()
{
if (Instance != null)
{
throw new InvalidOperationException("Singleton class \"" + typeof(T).Name + "\" inheriting EnemyBase was instantiated twice");
}
Instance = this as T;
}
}
public abstract class EnemyBase
{
public DirectorCard card;
public DirectorCardHolder cardHolder;
public CharacterSpawnCard isc;
public GameObject prefab;
public GameObject prefabMaster;
public virtual string PathToClone { get; } = null;
public virtual string CloneName { get; } = null;
public virtual string PathToCloneMaster { get; } = null;
public virtual bool local { get; } = false;
public virtual bool localMaster { get; } = false;
public virtual ExpansionDef RequiredExpansionHolder { get; } = Main.SOTVExpansionDef;
public virtual void Create()
{
if (PathToClone != null && CloneName != null && PathToCloneMaster != null)
{
CreatePrefab();
ExpansionRequirementComponent val = prefab.AddComponent<ExpansionRequirementComponent>();
ExpansionRequirementComponent val2 = prefabMaster.AddComponent<ExpansionRequirementComponent>();
val.requiredExpansion = RequiredExpansionHolder;
val2.requiredExpansion = RequiredExpansionHolder;
}
Modify();
AddSpawnCard();
AddDirectorCard();
PostCreation();
}
public virtual void Modify()
{
}
public virtual void PostCreation()
{
}
public virtual void AddSpawnCard()
{
isc = ScriptableObject.CreateInstance<CharacterSpawnCard>();
}
public virtual void AddDirectorCard()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//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_002f: 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_0046: Expected O, but got Unknown
card = new DirectorCard();
card.spawnCard = (SpawnCard)(object)isc;
cardHolder = new DirectorCardHolder
{
Card = card,
MonsterCategory = (MonsterCategory)2,
MonsterCategorySelectionWeight = 2f
};
}
public void RegisterEnemy(GameObject bodyPrefab, GameObject masterPrefab, List<DirectorCardCategorySelection> stages)
{
PrefabAPI.RegisterNetworkPrefab(bodyPrefab);
PrefabAPI.RegisterNetworkPrefab(masterPrefab);
ContentAddition.AddBody(bodyPrefab);
ContentAddition.AddMaster(masterPrefab);
foreach (DirectorCardCategorySelection stage in stages)
{
DirectorAPI.AddCard(stage, cardHolder);
}
}
public void DestroyModelLeftovers(GameObject prefab)
{
Object.Destroy((Object)(object)((Component)prefab.GetComponentInChildren<ModelLocator>().modelBaseTransform).gameObject);
}
public virtual void CreatePrefab()
{
//IL_0016: 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_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
if (!local)
{
prefab = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)PathToClone).WaitForCompletion(), CloneName + "Body");
}
if (!localMaster)
{
prefabMaster = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)PathToCloneMaster).WaitForCompletion(), CloneName + "Master");
}
}
public void ReplaceSkill(GenericSkill slot, SkillDef replaceWith, string familyName = "temp")
{
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
SkillFamily val = ScriptableObject.CreateInstance<SkillFamily>();
((Object)val).name = familyName;
slot._skillFamily = val;
slot._skillFamily.variants = (Variant[])(object)new Variant[1];
slot._skillFamily.variants[0] = new Variant
{
skillDef = replaceWith
};
}
}
public class LunarConstruct : EnemyBase<LunarConstruct>
{
public delegate Vector3 orig_aimOrigin(InputBankTest self);
[Serializable]
[CompilerGenerated]
private sealed class <>c
{
public static readonly <>c <>9 = new <>c();
public static Func<AISkillDriver, bool> <>9__12_0;
public static Func<SkinnedMeshRenderer, MeshReplacement> <>9__12_3;
public static Func<Instruction, bool> <>9__12_5;
public static Func<IPhysMotor, bool> <>9__12_8;
public static Manipulator <>9__12_4;
internal bool <Modify>b__12_0(AISkillDriver x)
{
return x.customName == "Shooty";
}
internal MeshReplacement <Modify>b__12_3(SkinnedMeshRenderer x)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
MeshReplacement result = default(MeshReplacement);
result.mesh = Addressables.LoadAssetAsync<Mesh>((object)(RoR2_DLC1_MajorAndMinorConstruct.mdlMinorConstruct_fbx + "[" + ((Object)((Component)x).gameObject).name + "]")).WaitForCompletion();
result.renderer = (Renderer)(object)x;
return result;
}
internal void <Modify>b__12_4(ILContext il)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Expected O, but got Unknown
<>c__DisplayClass12_1 CS$<>8__locals0 = new <>c__DisplayClass12_1();
ILCursor val = new ILCursor(il);
CS$<>8__locals0.loc = -1;
val.GotoNext(new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchDup(x)
});
val.GotoNext(new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref CS$<>8__locals0.loc)
});
val.GotoNext((MoveType)2, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, CS$<>8__locals0.loc)
});
val.EmitDelegate<Func<IPhysMotor, bool>>((Func<IPhysMotor, bool>)((IPhysMotor x) => !(x is PseudoCharacterMotor) && x != null));
}
internal bool <Modify>b__12_5(Instruction x)
{
return ILPatternMatchingExt.MatchDup(x);
}
internal bool <Modify>b__12_8(IPhysMotor x)
{
if (x is PseudoCharacterMotor)
{
return false;
}
return x != null;
}
}
[CompilerGenerated]
private sealed class <>c__DisplayClass12_1
{
public int loc;
internal bool <Modify>b__6(Instruction x)
{
return ILPatternMatchingExt.MatchStloc(x, ref loc);
}
internal bool <Modify>b__7(Instruction x)
{
return ILPatternMatchingExt.MatchLdloc(x, loc);
}
}
public CharacterBody body;
public CharacterMaster master;
public override string PathToClone => RoR2_DLC1_MajorAndMinorConstruct.MinorConstructBody_prefab;
public override string CloneName => "LunarConstruct";
public override string PathToCloneMaster => RoR2_DLC1_MajorAndMinorConstruct.MinorConstructMaster_prefab;
public override void CreatePrefab()
{
base.CreatePrefab();
body = prefab.GetComponent<CharacterBody>();
body.baseArmor = 0f;
body.baseDamage = 13f;
body.levelDamage = 2.6f;
body.baseMaxHealth = 260f;
body.levelMaxHealth = 78f;
body.autoCalculateLevelStats = true;
body.baseNameToken = "LUNARCONSTRUCT_NAME";
body.portraitIcon = (Texture)(object)Main.lunarConstruct.LoadAsset<Texture2D>("Assets/LunarConstruct/texPortrait.png");
}
public override void AddSpawnCard()
{
//IL_000f: 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_0027: 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_0058: Unknown result type (might be due to invalid IL or missing references)
base.AddSpawnCard();
((SpawnCard)isc).hullSize = (HullClassification)0;
((SpawnCard)isc).nodeGraphType = (GraphType)0;
((SpawnCard)isc).requiredFlags = (NodeFlags)0;
((SpawnCard)isc).forbiddenFlags = (NodeFlags)4;
((SpawnCard)isc).directorCreditCost = 120;
((SpawnCard)isc).occupyPosition = false;
((SpawnCard)isc).eliteRules = (EliteRules)2;
((SpawnCard)isc).sendOverNetwork = true;
((SpawnCard)isc).prefab = prefabMaster;
((Object)isc).name = "cscLunarConstruct";
}
public override void AddDirectorCard()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
base.AddDirectorCard();
card.minimumStageCompletions = 0;
card.selectionWeight = 1;
card.spawnDistance = (MonsterSpawnDistance)0;
}
public override void Modify()
{
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Expected O, but got Unknown
//IL_0199: Unknown result type (might be due to invalid IL or missing references)
//IL_019e: Unknown result type (might be due to invalid IL or missing references)
//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
//IL_01c8: Expected O, but got Unknown
//IL_021b: Unknown result type (might be due to invalid IL or missing references)
//IL_0268: Unknown result type (might be due to invalid IL or missing references)
//IL_026d: Unknown result type (might be due to invalid IL or missing references)
//IL_029a: Unknown result type (might be due to invalid IL or missing references)
//IL_029f: Unknown result type (might be due to invalid IL or missing references)
//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
//IL_02dd: Unknown result type (might be due to invalid IL or missing references)
//IL_02ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0304: Unknown result type (might be due to invalid IL or missing references)
//IL_049c: Unknown result type (might be due to invalid IL or missing references)
//IL_04a1: Unknown result type (might be due to invalid IL or missing references)
//IL_04a7: Expected O, but got Unknown
base.Modify();
master = prefabMaster.GetComponent<CharacterMaster>();
SkillLocator componentInChildren = prefab.GetComponentInChildren<SkillLocator>();
ReplaceSkill(componentInChildren.primary, SkillDefBase<FireShards>.Instance.SkillDef);
LanguageAPI.Add("LUNARCONSTRUCT_NAME", "Lunar Chimera" + (Main.useWolfoNameScheme.Value ? " Construct" : ""));
LanguageAPI.Add("LUNARCONSTRUCT_LORE", "Design driven. Cheap- and replicable. A shell made of two pyramids- I love triangles, after all.\r\n\r\nA central energy core capable of delivering a powerful blast within close quarters.\r\n\r\nThe energy core is heavy- the construct cannot move. Inefficient- speed is war.\r\n\r\nI have implemented a technology similar to my old gates. They can close distance to threats in the blink of an eye.\r\n\r\nTo see my brother bastardize this design- and for what? To act as security guards to keep his carnival of vermin trapped?\r\n\r\nIronic, then, that those very designs will be their destruction.");
LanguageAPI.Add("LUNARCONSTRUCT_SUBTITLE", "Horde of Many");
AISkillDriver val = (from x in ((Component)master).GetComponents<AISkillDriver>()
where x.customName == "Shooty"
select x).First();
val.requiredSkill = SkillDefBase<FireShards>.Instance.SkillDef;
val.requireSkillReady = true;
val.maxDistance = 150f;
((Component)body).gameObject.AddComponent<TeleportController>();
Texture2D val2 = Main.lunarConstruct.LoadAsset<Texture2D>("texRamp.png");
Material matLunarConstruct = new Material(Addressables.LoadAssetAsync<Material>((object)RoR2_DLC1_MajorAndMinorConstruct.matMinorConstructAlly_mat).WaitForCompletion());
matLunarConstruct.SetTexture("_FresnelRamp", (Texture)(object)val2);
matLunarConstruct.SetTexture("_FlowHeightRamp", (Texture)(object)val2);
matLunarConstruct.SetTexture("_PrintRamp", (Texture)(object)val2);
matLunarConstruct.SetTexture("_MainTex", (Texture)(object)Main.lunarConstruct.LoadAsset<Texture2D>("texLunarConstruct.png"));
matLunarConstruct.SetColor("_EmColor", Color32.op_Implicit(new Color32((byte)73, (byte)107, (byte)229, byte.MaxValue)));
prefab.GetComponentInChildren<Renderer>().materials = (Material[])(object)new Material[1]
{
new Material(matLunarConstruct)
};
Transform child = ((Component)body).gameObject.transform.GetChild(0).GetChild(0);
CharacterModel component = ((Component)child).GetComponent<CharacterModel>();
List<RendererInfo> list = new List<RendererInfo>();
((Component)body).gameObject.transform.localScale = new Vector3(1.25f, 1.25f, 1.25f);
ChildLocator component2 = ((Component)child).GetComponent<ChildLocator>();
Transform transform = component2.transformPairs[1].transform;
Light component3 = ((Component)transform.GetChild(0)).GetComponent<Light>();
component3.color = Color32.op_Implicit(new Color32((byte)132, (byte)193, byte.MaxValue, byte.MaxValue));
Light component4 = ((Component)transform.GetChild(1)).GetComponent<Light>();
component4.color = Color32.op_Implicit(new Color32((byte)94, (byte)145, byte.MaxValue, byte.MaxValue));
((Component)transform.GetChild(2)).gameObject.SetActive(false);
Texture2D val3 = Addressables.LoadAssetAsync<Texture2D>((object)RoR2_Base_Common_ColorRamps.texRampRJMushroom_png).WaitForCompletion();
Material val4 = Object.Instantiate<Material>(Addressables.LoadAssetAsync<Material>((object)RoR2_DLC1_MajorAndMinorConstruct.matMinorConstructShield_mat).WaitForCompletion());
val4.SetColor("_TintColor", Color32.op_Implicit(new Color32((byte)12, (byte)31, (byte)63, byte.MaxValue)));
val4.SetTexture("_RemapTex", (Texture)(object)val3);
Transform transform2 = component2.transformPairs[2].transform;
Transform child2 = transform2.GetChild(0);
MeshRenderer component5 = ((Component)child2).GetComponent<MeshRenderer>();
((Renderer)component5).material = val4;
Transform modelTransform = ((Component)body).GetComponent<ModelLocator>()._modelTransform;
((Object)modelTransform).name = "mdlLunarConstruct";
string[] source = new string[4] { "mdlMinorConstructBase", "mdlMinorConstructEye", "mdlMinorConstructMiddle", "mdlMinorConstructTop" };
SkinnedMeshRenderer[] array = source.Select((string x) => ((Component)modelTransform.Find(x)).GetComponent<SkinnedMeshRenderer>()).ToArray();
SkinnedMeshRenderer[] array2 = array;
foreach (SkinnedMeshRenderer val5 in array2)
{
((Renderer)val5).material = matLunarConstruct;
}
master.bodyPrefab = prefab;
SkinDefParams val6 = ScriptableObject.CreateInstance<SkinDefParams>();
val6.rendererInfos = array.Select(delegate(SkinnedMeshRenderer x)
{
//IL_0002: 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_003d: Unknown result type (might be due to invalid IL or missing references)
RendererInfo result2 = default(RendererInfo);
result2.renderer = (Renderer)(object)x;
result2.defaultMaterial = matLunarConstruct;
result2.defaultShadowCastingMode = (ShadowCastingMode)1;
result2.hideOnDeath = false;
result2.ignoreOverlays = false;
result2.ignoresMaterialOverrides = false;
return result2;
}).ToArray();
val6.meshReplacements = array.Select(delegate(SkinnedMeshRenderer x)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
MeshReplacement result = default(MeshReplacement);
result.mesh = Addressables.LoadAssetAsync<Mesh>((object)(RoR2_DLC1_MajorAndMinorConstruct.mdlMinorConstruct_fbx + "[" + ((Object)((Component)x).gameObject).name + "]")).WaitForCompletion();
result.renderer = (Renderer)(object)x;
return result;
}).ToArray();
SkinDef val7 = ScriptableObject.CreateInstance<SkinDef>();
val7.rootObject = ((Component)modelTransform).gameObject;
val7.skinDefParams = val6;
ModelSkinController component6 = ((Component)modelTransform).GetComponent<ModelSkinController>();
component6.skins[0] = val7;
object obj = <>c.<>9__12_4;
if (obj == null)
{
Manipulator val8 = delegate(ILContext il)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Expected O, but got Unknown
ILCursor val9 = new ILCursor(il);
int loc = -1;
val9.GotoNext(new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchDup(x)
});
val9.GotoNext(new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref loc)
});
val9.GotoNext((MoveType)2, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, loc)
});
val9.EmitDelegate<Func<IPhysMotor, bool>>((Func<IPhysMotor, bool>)((IPhysMotor x) => !(x is PseudoCharacterMotor) && x != null));
};
<>c.<>9__12_4 = val8;
obj = (object)val8;
}
TeleportHelper.OnTeleport_GameObject_Vector3_Vector3_Quaternion_bool += (Manipulator)obj;
}
public override void PostCreation()
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
base.PostCreation();
List<DirectorCardCategorySelection> stages = new List<DirectorCardCategorySelection>
{
Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)RoR2_Base_moon.dccsMoonMonsters_asset).WaitForCompletion(),
Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)RoR2_DLC1_itmoon.dccsITMoonMonsters_asset).WaitForCompletion()
};
RegisterEnemy(prefab, prefabMaster, stages);
}
}
public class TeleportController : MonoBehaviour
{
public HealthComponent hc;
public CharacterBody cb;
public float stopwatch = 0f;
public GameObject teleportEffect = TeleportEffect.prefab;
public void Start()
{
hc = ((Component)this).GetComponent<HealthComponent>();
cb = hc.body;
}
public void FixedUpdate()
{
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
stopwatch += Time.fixedDeltaTime;
if (stopwatch >= GetDelay())
{
stopwatch = 0f;
HandleTeleport(PickTeleportPosition());
}
}
public float GetDelay()
{
return 6f;
}
public void HandleTeleport(Vector3 pos)
{
//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_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_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_0043: Expected O, but got Unknown
//IL_004a: 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_005f: Unknown result type (might be due to invalid IL or missing references)
if (!cb.isPlayerControlled)
{
Vector3 position = ((Component)this).transform.position;
EffectManager.SpawnEffect(teleportEffect, new EffectData
{
scale = 0.6f,
origin = position
}, true);
TeleportHelper.TeleportBody(cb, pos + new Vector3(0f, 1f, 0f), false);
}
}
public Vector3[] PickValidPositions(float min, float max, Node[] nodes)
{
//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)
Node[] array = nodes.Where((Node x) => Vector3.Distance(x.position, ((Component)this).transform.position) > min && Vector3.Distance(x.position, ((Component)this).transform.position) < max).ToArray();
if (array.Length <= 1)
{
return (Vector3[])(object)new Vector3[1] { ((Component)this).transform.position };
}
return array.Select((Node node) => node.position).ToArray();
}
public Vector3 PickTeleportPosition()
{
//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)
//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_0060: Unknown result type (might be due to invalid IL or missing references)
if (!Object.op_Implicit((Object)(object)SceneInfo.instance) || !Object.op_Implicit((Object)(object)SceneInfo.instance.groundNodes))
{
return ((Component)this).transform.position;
}
Node[] nodes = SceneInfo.instance.groundNodes.nodes;
Vector3[] array = PickValidPositions(0f, 35f, nodes);
return array.GetRandom();
}
}
}