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 LunarConstruct.Enemies;
using LunarConstruct.Projectiles;
using LunarConstruct.SkillDefs;
using LunarConstruct.States;
using R2API;
using RoR2;
using RoR2.CharacterAI;
using RoR2.ExpansionManagement;
using RoR2.Navigation;
using RoR2.Projectile;
using RoR2.Skills;
using UnityEngine;
using UnityEngine.AddressableAssets;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[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]
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.5")]
[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.5";
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)
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();
}
}
}
}
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);
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_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_0168: Unknown result type (might be due to invalid IL or missing references)
//IL_016d: Unknown result type (might be due to invalid IL or missing references)
//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
//IL_023e: Unknown result type (might be due to invalid IL or missing references)
//IL_0243: Unknown result type (might be due to invalid IL or missing references)
//IL_0270: Unknown result type (might be due to invalid IL or missing references)
//IL_0275: Unknown result type (might be due to invalid IL or missing references)
//IL_0299: Unknown result type (might be due to invalid IL or missing references)
//IL_029e: Unknown result type (might be due to invalid IL or missing references)
//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
//IL_02da: Unknown result type (might be due to invalid IL or missing references)
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>("Assets/LunarConstruct/texRamp.png");
Material val3 = Object.Instantiate<Material>(Addressables.LoadAssetAsync<Material>((object)"RoR2/DLC1/MajorAndMinorConstruct/matMinorConstructAlly.mat").WaitForCompletion());
val3.SetTexture("_FresnelRamp", (Texture)(object)val2);
val3.SetTexture("_FlowHeightRamp", (Texture)(object)val2);
val3.SetTexture("_MainTex", (Texture)(object)Main.lunarConstruct.LoadAsset<Texture2D>("Assets/LunarConstruct/texLunarConstruct.png"));
val3.SetColor("_EmColor", Color32.op_Implicit(new Color32((byte)73, (byte)107, (byte)229, byte.MaxValue)));
Transform child = ((Component)body).gameObject.transform.GetChild(0).GetChild(0);
CharacterModel component = ((Component)child).GetComponent<CharacterModel>();
RendererInfo[] baseRendererInfos = component.baseRendererInfos;
for (int i = 0; i < baseRendererInfos.Length; i++)
{
baseRendererInfos[i].defaultMaterial = val3;
}
((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 val4 = Addressables.LoadAssetAsync<Texture2D>((object)"RoR2/Base/Common/ColorRamps/texRampRJMushroom.png").WaitForCompletion();
Material val5 = Object.Instantiate<Material>(Addressables.LoadAssetAsync<Material>((object)"RoR2/DLC1/MajorAndMinorConstruct/matMinorConstructShield.mat").WaitForCompletion());
val5.SetColor("_TintColor", Color32.op_Implicit(new Color32((byte)12, (byte)31, (byte)63, byte.MaxValue)));
val5.SetTexture("_RemapTex", (Texture)(object)val4);
Transform transform2 = component2.transformPairs[2].transform;
Transform child2 = transform2.GetChild(0);
MeshRenderer component5 = ((Component)child2).GetComponent<MeshRenderer>();
((Renderer)component5).material = val5;
master.bodyPrefab = prefab;
}
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)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
base.PostCreation();
List<DirectorCardCategorySelection> stages = new List<DirectorCardCategorySelection>
{
Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/Base/moon/dccsMoonMonsters.asset").WaitForCompletion(),
Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/Base/moon/dccsMoonMonstersDLC1.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));
}
}
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();
}
}
}