Decompiled source of Conscript v1.0.0
ConscriptMod.dll
Decompiled a year ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; 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 BepInEx.Logging; using ConscriptMod.Modules; using ConscriptMod.Modules.Characters; using ConscriptMod.Modules.Survivors; using ConscriptMod.SkillStates; using ConscriptMod.SkillStates.BaseStates; using EntityStates; using EntityStates.Commando; using HG; using HG.BlendableTypes; using On.RoR2; using R2API; using R2API.Utils; using RoR2; using RoR2.Achievements; using RoR2.Audio; using RoR2.ContentManagement; using RoR2.Projectile; using RoR2.Skills; using UnityEngine; 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.0", FrameworkDisplayName = "")] [assembly: AssemblyCompany("ConscriptMod")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("ConscriptMod")] [assembly: AssemblyTitle("ConscriptMod")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: UnverifiableCode] public class MenuSoundComponent : MonoBehaviour { private uint playID1 = 0u; private uint playID2 = 0u; private void OnEnable() { ((MonoBehaviour)this).StartCoroutine(delayedGunSound(5f / 24f, "ConscriptDisplayThrow")); ((MonoBehaviour)this).StartCoroutine(delayedGunSound(23f / 24f, "ConscriptDisplayCatch")); } private IEnumerator delayedGunSound(float delay, string playedSound) { yield return (object)new WaitForSeconds(delay); if (playedSound == "ConscriptDisplayThrow") { playID1 = Util.PlaySound(playedSound, ((Component)this).gameObject); } else { playID2 = Util.PlaySound(playedSound, ((Component)this).gameObject); } } private void OnDestroy() { if (playID1 != 0) { AkSoundEngine.StopPlayingID(playID1); } if (playID2 != 0) { AkSoundEngine.StopPlayingID(playID2); } } } namespace ConscriptMod { [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.manti.ConscriptMod", "ConscriptMod", "1.0.0")] [R2APISubmoduleDependency(new string[] { "PrefabAPI", "LanguageAPI", "SoundAPI", "UnlockableAPI" })] public class ConscriptPlugin : BaseUnityPlugin { public const string MODUID = "com.manti.ConscriptMod"; public const string MODNAME = "ConscriptMod"; public const string MODVERSION = "1.0.0"; public const string DEVELOPER_PREFIX = "MANTI"; public static ConscriptPlugin instance; private void Awake() { instance = this; Log.Init(((BaseUnityPlugin)this).Logger); Assets.Initialize(); Config.ReadConfig(); States.RegisterStates(); Buffs.RegisterBuffs(); Projectiles.RegisterProjectiles(); Tokens.AddTokens(); ItemDisplays.PopulateDisplays(); new MyCharacter().Initialize(); new ContentPacks().Initialize(); Hook(); } private void Hook() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown CharacterBody.RecalculateStats += new hook_RecalculateStats(CharacterBody_RecalculateStats); } private void CharacterBody_RecalculateStats(orig_RecalculateStats orig, CharacterBody self) { orig.Invoke(self); if (Object.op_Implicit((Object)(object)self) && self.HasBuff(Buffs.armorBuff)) { self.armor += 300f; } } } internal static class Log { internal static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void Debug(object data) { _logSource.LogDebug(data); } internal static void Error(object data) { _logSource.LogError(data); } internal static void Fatal(object data) { _logSource.LogFatal(data); } internal static void Info(object data) { _logSource.LogInfo(data); } internal static void Message(object data) { _logSource.LogMessage(data); } internal static void Warning(object data) { _logSource.LogWarning(data); } } } namespace ConscriptMod.SkillStates { public class BatonAttack : BaseMeleeAttack { public override void OnEnter() { //IL_0012: 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) hitboxName = "Baton"; damageType = (DamageType)16777216; damageCoefficient = 5f; procCoefficient = 1f; pushForce = 300f; bonusForce = Vector3.zero; baseDuration = 1f; attackStartTime = 0.2f; attackEndTime = 0.4f; baseEarlyExitTime = 0.4f; hitStopDuration = 0.012f; attackRecoil = 0.5f; hitHopVelocity = 4f; Util.PlaySound("ConscriptBatonOn", ((EntityState)this).gameObject); swingSoundString = "ConscriptBatonSwing"; hitSoundString = ""; muzzleString = "SwingCenter"; swingEffectPrefab = Assets.batonSwingEffect; hitEffectPrefab = Assets.bulletImpact; base.OnEnter(); } protected override void PlayAttackAnimation() { ((EntityState)this).PlayCrossfade("Gesture, Override", "Slash1", "Slash.playbackRate", duration, 0.05f); } protected override void PlaySwingEffect() { base.PlaySwingEffect(); } protected override void OnHitEnemyAuthority() { base.OnHitEnemyAuthority(); } public override void OnExit() { base.OnExit(); } } public class KickAttack : BaseMeleeAttack { public override void OnEnter() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) hitboxName = "Baton"; damageType = (DamageType)32; damageCoefficient = 12f; procCoefficient = 1f; pushForce = 2500f; bonusForce = ((EntityState)this).characterDirection.forward * 4000f + Vector3.up * 35f; baseDuration = 1f; attackStartTime = 0.45f; attackEndTime = 1f; baseEarlyExitTime = 0.5f; hitStopDuration = 0.012f; attackRecoil = 0.5f; hitHopVelocity = 4f; swingSoundString = "ConscriptKick"; hitSoundString = ""; muzzleString = "SwingCenter"; swingEffectPrefab = Assets.kickEffect; hitEffectPrefab = Assets.bulletImpact; base.OnEnter(); } protected override void PlayAttackAnimation() { ((EntityState)this).PlayAnimation("FullBody, Override", "Kick", "Kick.playbackRate", duration); } protected override void PlaySwingEffect() { base.PlaySwingEffect(); } protected override void OnHitEnemyAuthority() { base.OnHitEnemyAuthority(); } public override void OnExit() { base.OnExit(); } } public class Roll : BaseSkillState { public static float duration = 0.5f; public static float initialSpeedCoefficient = 5f; public static float finalSpeedCoefficient = 2.5f; public static string dodgeSoundString = "Roll"; public static float dodgeFOV = DodgeState.dodgeFOV; private float rollSpeed; private Vector3 forwardDirection; private Animator animator; private Vector3 previousPosition; public override void OnEnter() { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0069: 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) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: 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) ((BaseState)this).OnEnter(); animator = ((EntityState)this).GetModelAnimator(); if (((EntityState)this).isAuthority && Object.op_Implicit((Object)(object)((EntityState)this).inputBank) && Object.op_Implicit((Object)(object)((EntityState)this).characterDirection)) { Vector3 val = ((((EntityState)this).inputBank.moveVector == Vector3.zero) ? ((EntityState)this).characterDirection.forward : ((EntityState)this).inputBank.moveVector); forwardDirection = ((Vector3)(ref val)).normalized; } Vector3 val2 = (Object.op_Implicit((Object)(object)((EntityState)this).characterDirection) ? ((EntityState)this).characterDirection.forward : forwardDirection); Vector3 val3 = Vector3.Cross(Vector3.up, val2); float num = Vector3.Dot(forwardDirection, val2); float num2 = Vector3.Dot(forwardDirection, val3); RecalculateRollSpeed(); if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) && Object.op_Implicit((Object)(object)((EntityState)this).characterDirection)) { ((EntityState)this).characterMotor.velocity.y = 0f; ((EntityState)this).characterMotor.velocity = forwardDirection * rollSpeed; } Vector3 val4 = (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) ? ((EntityState)this).characterMotor.velocity : Vector3.zero); previousPosition = ((EntityState)this).transform.position - val4; ((EntityState)this).PlayAnimation("FullBody, Override", "Roll", "Roll.playbackRate", duration); Util.PlaySound(dodgeSoundString, ((EntityState)this).gameObject); if (NetworkServer.active) { ((EntityState)this).characterBody.AddTimedBuff(Buffs.armorBuff, 3f * duration); ((EntityState)this).characterBody.AddTimedBuff(Buffs.HiddenInvincibility, 0.5f * duration); } } private void RecalculateRollSpeed() { rollSpeed = ((BaseState)this).moveSpeedStat * Mathf.Lerp(initialSpeedCoefficient, finalSpeedCoefficient, ((EntityState)this).fixedAge / duration); } public override void FixedUpdate() { //IL_0025: 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: 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_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) ((EntityState)this).FixedUpdate(); RecalculateRollSpeed(); if (Object.op_Implicit((Object)(object)((EntityState)this).characterDirection)) { ((EntityState)this).characterDirection.forward = forwardDirection; } if (Object.op_Implicit((Object)(object)((EntityState)this).cameraTargetParams)) { ((EntityState)this).cameraTargetParams.fovOverride = Mathf.Lerp(dodgeFOV, 60f, ((EntityState)this).fixedAge / duration); } Vector3 val = ((EntityState)this).transform.position - previousPosition; Vector3 normalized = ((Vector3)(ref val)).normalized; if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) && Object.op_Implicit((Object)(object)((EntityState)this).characterDirection) && normalized != Vector3.zero) { Vector3 val2 = normalized * rollSpeed; float num = Mathf.Max(Vector3.Dot(val2, forwardDirection), 0f); val2 = forwardDirection * num; val2.y = 0f; ((EntityState)this).characterMotor.velocity = val2; } previousPosition = ((EntityState)this).transform.position; if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= duration) { ((EntityState)this).outer.SetNextStateToMain(); } } public override void OnExit() { if (Object.op_Implicit((Object)(object)((EntityState)this).cameraTargetParams)) { ((EntityState)this).cameraTargetParams.fovOverride = -1f; } ((EntityState)this).OnExit(); ((EntityState)this).characterMotor.disableAirControlUntilCollision = false; } public override void OnSerialize(NetworkWriter writer) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) ((BaseSkillState)this).OnSerialize(writer); writer.Write(forwardDirection); } public override void OnDeserialize(NetworkReader reader) { //IL_000b: 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) ((BaseSkillState)this).OnDeserialize(reader); forwardDirection = reader.ReadVector3(); } } public class Shoot : BaseSkillState { public static float damageCoefficient = 3f; public static float procCoefficient = 1f; public static float baseDuration = 0.75f; public static float force = 800f; public static float recoil = 3f; public static float range = 256f; public static GameObject tracerEffectPrefab = LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/Tracers/TracerBanditPistol"); private float duration; private float fireTime; private bool hasFired; private string muzzleString; public override void OnEnter() { ((BaseState)this).OnEnter(); duration = baseDuration / ((BaseState)this).attackSpeedStat; fireTime = 0f; ((EntityState)this).characterBody.SetAimTimer(2f); muzzleString = "Muzzle"; ((EntityState)this).PlayAnimation("Gesture, Override", "ShootGun", "ShootGun.playbackRate", 1f); } public override void OnExit() { ((EntityState)this).OnExit(); } private void Fire() { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: 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_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0101: 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_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) if (!hasFired) { hasFired = true; ((EntityState)this).characterBody.AddSpreadBloom(1.5f); EffectManager.SimpleMuzzleFlash(Assets.muzzleFlash, ((EntityState)this).gameObject, muzzleString, false); Util.PlaySound("ConscriptPiercingShot", ((EntityState)this).gameObject); if (((EntityState)this).isAuthority) { Ray aimRay = ((BaseState)this).GetAimRay(); ((BaseState)this).AddRecoil(-1f * recoil, -2f * recoil, -0.5f * recoil, 0.5f * recoil); new BulletAttack { bulletCount = 1u, aimVector = ((Ray)(ref aimRay)).direction, origin = ((Ray)(ref aimRay)).origin, damage = damageCoefficient * ((BaseState)this).damageStat, damageColorIndex = (DamageColorIndex)0, damageType = (DamageType)0, falloffModel = (FalloffModel)1, maxDistance = range, force = force, hitMask = CommonMasks.bullet, minSpread = 0f, maxSpread = 0f, isCrit = ((BaseState)this).RollCrit(), owner = ((EntityState)this).gameObject, muzzleName = muzzleString, smartCollision = false, procChainMask = default(ProcChainMask), procCoefficient = procCoefficient, radius = 0.75f, sniper = false, stopperMask = CommonMasks.interactable, weapon = null, tracerEffectPrefab = tracerEffectPrefab, spreadPitchScale = 0f, spreadYawScale = 0f, queryTriggerInteraction = (QueryTriggerInteraction)0, hitEffectPrefab = Assets.bulletImpact }.Fire(); } } } public override void FixedUpdate() { ((EntityState)this).FixedUpdate(); if (((EntityState)this).fixedAge >= fireTime) { Fire(); } if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority) { ((EntityState)this).outer.SetNextStateToMain(); } } 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; } } public class ShootBurst : BaseSkillState { public static float damageCoefficient = 1f; public static float procCoefficient = 0.5f; public static float baseDuration = 1f; public static float force = 800f; public static float recoil = 5f; public static float range = 128f; public static GameObject tracerEffectPrefab = LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/Tracers/TracerBanditPistol"); private float duration; private float fireTime; private bool hasFired; private string muzzleString; public override void OnEnter() { ((BaseState)this).OnEnter(); duration = baseDuration / ((BaseState)this).attackSpeedStat; fireTime = 0f; ((EntityState)this).characterBody.SetAimTimer(2f); muzzleString = "Muzzle"; ((EntityState)this).PlayAnimation("Gesture, Override", "ShootGun", "ShootGun.playbackRate", 1f); } public override void OnExit() { ((EntityState)this).OnExit(); } private void Fire() { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: 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_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) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: 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_0122: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_0193: 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_01a9: 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_01b0: Unknown result type (might be due to invalid IL or missing references) if (!hasFired) { hasFired = true; ((EntityState)this).characterBody.AddSpreadBloom(1.5f); EffectManager.SimpleMuzzleFlash(Assets.muzzleFlash, ((EntityState)this).gameObject, muzzleString, false); Util.PlaySound("ConscriptBurstShot", ((EntityState)this).gameObject); if (((EntityState)this).isAuthority) { Ray aimRay = ((BaseState)this).GetAimRay(); ((BaseState)this).AddRecoil(-1f * Shoot.recoil, -2f * Shoot.recoil, -0.5f * Shoot.recoil, 0.5f * Shoot.recoil); new BulletAttack { bulletCount = 10u, aimVector = ((Ray)(ref aimRay)).direction, origin = ((Ray)(ref aimRay)).origin, damage = damageCoefficient * ((BaseState)this).damageStat, damageColorIndex = (DamageColorIndex)0, damageType = (DamageType)0, falloffModel = (FalloffModel)2, maxDistance = range, force = force, hitMask = CommonMasks.bullet, minSpread = 1f, maxSpread = 8f, isCrit = ((BaseState)this).RollCrit(), owner = ((EntityState)this).gameObject, muzzleName = muzzleString, smartCollision = false, procChainMask = default(ProcChainMask), procCoefficient = procCoefficient, radius = 0.75f, sniper = false, stopperMask = CommonMasks.bullet, weapon = null, tracerEffectPrefab = tracerEffectPrefab, spreadPitchScale = 1f, spreadYawScale = 1f, queryTriggerInteraction = (QueryTriggerInteraction)0, hitEffectPrefab = Assets.bulletImpact }.Fire(); } } } public override void FixedUpdate() { ((EntityState)this).FixedUpdate(); if (((EntityState)this).fixedAge >= fireTime) { Fire(); } if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority) { ((EntityState)this).outer.SetNextStateToMain(); } } 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; } } public class ThrowBomb : GenericProjectileBaseState { public static float BaseDuration = 0.65f; public static float BaseDelayDuration = 0.35f * BaseDuration; public static float DamageCoefficient = 8f; public override void OnEnter() { base.projectilePrefab = Projectiles.bombPrefab; base.attackSoundString = "ConscriptGrenadeThrow"; base.baseDuration = BaseDuration; base.baseDelayBeforeFiringProjectile = BaseDelayDuration; base.damageCoefficient = DamageCoefficient; base.force = 80f; base.recoilAmplitude = 0.1f; base.bloom = 10f; ((GenericProjectileBaseState)this).OnEnter(); } public override void FixedUpdate() { ((GenericProjectileBaseState)this).FixedUpdate(); } 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 override void PlayAnimation(float duration) { if (Object.op_Implicit((Object)(object)((EntityState)this).GetModelAnimator())) { ((EntityState)this).PlayAnimation("Gesture, Override", "ThrowBomb", "ThrowBomb.playbackRate", base.duration); } } } } namespace ConscriptMod.SkillStates.BaseStates { public class BaseMeleeAttack : BaseSkillState { public int swingIndex; protected string hitboxName = "BatonHitbox"; protected DamageType damageType = (DamageType)0; protected float damageCoefficient = 3.5f; protected float procCoefficient = 1f; protected float pushForce = 300f; protected Vector3 bonusForce = Vector3.zero; protected float baseDuration = 1f; protected float attackStartTime = 0.2f; protected float attackEndTime = 0.4f; protected float baseEarlyExitTime = 0.4f; protected float hitStopDuration = 0.012f; protected float attackRecoil = 0.75f; protected float hitHopVelocity = 4f; protected bool cancelled = false; protected string swingSoundString = ""; protected string hitSoundString = ""; protected string muzzleString = "SwingCenter"; protected GameObject swingEffectPrefab; protected GameObject hitEffectPrefab; protected NetworkSoundEventIndex impactSound; private float earlyExitTime; public float duration; private bool hasFired; private float hitPauseTimer; private OverlapAttack attack; protected bool inHitPause; private bool hasHopped; protected float stopwatch; protected Animator animator; private HitStopCachedState hitStopCachedState; private Vector3 storedVelocity; public override void OnEnter() { //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Expected O, but got Unknown //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: 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_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) ((BaseState)this).OnEnter(); duration = baseDuration / ((BaseState)this).attackSpeedStat; earlyExitTime = baseEarlyExitTime / ((BaseState)this).attackSpeedStat; hasFired = false; animator = ((EntityState)this).GetModelAnimator(); ((BaseState)this).StartAimMode(0.5f + duration, false); ((EntityState)this).characterBody.outOfCombatStopwatch = 0f; animator.SetBool("attacking", true); HitBoxGroup hitBoxGroup = null; Transform modelTransform = ((EntityState)this).GetModelTransform(); if (Object.op_Implicit((Object)(object)modelTransform)) { hitBoxGroup = Array.Find(((Component)modelTransform).GetComponents<HitBoxGroup>(), (HitBoxGroup element) => element.groupName == hitboxName); } PlayAttackAnimation(); attack = new OverlapAttack(); attack.damageType = damageType; attack.attacker = ((EntityState)this).gameObject; attack.inflictor = ((EntityState)this).gameObject; attack.teamIndex = ((BaseState)this).GetTeam(); attack.damage = damageCoefficient * ((BaseState)this).damageStat; attack.procCoefficient = procCoefficient; attack.hitEffectPrefab = hitEffectPrefab; attack.forceVector = bonusForce; attack.pushAwayForce = pushForce; attack.hitBoxGroup = hitBoxGroup; attack.isCrit = ((BaseState)this).RollCrit(); attack.impactSound = impactSound; } protected virtual void PlayAttackAnimation() { ((EntityState)this).PlayCrossfade("Gesture, Override", "Slash1", "Slash.playbackRate", duration, 0.05f); } public override void OnExit() { ((EntityState)this).OnExit(); animator.SetBool("attacking", false); } protected virtual void PlaySwingEffect() { EffectManager.SimpleMuzzleFlash(swingEffectPrefab, ((EntityState)this).gameObject, muzzleString, true); } protected virtual void OnHitEnemyAuthority() { //IL_0090: 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_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) Util.PlaySound(hitSoundString, ((EntityState)this).gameObject); if (!hasHopped) { if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) && !((EntityState)this).characterMotor.isGrounded && hitHopVelocity > 0f) { ((BaseState)this).SmallHop(((EntityState)this).characterMotor, hitHopVelocity); } hasHopped = true; } if (!inHitPause && hitStopDuration > 0f) { storedVelocity = ((EntityState)this).characterMotor.velocity; hitStopCachedState = ((BaseState)this).CreateHitStopCachedState(((EntityState)this).characterMotor, animator, "Slash.playbackRate"); hitPauseTimer = hitStopDuration / ((BaseState)this).attackSpeedStat; inHitPause = true; } } private void FireAttack() { if (!hasFired) { hasFired = true; Util.PlayAttackSpeedSound(swingSoundString, ((EntityState)this).gameObject, ((BaseState)this).attackSpeedStat); if (((EntityState)this).isAuthority) { PlaySwingEffect(); ((BaseState)this).AddRecoil(-1f * attackRecoil, -2f * attackRecoil, -0.5f * attackRecoil, 0.5f * attackRecoil); } } if (((EntityState)this).isAuthority && attack.Fire((List<HurtBox>)null)) { OnHitEnemyAuthority(); } } protected virtual void SetNextState() { int num = ((swingIndex == 0) ? 1 : 0); ((EntityState)this).outer.SetNextState((EntityState)(object)new BaseMeleeAttack { swingIndex = num }); } public override void FixedUpdate() { //IL_0037: 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) //IL_0061: 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) ((EntityState)this).FixedUpdate(); hitPauseTimer -= Time.fixedDeltaTime; if (hitPauseTimer <= 0f && inHitPause) { ((BaseState)this).ConsumeHitStopCachedState(hitStopCachedState, ((EntityState)this).characterMotor, animator); inHitPause = false; ((EntityState)this).characterMotor.velocity = storedVelocity; } if (!inHitPause) { stopwatch += Time.fixedDeltaTime; } else { if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor)) { ((EntityState)this).characterMotor.velocity = Vector3.zero; } if (Object.op_Implicit((Object)(object)animator)) { animator.SetFloat("Swing.playbackRate", 0f); } } if (stopwatch >= duration * attackStartTime && stopwatch <= duration * attackEndTime) { FireAttack(); } if (stopwatch >= duration && ((EntityState)this).isAuthority) { ((EntityState)this).outer.SetNextStateToMain(); } } 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 override void OnSerialize(NetworkWriter writer) { ((BaseSkillState)this).OnSerialize(writer); writer.Write(swingIndex); } public override void OnDeserialize(NetworkReader reader) { ((BaseSkillState)this).OnDeserialize(reader); swingIndex = reader.ReadInt32(); } } public class BaseTimedSkillState : BaseSkillState { public static float TimedBaseDuration; public static float TimedBaseCastStartTime; public static float TimedBaseCastEndTime; protected float duration; protected float castStartTime; protected float castEndTime; protected bool hasFired; protected bool isFiring; protected bool hasExited; protected virtual void InitDurationValues(float baseDuration, float baseCastStartTime, float baseCastEndTime = 1f) { TimedBaseDuration = baseDuration; TimedBaseCastStartTime = baseCastStartTime; TimedBaseCastEndTime = baseCastEndTime; duration = TimedBaseDuration / ((BaseState)this).attackSpeedStat; castStartTime = baseCastStartTime * duration; castEndTime = baseCastEndTime * duration; } protected virtual void OnCastEnter() { } protected virtual void OnCastFixedUpdate() { } protected virtual void OnCastUpdate() { } protected virtual void OnCastExit() { } public override void FixedUpdate() { ((EntityState)this).FixedUpdate(); if (!hasFired && ((EntityState)this).fixedAge > castStartTime) { hasFired = true; OnCastEnter(); } bool flag = ((EntityState)this).fixedAge >= castStartTime; bool flag2 = ((EntityState)this).fixedAge >= castEndTime; isFiring = false; if ((flag && !flag2) || (flag && flag2 && !hasFired)) { isFiring = true; OnCastFixedUpdate(); } if (flag2 && !hasExited) { hasExited = true; OnCastExit(); } if (((EntityState)this).fixedAge > duration) { ((EntityState)this).outer.SetNextStateToMain(); } } public override void Update() { ((EntityState)this).Update(); if (isFiring) { OnCastUpdate(); } } } public class ExampleTimedSkillState : BaseTimedSkillState { public static float SkillBaseDuration = 1.5f; public static float SkillStartTime = 0.2f; public static float SkillEndTime = 0.9f; public override void OnEnter() { ((BaseState)this).OnEnter(); InitDurationValues(SkillBaseDuration, SkillStartTime, SkillEndTime); } protected override void OnCastEnter() { } protected override void OnCastFixedUpdate() { } protected override void OnCastExit() { } } public class ExampleDelayedSkillState : BaseTimedSkillState { public static float SkillBaseDuration = 1.5f; public static float SkillStartTime = 0.2f; public override void OnEnter() { ((BaseState)this).OnEnter(); InitDurationValues(SkillBaseDuration, SkillStartTime); } protected override void OnCastEnter() { } } } namespace ConscriptMod.Modules { internal static class Assets { internal static GameObject batonSwingEffect; internal static GameObject greandeExplosionEffect; internal static GameObject muzzleFlash; internal static GameObject bulletImpact; internal static GameObject kickEffect; internal static NetworkSoundEventDef batonHitSoundEvent; internal static AssetBundle mainAssetBundle; private const string assetbundleName = "conscriptassets"; private const string csProjName = "ConscriptMod"; internal static void Initialize() { bool flag = false; LoadAssetBundle(); LoadSoundbank(); PopulateAssets(); } internal static void LoadAssetBundle() { try { if ((Object)(object)mainAssetBundle == (Object)null) { using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("ConscriptMod.conscriptassets")) { mainAssetBundle = AssetBundle.LoadFromStream(stream); return; } } } catch (Exception ex) { Log.Error("Failed to load assetbundle. Make sure your assetbundle name is setup correctly\n" + ex); } } internal static void LoadSoundbank() { using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("ConscriptMod.ConscriptBank.bnk"); byte[] array = new byte[stream.Length]; stream.Read(array, 0, array.Length); SoundBanks.Add(array); } internal static void PopulateAssets() { //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)mainAssetBundle)) { Log.Error("There is no AssetBundle to load assets from."); return; } batonHitSoundEvent = CreateNetworkSoundEventDef("ConscriptBatonHit"); greandeExplosionEffect = LoadEffect("ConscriptGrenadeExplosion", "ConscriptGrenadeExplode"); muzzleFlash = LoadEffect("ConscriptMuzzle"); bulletImpact = LoadEffect("ConscriptImpact"); if (Object.op_Implicit((Object)(object)greandeExplosionEffect)) { ShakeEmitter val = greandeExplosionEffect.AddComponent<ShakeEmitter>(); val.amplitudeTimeDecay = true; val.duration = 0.5f; val.radius = 200f; val.scaleShakeRadiusWithLocalScale = false; val.wave = new Wave { amplitude = 1.5f, frequency = 45f, cycleOffset = 0f }; } batonSwingEffect = LoadEffect("ConscriptBatonSwing", parentToTransform: true); kickEffect = LoadEffect("ConscriptKickWave", parentToTransform: true); } private static GameObject CreateTracer(string originalTracerName, string newTracerName) { if ((Object)(object)LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/Tracers/" + originalTracerName) == (Object)null) { return null; } GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/Tracers/" + originalTracerName), newTracerName, true); if (!Object.op_Implicit((Object)(object)val.GetComponent<EffectComponent>())) { val.AddComponent<EffectComponent>(); } if (!Object.op_Implicit((Object)(object)val.GetComponent<VFXAttributes>())) { val.AddComponent<VFXAttributes>(); } if (!Object.op_Implicit((Object)(object)val.GetComponent<NetworkIdentity>())) { val.AddComponent<NetworkIdentity>(); } val.GetComponent<Tracer>().speed = 250f; val.GetComponent<Tracer>().length = 50f; AddNewEffectDef(val); return val; } internal static NetworkSoundEventDef CreateNetworkSoundEventDef(string eventName) { NetworkSoundEventDef val = ScriptableObject.CreateInstance<NetworkSoundEventDef>(); val.akId = AkSoundEngine.GetIDFromString(eventName); val.eventName = eventName; Content.AddNetworkSoundEventDef(val); return val; } internal static void ConvertAllRenderersToHopooShader(GameObject objectToConvert) { if (!Object.op_Implicit((Object)(object)objectToConvert)) { return; } Renderer[] componentsInChildren = objectToConvert.GetComponentsInChildren<Renderer>(); foreach (Renderer val in componentsInChildren) { if (val != null) { val.material?.SetHopooMaterial(); } } } internal static RendererInfo[] SetupRendererInfos(GameObject obj) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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) MeshRenderer[] componentsInChildren = obj.GetComponentsInChildren<MeshRenderer>(); RendererInfo[] array = (RendererInfo[])(object)new RendererInfo[componentsInChildren.Length]; for (int i = 0; i < componentsInChildren.Length; i++) { array[i] = new RendererInfo { defaultMaterial = ((Renderer)componentsInChildren[i]).material, renderer = (Renderer)(object)componentsInChildren[i], defaultShadowCastingMode = (ShadowCastingMode)1, ignoreOverlays = false }; } return array; } public static GameObject LoadSurvivorModel(string modelName) { GameObject val = mainAssetBundle.LoadAsset<GameObject>(modelName); if ((Object)(object)val == (Object)null) { Log.Error("Trying to load a null model- check to see if the BodyName in your code matches the prefab name of the object in Unity\nFor Example, if your prefab in unity is 'mdlHenry', then your BodyName must be 'Henry'"); return null; } return PrefabAPI.InstantiateClone(val, ((Object)val).name, false); } internal static GameObject LoadCrosshair(string crosshairName) { if ((Object)(object)LegacyResourcesAPI.Load<GameObject>("Prefabs/Crosshair/" + crosshairName + "Crosshair") == (Object)null) { return LegacyResourcesAPI.Load<GameObject>("Prefabs/Crosshair/StandardCrosshair"); } return LegacyResourcesAPI.Load<GameObject>("Prefabs/Crosshair/" + crosshairName + "Crosshair"); } private static GameObject LoadEffect(string resourceName) { return LoadEffect(resourceName, "", parentToTransform: false); } private static GameObject LoadEffect(string resourceName, string soundName) { return LoadEffect(resourceName, soundName, parentToTransform: false); } private static GameObject LoadEffect(string resourceName, bool parentToTransform) { return LoadEffect(resourceName, "", parentToTransform); } private static GameObject LoadEffect(string resourceName, string soundName, bool parentToTransform) { //IL_0053: 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) GameObject val = mainAssetBundle.LoadAsset<GameObject>(resourceName); if (!Object.op_Implicit((Object)(object)val)) { Log.Error("Failed to load effect: " + resourceName + " because it does not exist in the AssetBundle"); return null; } val.AddComponent<DestroyOnTimer>().duration = 12f; val.AddComponent<NetworkIdentity>(); val.AddComponent<VFXAttributes>().vfxPriority = (VFXPriority)2; EffectComponent val2 = val.AddComponent<EffectComponent>(); val2.applyScale = false; val2.effectIndex = (EffectIndex)(-1); val2.parentToReferencedTransform = parentToTransform; val2.positionAtReferencedTransform = true; val2.soundName = soundName; AddNewEffectDef(val, soundName); return val; } private static void AddNewEffectDef(GameObject effectPrefab) { AddNewEffectDef(effectPrefab, ""); } private static void AddNewEffectDef(GameObject effectPrefab, string soundName) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown EffectDef val = new EffectDef(); val.prefab = effectPrefab; val.prefabEffectComponent = effectPrefab.GetComponent<EffectComponent>(); val.prefabName = ((Object)effectPrefab).name; val.prefabVfxAttributes = effectPrefab.GetComponent<VFXAttributes>(); val.spawnSoundEventName = soundName; Content.AddEffectDef(val); } } public static class Buffs { internal static BuffDef armorBuff; internal static void RegisterBuffs() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) armorBuff = AddNewBuff("ArmorBuff", LegacyResourcesAPI.Load<BuffDef>("BuffDefs/HiddenInvincibility").iconSprite, Color.white, canStack: false, isDebuff: false); } internal static BuffDef AddNewBuff(string buffName, Sprite buffIcon, Color buffColor, bool canStack, bool isDebuff) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) BuffDef val = ScriptableObject.CreateInstance<BuffDef>(); ((Object)val).name = buffName; val.buffColor = buffColor; val.canStack = canStack; val.isDebuff = isDebuff; val.eliteDef = null; val.iconSprite = buffIcon; Content.AddBuffDef(val); return val; } } public static class Config { public static void ReadConfig() { } public static ConfigEntry<bool> CharacterEnableConfig(string characterName, string description = "Set to false to disable this character", bool enabledDefault = true) { return ((BaseUnityPlugin)ConscriptPlugin.instance).Config.Bind<bool>("General", "Enable " + characterName, enabledDefault, description); } } internal class ContentPacks : IContentPackProvider { internal ContentPack contentPack = new ContentPack(); public static List<GameObject> bodyPrefabs = new List<GameObject>(); public static List<GameObject> masterPrefabs = new List<GameObject>(); public static List<GameObject> projectilePrefabs = new List<GameObject>(); public static List<SurvivorDef> survivorDefs = new List<SurvivorDef>(); public static List<UnlockableDef> unlockableDefs = new List<UnlockableDef>(); public static List<SkillFamily> skillFamilies = new List<SkillFamily>(); public static List<SkillDef> skillDefs = new List<SkillDef>(); public static List<Type> entityStates = new List<Type>(); public static List<BuffDef> buffDefs = new List<BuffDef>(); public static List<EffectDef> effectDefs = new List<EffectDef>(); public static List<NetworkSoundEventDef> networkSoundEventDefs = new List<NetworkSoundEventDef>(); public string identifier => "com.manti.ConscriptMod"; public void Initialize() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown ContentManager.collectContentPackProviders += new CollectContentPackProvidersDelegate(ContentManager_collectContentPackProviders); } private void ContentManager_collectContentPackProviders(AddContentPackProviderDelegate addContentPackProvider) { addContentPackProvider.Invoke((IContentPackProvider)(object)this); } public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args) { contentPack.identifier = identifier; contentPack.bodyPrefabs.Add(bodyPrefabs.ToArray()); contentPack.masterPrefabs.Add(masterPrefabs.ToArray()); contentPack.projectilePrefabs.Add(projectilePrefabs.ToArray()); contentPack.survivorDefs.Add(survivorDefs.ToArray()); contentPack.unlockableDefs.Add(unlockableDefs.ToArray()); contentPack.skillDefs.Add(skillDefs.ToArray()); contentPack.skillFamilies.Add(skillFamilies.ToArray()); contentPack.entityStateTypes.Add(entityStates.ToArray()); contentPack.buffDefs.Add(buffDefs.ToArray()); contentPack.effectDefs.Add(effectDefs.ToArray()); contentPack.networkSoundEventDefs.Add(networkSoundEventDefs.ToArray()); args.ReportProgress(1f); yield break; } public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args) { ContentPack.Copy(contentPack, args.output); args.ReportProgress(1f); yield break; } public IEnumerator FinalizeAsync(FinalizeAsyncArgs args) { args.ReportProgress(1f); yield break; } } internal class Content { public static void AddCharacterBodyPrefab(GameObject bprefab) { ContentPacks.bodyPrefabs.Add(bprefab); } public static void AddMasterPrefab(GameObject prefab) { ContentPacks.masterPrefabs.Add(prefab); } public static void AddProjectilePrefab(GameObject prefab) { ContentPacks.projectilePrefabs.Add(prefab); } public static void AddSurvivorDef(SurvivorDef survivorDef) { ContentPacks.survivorDefs.Add(survivorDef); } public static void AddUnlockableDef(UnlockableDef unlockableDef) { ContentPacks.unlockableDefs.Add(unlockableDef); } public static void AddSkillDef(SkillDef skillDef) { ContentPacks.skillDefs.Add(skillDef); } public static void AddSkillFamily(SkillFamily skillFamily) { ContentPacks.skillFamilies.Add(skillFamily); } public static void AddEntityState(Type entityState) { ContentPacks.entityStates.Add(entityState); } public static void AddBuffDef(BuffDef buffDef) { ContentPacks.buffDefs.Add(buffDef); } public static void AddEffectDef(EffectDef effectDef) { ContentPacks.effectDefs.Add(effectDef); } public static void AddNetworkSoundEventDef(NetworkSoundEventDef networkSoundEventDef) { ContentPacks.networkSoundEventDefs.Add(networkSoundEventDef); } } internal static class Helpers { internal const string agilePrefix = "<style=cIsUtility>Agile.</style> "; internal static string ScepterDescription(string desc) { return "\n<color=#d299ff>SCEPTER: " + desc + "</color>"; } public static T[] Append<T>(ref T[] array, List<T> list) { int num = array.Length; int count = list.Count; Array.Resize(ref array, num + count); list.CopyTo(array, num); return array; } public static Func<T[], T[]> AppendDel<T>(List<T> list) { return (T[] r) => Append(ref r, list); } } internal static class ItemDisplays { private static Dictionary<string, GameObject> itemDisplayPrefabs = new Dictionary<string, GameObject>(); internal static void PopulateDisplays() { PopulateFromBody("MageBody"); PopulateFromBody("LunarExploderBody"); PopulateCustomLightningArm(); } private static void PopulateFromBody(string bodyName) { ItemDisplayRuleSet itemDisplayRuleSet = ((Component)LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterBodies/" + bodyName).GetComponent<ModelLocator>().modelTransform).GetComponent<CharacterModel>().itemDisplayRuleSet; KeyAssetRuleGroup[] keyAssetRuleGroups = itemDisplayRuleSet.keyAssetRuleGroups; for (int i = 0; i < keyAssetRuleGroups.Length; i++) { ItemDisplayRule[] rules = keyAssetRuleGroups[i].displayRuleGroup.rules; for (int j = 0; j < rules.Length; j++) { GameObject followerPrefab = rules[j].followerPrefab; if (Object.op_Implicit((Object)(object)followerPrefab)) { string key = ((Object)followerPrefab).name?.ToLowerInvariant(); if (!itemDisplayPrefabs.ContainsKey(key)) { itemDisplayPrefabs[key] = followerPrefab; } } } } } private static void PopulateCustomLightningArm() { GameObject val = PrefabAPI.InstantiateClone(itemDisplayPrefabs["displaylightningarmright"], "DisplayLightningCustom", false); LimbMatcher component = val.GetComponent<LimbMatcher>(); component.limbPairs[0].targetChildLimb = "LightningArm1"; component.limbPairs[1].targetChildLimb = "LightningArm2"; component.limbPairs[2].targetChildLimb = "LightningArmEnd"; itemDisplayPrefabs["displaylightningarmcustom"] = val; } public static GameObject LoadDisplay(string name) { if (itemDisplayPrefabs.ContainsKey(name.ToLowerInvariant()) && Object.op_Implicit((Object)(object)itemDisplayPrefabs[name.ToLowerInvariant()])) { return itemDisplayPrefabs[name.ToLowerInvariant()]; } Log.Error("item display " + name + " returned null"); return null; } } internal static class Materials { private static List<Material> cachedMaterials = new List<Material>(); internal static Shader hotpoo = LegacyResourcesAPI.Load<Shader>("Shaders/Deferred/HGStandard"); public static Material CreateHopooMaterial(string materialName) { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Expected O, but got Unknown Material val = cachedMaterials.Find(delegate(Material mat) { materialName.Replace(" (Instance)", ""); return ((Object)mat).name.Contains(materialName); }); if (Object.op_Implicit((Object)(object)val)) { return val; } val = Assets.mainAssetBundle.LoadAsset<Material>(materialName); if (!Object.op_Implicit((Object)(object)val)) { Log.Error("Failed to load material: " + materialName + " - Check to see that the material in your Unity project matches this name"); return new Material(hotpoo); } return val.SetHopooMaterial(); } public static Material SetHopooMaterial(this Material tempMat) { //IL_0089: 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_0107: Unknown result type (might be due to invalid IL or missing references) if (cachedMaterials.Contains(tempMat)) { return tempMat; } float? num = null; Color? val = null; if (tempMat.IsKeywordEnabled("_NORMALMAP")) { num = tempMat.GetFloat("_BumpScale"); } if (tempMat.IsKeywordEnabled("_EMISSION")) { val = tempMat.GetColor("_EmissionColor"); } tempMat.shader = hotpoo; tempMat.SetColor("_Color", tempMat.GetColor("_Color")); tempMat.SetTexture("_MainTex", tempMat.GetTexture("_MainTex")); tempMat.SetTexture("_EmTex", tempMat.GetTexture("_EmissionMap")); tempMat.EnableKeyword("DITHER"); if (num.HasValue) { tempMat.SetFloat("_NormalStrength", num.Value); } if (val.HasValue) { tempMat.SetColor("_EmColor", val.Value); tempMat.SetFloat("_EmPower", 1f); } if (tempMat.IsKeywordEnabled("NOCULL")) { tempMat.SetInt("_Cull", 0); } if (tempMat.IsKeywordEnabled("LIMBREMOVAL")) { tempMat.SetInt("_LimbRemovalOn", 1); } cachedMaterials.Add(tempMat); return tempMat; } public static Material MakeUnique(this Material material) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown if (cachedMaterials.Contains(material)) { return new Material(material); } return material; } public static Material SetColor(this Material material, Color color) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) material.SetColor("_Color", color); return material; } public static Material SetNormal(this Material material, float normalStrength = 1f) { material.SetFloat("_NormalStrength", normalStrength); return material; } public static Material SetEmission(this Material material) { return material.SetEmission(1f); } public static Material SetEmission(this Material material, float emission) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return material.SetEmission(emission, Color.white); } public static Material SetEmission(this Material material, float emission, Color emissionColor) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) material.SetFloat("_EmPower", emission); material.SetColor("_EmColor", emissionColor); return material; } public static Material SetCull(this Material material, bool cull = false) { material.SetInt("_Cull", cull ? 1 : 0); return material; } } internal static class Prefabs { private static PhysicMaterial ragdollMaterial; public static GameObject CreateDisplayPrefab(string displayModelName, GameObject prefab, BodyInfo bodyInfo) { GameObject val = Assets.LoadSurvivorModel(displayModelName); CharacterModel val2 = val.GetComponent<CharacterModel>(); if (!Object.op_Implicit((Object)(object)val2)) { val2 = val.AddComponent<CharacterModel>(); } val2.baseRendererInfos = prefab.GetComponentInChildren<CharacterModel>().baseRendererInfos; Assets.ConvertAllRenderersToHopooShader(val); return val.gameObject; } public static GameObject CreateBodyPrefab(string bodyName, string modelName, BodyInfo bodyInfo) { //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) GameObject val = LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterBodies/" + bodyInfo.bodyNameToClone + "Body"); if (!Object.op_Implicit((Object)(object)val)) { Log.Error(bodyInfo.bodyNameToClone + "Body is not a valid body, character creation failed"); return null; } GameObject val2 = PrefabAPI.InstantiateClone(val, bodyName); Transform val3 = null; GameObject val4 = null; if (modelName != "mdl") { val4 = Assets.LoadSurvivorModel(modelName); if ((Object)(object)val4 == (Object)null) { val4 = ((Component)val2.GetComponentInChildren<CharacterModel>()).gameObject; } val3 = AddCharacterModelToSurvivorBody(val2, val4.transform, bodyInfo); } CharacterBody component = val2.GetComponent<CharacterBody>(); ((Object)component).name = bodyInfo.bodyName; component.baseNameToken = bodyInfo.bodyNameToken; component.subtitleNameToken = bodyInfo.subtitleNameToken; component.portraitIcon = bodyInfo.characterPortrait; component.bodyColor = bodyInfo.bodyColor; component._defaultCrosshairPrefab = bodyInfo.crosshair; component.hideCrosshair = false; component.preferredPodPrefab = bodyInfo.podPrefab; component.baseMaxHealth = bodyInfo.maxHealth; component.baseRegen = bodyInfo.healthRegen; component.baseArmor = bodyInfo.armor; component.baseMaxShield = bodyInfo.shield; component.baseDamage = bodyInfo.damage; component.baseAttackSpeed = bodyInfo.attackSpeed; component.baseCrit = bodyInfo.crit; component.baseMoveSpeed = bodyInfo.moveSpeed; component.baseJumpPower = bodyInfo.jumpPower; component.autoCalculateLevelStats = bodyInfo.autoCalculateLevelStats; if (bodyInfo.autoCalculateLevelStats) { component.levelMaxHealth = Mathf.Round(component.baseMaxHealth * 0.3f); component.levelMaxShield = Mathf.Round(component.baseMaxShield * 0.3f); component.levelRegen = component.baseRegen * 0.2f; component.levelMoveSpeed = 0f; component.levelJumpPower = 0f; component.levelDamage = component.baseDamage * 0.2f; component.levelAttackSpeed = 0f; component.levelCrit = 0f; component.levelArmor = 0f; } else { component.levelMaxHealth = bodyInfo.healthGrowth; component.levelMaxShield = bodyInfo.shieldGrowth; component.levelRegen = bodyInfo.regenGrowth; component.levelMoveSpeed = bodyInfo.moveSpeedGrowth; component.levelJumpPower = bodyInfo.jumpPowerGrowth; component.levelDamage = bodyInfo.damageGrowth; component.levelAttackSpeed = bodyInfo.attackSpeedGrowth; component.levelCrit = bodyInfo.critGrowth; component.levelArmor = bodyInfo.armorGrowth; } component.baseAcceleration = bodyInfo.acceleration; component.baseJumpCount = bodyInfo.jumpCount; component.sprintingSpeedMultiplier = 1.45f; component.bodyFlags = (BodyFlags)16; component.rootMotionInMainState = false; component.hullClassification = (HullClassification)0; component.isChampion = false; SetupCameraTargetParams(val2, bodyInfo); SetupModelLocator(val2, val3, val4.transform); SetupCapsuleCollider(val2); SetupMainHurtbox(val2, val4); SetupAimAnimator(val2, val4); if ((Object)(object)val3 != (Object)null) { SetupCharacterDirection(val2, val3, val4.transform); } SetupFootstepController(val4); SetupRagdoll(val4); Content.AddCharacterBodyPrefab(val2); return val2; } public static void CreateGenericDoppelganger(GameObject bodyPrefab, string masterName, string masterToCopy) { GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterMasters/" + masterToCopy + "MonsterMaster"), masterName, true); val.GetComponent<CharacterMaster>().bodyPrefab = bodyPrefab; Content.AddMasterPrefab(val); } private static Transform AddCharacterModelToSurvivorBody(GameObject bodyPrefab, Transform modelTransform, BodyInfo bodyInfo) { //IL_0040: 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_0066: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected O, but got Unknown //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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_00e1: Expected O, but got Unknown //IL_00fa: 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) for (int num = bodyPrefab.transform.childCount - 1; num >= 0; num--) { Object.DestroyImmediate((Object)(object)((Component)bodyPrefab.transform.GetChild(num)).gameObject); } Transform transform = new GameObject("ModelBase").transform; transform.parent = bodyPrefab.transform; transform.localPosition = bodyInfo.modelBasePosition; transform.localRotation = Quaternion.identity; modelTransform.parent = ((Component)transform).transform; modelTransform.localPosition = Vector3.zero; modelTransform.localRotation = Quaternion.identity; GameObject val = new GameObject("CameraPivot"); val.transform.parent = bodyPrefab.transform; val.transform.localPosition = bodyInfo.cameraPivotPosition; val.transform.localRotation = Quaternion.identity; GameObject val2 = new GameObject("AimOrigin"); val2.transform.parent = bodyPrefab.transform; val2.transform.localPosition = bodyInfo.aimOriginPosition; val2.transform.localRotation = Quaternion.identity; bodyPrefab.GetComponent<CharacterBody>().aimOriginTransform = val2.transform; return ((Component)transform).transform; } public static CharacterModel SetupCharacterModel(GameObject prefab) { return SetupCharacterModel(prefab, null); } public static CharacterModel SetupCharacterModel(GameObject prefab, CustomRendererInfo[] customInfos) { CharacterModel val = ((Component)prefab.GetComponent<ModelLocator>().modelTransform).gameObject.GetComponent<CharacterModel>(); bool flag = (Object)(object)val != (Object)null; if (!flag) { val = ((Component)prefab.GetComponent<ModelLocator>().modelTransform).gameObject.AddComponent<CharacterModel>(); } val.body = prefab.GetComponent<CharacterBody>(); val.autoPopulateLightInfos = true; val.invisibilityCount = 0; val.temporaryOverlays = new List<TemporaryOverlay>(); if (!flag) { SetupCustomRendererInfos(val, customInfos); } else { SetupPreAttachedRendererInfos(val); } return val; } public static void SetupPreAttachedRendererInfos(CharacterModel characterModel) { for (int i = 0; i < characterModel.baseRendererInfos.Length; i++) { if ((Object)(object)characterModel.baseRendererInfos[i].defaultMaterial == (Object)null) { characterModel.baseRendererInfos[i].defaultMaterial = characterModel.baseRendererInfos[i].renderer.sharedMaterial; } characterModel.baseRendererInfos[i].defaultMaterial.SetHopooMaterial(); } } public static void SetupCustomRendererInfos(CharacterModel characterModel, CustomRendererInfo[] customInfos) { //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) ChildLocator component = ((Component)characterModel).GetComponent<ChildLocator>(); if (!Object.op_Implicit((Object)(object)component)) { Log.Error("Failed CharacterModel setup: ChildLocator component does not exist on the model"); return; } List<RendererInfo> list = new List<RendererInfo>(); for (int i = 0; i < customInfos.Length; i++) { if (!Object.op_Implicit((Object)(object)component.FindChild(customInfos[i].childName))) { Log.Error("Trying to add a RendererInfo for a renderer that does not exist: " + customInfos[i].childName); continue; } Renderer component2 = ((Component)component.FindChild(customInfos[i].childName)).GetComponent<Renderer>(); if (Object.op_Implicit((Object)(object)component2)) { Material val = customInfos[i].material; if ((Object)(object)val == (Object)null) { val = ((!customInfos[i].dontHotpoo) ? component2.material.SetHopooMaterial() : component2.material); } list.Add(new RendererInfo { renderer = component2, defaultMaterial = val, ignoreOverlays = customInfos[i].ignoreOverlays, defaultShadowCastingMode = (ShadowCastingMode)1 }); } } characterModel.baseRendererInfos = list.ToArray(); } private static void SetupCharacterDirection(GameObject prefab, Transform modelBaseTransform, Transform modelTransform) { if (Object.op_Implicit((Object)(object)prefab.GetComponent<CharacterDirection>())) { CharacterDirection component = prefab.GetComponent<CharacterDirection>(); component.targetTransform = modelBaseTransform; component.overrideAnimatorForwardTransform = null; component.rootMotionAccumulator = null; component.modelAnimator = ((Component)modelTransform).GetComponent<Animator>(); component.driveFromRootRotation = false; component.turnSpeed = 720f; } } private static void SetupCameraTargetParams(GameObject prefab, BodyInfo bodyInfo) { CameraTargetParams component = prefab.GetComponent<CameraTargetParams>(); component.cameraParams = bodyInfo.cameraParams; component.cameraPivotTransform = prefab.transform.Find("CameraPivot"); } private static void SetupModelLocator(GameObject prefab, Transform modelBaseTransform, Transform modelTransform) { ModelLocator component = prefab.GetComponent<ModelLocator>(); component.modelTransform = modelTransform; component.modelBaseTransform = modelBaseTransform; } private static void SetupCapsuleCollider(GameObject prefab) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) CapsuleCollider component = prefab.GetComponent<CapsuleCollider>(); component.center = new Vector3(0f, 0f, 0f); component.radius = 0.5f; component.height = 1.82f; component.direction = 1; } private static void SetupMainHurtbox(GameObject prefab, GameObject model) { //IL_0075: Unknown result type (might be due to invalid IL or missing references) ChildLocator component = model.GetComponent<ChildLocator>(); if (!Object.op_Implicit((Object)(object)component.FindChild("MainHurtbox"))) { Debug.LogWarning((object)"Could not set up main hurtbox: make sure you have a transform pair in your prefab's ChildLocator component called 'MainHurtbox'"); return; } HurtBoxGroup val = model.AddComponent<HurtBoxGroup>(); HurtBox val2 = ((Component)component.FindChild("MainHurtbox")).gameObject.AddComponent<HurtBox>(); ((Component)val2).gameObject.layer = LayerIndex.entityPrecise.intVal; val2.healthComponent = prefab.GetComponent<HealthComponent>(); val2.isBullseye = true; val2.damageModifier = (DamageModifier)0; val2.hurtBoxGroup = val; val2.indexInGroup = 0; val.hurtBoxes = (HurtBox[])(object)new HurtBox[1] { val2 }; val.mainHurtBox = val2; val.bullseyeCount = 1; } public static void SetupHurtBoxes(GameObject bodyPrefab) { HealthComponent component = bodyPrefab.GetComponent<HealthComponent>(); HurtBoxGroup[] componentsInChildren = bodyPrefab.GetComponentsInChildren<HurtBoxGroup>(); foreach (HurtBoxGroup val in componentsInChildren) { val.mainHurtBox.healthComponent = component; for (int j = 0; j < val.hurtBoxes.Length; j++) { val.hurtBoxes[j].healthComponent = component; } } } private static void SetupFootstepController(GameObject model) { FootstepHandler val = model.AddComponent<FootstepHandler>(); val.baseFootstepString = "Play_player_footstep"; val.sprintFootstepOverrideString = ""; val.enableFootstepDust = true; val.footstepDustPrefab = LegacyResourcesAPI.Load<GameObject>("Prefabs/GenericFootstepDust"); } private static void SetupRagdoll(GameObject model) { RagdollController component = model.GetComponent<RagdollController>(); if (!Object.op_Implicit((Object)(object)component)) { return; } if ((Object)(object)ragdollMaterial == (Object)null) { ragdollMaterial = ((Component)LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterBodies/CommandoBody").GetComponentInChildren<RagdollController>().bones[1]).GetComponent<Collider>().material; } Transform[] bones = component.bones; foreach (Transform val in bones) { if (Object.op_Implicit((Object)(object)val)) { ((Component)val).gameObject.layer = LayerIndex.ragdoll.intVal; Collider component2 = ((Component)val).GetComponent<Collider>(); if (Object.op_Implicit((Object)(object)component2)) { component2.material = ragdollMaterial; component2.sharedMaterial = ragdollMaterial; } } } } private static void SetupAimAnimator(GameObject prefab, GameObject model) { AimAnimator val = model.AddComponent<AimAnimator>(); val.directionComponent = prefab.GetComponent<CharacterDirection>(); val.pitchRangeMax = 60f; val.pitchRangeMin = -60f; val.yawRangeMin = -80f; val.yawRangeMax = 80f; val.pitchGiveupRange = 30f; val.yawGiveupRange = 10f; val.giveupDuration = 3f; val.inputBank = prefab.GetComponent<InputBankTest>(); } public static void SetupHitbox(GameObject prefab, Transform hitboxTransform, string hitboxName) { HitBoxGroup val = prefab.AddComponent<HitBoxGroup>(); HitBox val2 = ((Component)hitboxTransform).gameObject.AddComponent<HitBox>(); ((Component)hitboxTransform).gameObject.layer = LayerIndex.projectile.intVal; val.hitBoxes = (HitBox[])(object)new HitBox[1] { val2 }; val.groupName = hitboxName; } public static void SetupHitbox(GameObject prefab, string hitboxName, params Transform[] hitboxTransforms) { HitBoxGroup val = prefab.AddComponent<HitBoxGroup>(); List<HitBox> list = new List<HitBox>(); foreach (Transform val2 in hitboxTransforms) { HitBox item = ((Component)val2).gameObject.AddComponent<HitBox>(); ((Component)val2).gameObject.layer = LayerIndex.projectile.intVal; list.Add(item); } val.hitBoxes = list.ToArray(); val.groupName = hitboxName; } } public class CustomRendererInfo { public string childName; public Material material = null; public bool dontHotpoo = false; public bool ignoreOverlays = false; } internal static class Projectiles { internal static GameObject bombPrefab; internal static void RegisterProjectiles() { CreateBomb(); AddProjectile(bombPrefab); } internal static void AddProjectile(GameObject projectileToAdd) { Content.AddProjectilePrefab(projectileToAdd); } private static void CreateBomb() { //IL_0087: Unknown result type (might be due to invalid IL or missing references) bombPrefab = CloneProjectilePrefab("CommandoGrenadeProjectile", "ConscriptGrenadeProjectile"); ProjectileImpactExplosion component = bombPrefab.GetComponent<ProjectileImpactExplosion>(); InitializeImpactExplosion(component); ((ProjectileExplosion)component).blastRadius = 22f; component.destroyOnEnemy = false; component.lifetime = 14f; component.impactEffect = Assets.greandeExplosionEffect; component.lifetimeExpiredSound = Assets.CreateNetworkSoundEventDef("ConscriptGrenadeExplode"); component.timerAfterImpact = true; component.lifetimeAfterImpact = 0.5f; ((ProjectileExplosion)component).blastDamageCoefficient = 1.5f; ((Component)component).GetComponent<ProjectileDamage>().damageType = (DamageType)16777216; ProjectileController component2 = bombPrefab.GetComponent<ProjectileController>(); if ((Object)(object)Assets.mainAssetBundle.LoadAsset<GameObject>("ConscriptGrenadeGhost") != (Object)null) { component2.ghostPrefab = CreateGhostPrefab("ConscriptGrenadeGhost"); } component2.startSound = ""; } private static void InitializeImpactExplosion(ProjectileImpactExplosion projectileImpactExplosion) { //IL_0023: 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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) ((ProjectileExplosion)projectileImpactExplosion).blastDamageCoefficient = 1f; ((ProjectileExplosion)projectileImpactExplosion).blastProcCoefficient = 1f; ((ProjectileExplosion)projectileImpactExplosion).blastRadius = 1f; ((ProjectileExplosion)projectileImpactExplosion).bonusBlastForce = Vector3.zero; ((ProjectileExplosion)projectileImpactExplosion).childrenCount = 0; ((ProjectileExplosion)projectileImpactExplosion).childrenDamageCoefficient = 0f; ((ProjectileExplosion)projectileImpactExplosion).childrenProjectilePrefab = null; projectileImpactExplosion.destroyOnEnemy = false; projectileImpactExplosion.destroyOnWorld = false; ((ProjectileExplosion)projectileImpactExplosion).falloffModel = (FalloffModel)0; ((ProjectileExplosion)projectileImpactExplosion).fireChildren = false; projectileImpactExplosion.impactEffect = null; projectileImpactExplosion.lifetime = 0f; projectileImpactExplosion.lifetimeAfterImpact = 0f; projectileImpactExplosion.lifetimeRandomOffset = 0f; projectileImpactExplosion.offsetForLifetimeExpiredSound = 0f; projectileImpactExplosion.timerAfterImpact = false; ((Component)projectileImpactExplosion).GetComponent<ProjectileDamage>().damageType = (DamageType)0; } private static GameObject CreateGhostPrefab(string ghostName) { GameObject val = Assets.mainAssetBundle.LoadAsset<GameObject>(ghostName); if (!Object.op_Implicit((Object)(object)val.GetComponent<NetworkIdentity>())) { val.AddComponent<NetworkIdentity>(); } if (!Object.op_Implicit((Object)(object)val.GetComponent<ProjectileGhostController>())) { val.AddComponent<ProjectileGhostController>(); } Assets.ConvertAllRenderersToHopooShader(val); return val; } private static GameObject CloneProjectilePrefab(string prefabName, string newPrefabName) { return PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/Projectiles/" + prefabName), newPrefabName); } } internal static class Skills { public static void CreateSkillFamilies(GameObject targetPrefab, bool destroyExisting = true) { if (destroyExisting) { GenericSkill[] componentsInChildren = targetPrefab.GetComponentsInChildren<GenericSkill>(); foreach (GenericSkill val in componentsInChildren) { Object.DestroyImmediate((Object)(object)val); } } SkillLocator component = targetPrefab.GetComponent<SkillLocator>(); component.primary = CreateGenericSkillWithSkillFamily(targetPrefab, "Primary"); component.secondary = CreateGenericSkillWithSkillFamily(targetPrefab, "Secondary"); component.utility = CreateGenericSkillWithSkillFamily(targetPrefab, "Utility"); component.special = CreateGenericSkillWithSkillFamily(targetPrefab, "Special"); } public static GenericSkill CreateGenericSkillWithSkillFamily(GameObject targetPrefab, string familyName, bool hidden = false) { GenericSkill val = targetPrefab.AddComponent<GenericSkill>(); val.skillName = familyName; val.hideInCharacterSelect = hidden; SkillFamily val2 = ScriptableObject.CreateInstance<SkillFamily>(); ((Object)val2).name = ((Object)targetPrefab).name + familyName + "Family"; val2.variants = (Variant[])(object)new Variant[0]; val._skillFamily = val2; Content.AddSkillFamily(val2); return val; } public static void AddSkillToFamily(SkillFamily skillFamily, SkillDef skillDef, UnlockableDef unlockableDef = null) { //IL_0029: 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) 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, unlockableDef = unlockableDef }; ((Variant)(ref val)).viewableNode = new Node(skillDef.skillNameToken, false, (Node)null); variants[num] = val; } public static void AddSkillsToFamily(SkillFamily skillFamily, params SkillDef[] skillDefs) { foreach (SkillDef skillDef in skillDefs) { AddSkillToFamily(skillFamily, skillDef); } } public static void AddPrimarySkills(GameObject targetPrefab, params SkillDef[] skillDefs) { AddSkillsToFamily(targetPrefab.GetComponent<SkillLocator>().primary.skillFamily, skillDefs); } public static void AddSecondarySkills(GameObject targetPrefab, params SkillDef[] skillDefs) { AddSkillsToFamily(targetPrefab.GetComponent<SkillLocator>().secondary.skillFamily, skillDefs); } public static void AddUtilitySkills(GameObject targetPrefab, params SkillDef[] skillDefs) { AddSkillsToFamily(targetPrefab.GetComponent<SkillLocator>().utility.skillFamily, skillDefs); } public static void AddSpecialSkills(GameObject targetPrefab, params SkillDef[] skillDefs) { AddSkillsToFamily(targetPrefab.GetComponent<SkillLocator>().special.skillFamily, skillDefs); } public static void AddUnlockablesToFamily(SkillFamily skillFamily, params UnlockableDef[] unlockableDefs) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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) for (int i = 0; i < unlockableDefs.Length; i++) { Variant val = skillFamily.variants[i]; val.unlockableDef = unlockableDefs[i]; skillFamily.variants[i] = val; } } public static SkillDef CreateSkillDef(SkillDefInfo skillDefInfo) { return Skills.CreateSkillDef<SkillDef>(skillDefInfo); } public static T CreateSkillDef<T>(SkillDefInfo skillDefInfo) where T : SkillDef { //IL_0064: 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_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) T val = ScriptableObject.CreateInstance<T>(); ((SkillDef)val).skillName = skillDefInfo.skillName; ((Object)(object)val).name = skillDefInfo.skillName; ((SkillDef)val).skillNameToken = skillDefInfo.skillNameToken; ((SkillDef)val).skillDescriptionToken = skillDefInfo.skillDescriptionToken; ((SkillDef)val).icon = skillDefInfo.skillIcon; ((SkillDef)val).activationState = skillDefInfo.activationState; ((SkillDef)val).activationStateMachineName = skillDefInfo.activationStateMachineName; ((SkillDef)val).baseMaxStock = skillDefInfo.baseMaxStock; ((SkillDef)val).baseRechargeInterval = skillDefInfo.baseRechargeInterval; ((SkillDef)val).beginSkillCooldownOnSkillEnd = skillDefInfo.beginSkillCooldownOnSkillEnd; ((SkillDef)val).canceledFromSprinting = skillDefInfo.canceledFromSprinting; ((SkillDef)val).forceSprintDuringState = skillDefInfo.forceSprintDuringState; ((SkillDef)val).fullRestockOnAssign = skillDefInfo.fullRestockOnAssign; ((SkillDef)val).interruptPriority = skillDefInfo.interruptPriority; ((SkillDef)val).resetCooldownTimerOnUse = skillDefInfo.resetCooldownTimerOnUse; ((SkillDef)val).isCombatSkill = skillDefInfo.isCombatSkill; ((SkillDef)val).mustKeyPress = skillDefInfo.mustKeyPress; ((SkillDef)val).cancelSprintingOnActivation = skillDefInfo.cancelSprintingOnActivation; ((SkillDef)val).rechargeStock = skillDefInfo.rechargeStock; ((SkillDef)val).requiredStock = skillDefInfo.requiredStock; ((SkillDef)val).stockToConsume = skillDefInfo.stockToConsume; ((SkillDef)val).keywordTokens = skillDefInfo.keywordTokens; Content.AddSkillDef((SkillDef)(object)val); return val; } } internal class SkillDefInfo { public string skillName; public string skillNameToken; public string skillDescriptionToken; public string[] keywordTokens = new string[0]; public Sprite skillIcon; public SerializableEntityStateType activationState; public InterruptPriority interruptPriority; public string activationStateMachineName; public float baseRechargeInterval; public int baseMaxStock = 1; public int rechargeStock = 1; public int requiredStock = 1; public int stockToConsume = 1; public bool isCombatSkill = true; public bool canceledFromSprinting; public bool forceSprintDuringState; public bool cancelSprintingOnActivation = true; public bool beginSkillCooldownOnSkillEnd; public bool fullRestockOnAssign = true; public bool resetCooldownTimerOnUse; public bool mustKeyPress; public SkillDefInfo() { } public SkillDefInfo(string skillNameToken, string skillDescriptionToken, Sprite skillIcon, SerializableEntityStateType activationState, string activationStateMachineName = "Weapon", bool agile = false) { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) skillName = skillNameToken; this.skillNameToken = skillNameToken; this.skillDescriptionToken = skillDescriptionToken; this.skillIcon = skillIcon; this.activationState = activationState; this.activationStateMachineName = activationStateMachineName; interruptPriority = (InterruptPriority)0; isCombatSkill = true; baseRechargeInterval = 0f; requiredStock = 0; stockToConsume = 0; cancelSprintingOnActivation = !agile; if (agile) { keywordTokens = new string[1] { "KEYWORD_AGILE" }; } } } internal static class Skins { internal struct SkinDefInfo { internal SkinDef[] BaseSkins; internal Sprite Icon; internal string NameToken; internal UnlockableDef UnlockableDef; internal GameObject RootObject; internal RendererInfo[] RendererInfos; internal MeshReplacement[] MeshReplacements; internal GameObjectActivation[] GameObjectActivations; internal ProjectileGhostReplacement[] ProjectileGhostReplacements; internal MinionSkinReplacement[] MinionSkinReplacements; internal string Name; } internal static SkinDef CreateSkinDef(string skinName, Sprite skinIcon, RendererInfo[] defaultRendererInfos, GameObject root, UnlockableDef unlockableDef = null) { //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Expected O, but got Unknown //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Expected O, but got Unknown SkinDefInfo skinDefInfo = default(SkinDefInfo); skinDefInfo.BaseSkins = Array.Empty<SkinDef>(); skinDefInfo.GameObjectActivations = (GameObjectActivation[])(object)new GameObjectActivation[0]; skinDefInfo.Icon = skinIcon; skinDefInfo.MeshReplacements = (MeshReplacement[])(object)new MeshReplacement[0]; skinDefInfo.MinionSkinReplacements = (MinionSkinReplacement[])(object)new MinionSkinReplacement[0]; skinDefInfo.Name = skinName; skinDefInfo.NameToken = skinName; skinDefInfo.ProjectileGhostReplacements = (ProjectileGhostReplacement[])(object)new ProjectileGhostReplacement[0]; skinDefInfo.RendererInfos = (RendererInfo[])(object)new RendererInfo[defaultRendererInfos.Length]; skinDefInfo.RootObject = root; skinDefInfo.UnlockableDef = unlockableDef; SkinDefInfo skinDefInfo2 = skinDefInfo; SkinDef.Awake += new hook_Awake(DoNothing); SkinDef val = ScriptableObject.CreateInstance<SkinDef>(); val.baseSkins = skinDefInfo2.BaseSkins; val.icon = skinDefInfo2.Icon; val.unlockableDef = skinDefInfo2.UnlockableDef; val.rootObject = skinDefInfo2.RootObject; defaultRendererInfos.CopyTo(skinDefInfo2.RendererInfos, 0); val.rendererInfos = skinDefInfo2.RendererInfos; val.gameObjectActivations = skinDefInfo2.GameObjectActivations; val.meshReplacements = skinDefInfo2.MeshReplacements; val.projectileGhostReplacements = skinDefInfo2.ProjectileGhostReplacements; val.minionSkinReplacements = skinDefInfo2.MinionSkinReplacements; val.nameToken = skinDefInfo2.NameToken; ((Object)val).name = skinDefInfo2.Name; SkinDef.Awake -= new hook_Awake(DoNothing); return val; } private static void DoNothing(orig_Awake orig, SkinDef self) { } private static RendererInfo[] getRendererMaterials(RendererInfo[] defaultRenderers, params Material[] materials) { RendererInfo[] array = (RendererInfo[])(object)new RendererInfo[defaultRenderers.Length]; defaultRenderers.CopyTo(array, 0); for (int i = 0; i < array.Length; i++) { try { array[i].defaultMaterial = materials[i]; } catch { Log.Error("error adding skin rendererinfo material. make sure you're not passing in too many"); } } return array; } internal static MeshReplacement[] getMeshReplacements(RendererInfo[] defaultRendererInfos, params string[] meshes) { //IL_001d: 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) List<MeshReplacement> list = new List<MeshReplacement>(); for (int i = 0; i < defaultRendererInfos.Length; i++) { if (!string.IsNullOrEmpty(meshes[i])) { list.Add(new MeshReplacement { renderer = defaultRendererInfos[i].renderer, mesh = Assets.mainAssetBundle.LoadAsset<Mesh>(meshes[i]) }); } } return list.ToArray(); } } public static class States { internal static void RegisterStates() { Content.AddEntityState(typeof(BaseMeleeAttack)); Content.AddEntityState(typeof(BatonAttack)); Content.AddEntityState(typeof(Shoot)); Content.AddEntityState(typeof(Roll)); Content.AddEntityState(typeof(ThrowBomb)); } } internal static class StaticValues { internal const float baseDamageCoefficient = 3f; internal const float burstDamageCoefficient = 1f; internal const float batonDamageCoefficient = 5f; internal const float kickDamageCoefficient = 12f; internal const float grenadeDamageCoefficient = 8f; } internal static class Tokens { internal static void AddTokens() { string text = "MANTI_CONSCRIPT_BODY_"; string text2 = "Conscript is a versatile and heavy-hitting mid-range survivor.<color=#c300ff>" + Environment.NewLine + Environment.NewLine; text2 = text2 + "< ! > Your R76 Rifle is a consistant source of damage at mid-range." + Environment.NewLine + Environment.NewLine; text2 = text2 + "< ! > The Baton can be used to stun enemies which get too close." + Environment.NewLine + Environment.NewLine; text2 = text2 + "< ! > Kick nearby enemies to make some distance." + Environment.NewLine + Environment.NewLine; text2 = text2 + "< ! > Electric Grenades are a great way to damage and stun large crowds of enemies." + Environment.NewLine + Environment.NewLine; string text3 = "..and so he left, another mission complete."; string text4 = "..and so he vanished, another casuality of war."; LanguageAPI.Add(text + "NAME", "Conscript"); LanguageAPI.Add(text + "DESCRIPTION", text2); LanguageAPI.Add(text + "SUBTITLE", "The Maniacal Soldier"); string text5 = "Armed with an R79 Rifle in his hands, he charged directly towards the battlefield with little to no sense of self-preservation. Upon seeing the enemy, he'd aim and pull the trigger, bringing down foe after foe who were unfortunate enough to not get out of the way of the blast. The soldier by many others was seen as patriotic and willing to do anything and everything for their colony. In fact, he was even put on several posters and seen as a war hero despite him being a conscripted unit. Of course, the Military knew that he wasn't a patriot, nor a war hero. He knew that they were a deranged soldier who was much to eager to enter the battlefield and follow orders because he enjoyed the thrill of killing. At first, this wasn't a problem given that he was fighting a war at the time, and a loyal soldier was necessary.But when the fighting was near its end, they feared what he would do when there is no one left for him to fight. Then one day, the Military had gotten word that a Free Company had just opened up and were looking for members to join them.They saw this as an opportunity."; text5 = text5 + Environment.NewLine + Environment.NewLine + "--- YOU HAVE BEEN REASSIGNED.REPORT TO COMMAND FOR YOUR NEW ASSIGNMENT.---" + Environment.NewLine + Environment.NewLine; text5 += "When the message was recieved, the soldier asked no questions nor made no comment.He got his reassignment then gathered his belongings.made his way to the transport.He knew that the war he used to fight would end.Being a part of the Free Company of course meant that he was able to continue the thrills that he felt being on the battlefield. The mission that came in from the UES Safe Travels was just another mission to complete."; LanguageAPI.Add(text + "LORE", text5); LanguageAPI.Add(text + "OUTRO_FLAVOR", text3); LanguageAPI.Add(text + "OUTRO_FAILURE", text4); LanguageAPI.Add(text + "DEFAULT_SKIN_NAME", "Default"); LanguageAPI.Add(text + "MASTERY_SKIN_NAME", "Marine"); LanguageAPI.Add(text + "PASSIVE_NAME", "Reactive Vitality System"); LanguageAPI.Add(text + "PASSIVE_DESCRIPTION", "Healing recharges Shield."); LanguageAPI.Add(text + "PRIMARY_RIFLE_NAME", "R76 - Focus Fire Configured"); LanguageAPI.Add(text + "PRIMARY_RIFLE_DESCRIPTION", $"Fire a Piercing shot for <style=cIsDamage>{300f}% damage</style>."); LanguageAPI.Add(text + "PRIMARY_ALT_RIFLE_NAME", "R76 - Burst Fire Configured"); LanguageAPI.Add(text + "PRIMARY_ALT_RIFLE_DESCRIPTION", $"Fire a burst of shots for <style=cIsDamage>10x{100f}% damage</style>."); LanguageAPI.Add(text + "SECONDARY_BATON_NAME", "Electric Baton"); LanguageAPI.Add(text + "SECONDARY_BATON_DESCRIPTION", $"<style=cIsUtility>Stunning</style>. Lunge and swing your Baton for <style=cIsDamage>{500f}% damage</style>."); LanguageAPI.Add(text + "UTILITY_KICK_NAME", "Defensive Kick"); LanguageAPI.Add(text + "UTILITY_KICK_DESCRIPTION", $"Kick enemies in front of you, knocking them back and dealing <style=cIsDamage>{1200f}% damage</style>."); LanguageAPI.Add(text + "SPECIAL_GRENADE_NAME", "Electric Grenade"); LanguageAPI.Add(text + "SPECIAL_GRENADE_DESCRIPTION", $"<style=cIsUtility>Stunning</style>. Throw an Electric Grenade which deals <style=cIsDamage>{800f}% damage</style>. Can hold up to 2."); LanguageAPI.Add(text + "MASTERYUNLOCKABLE_ACHIEVEMENT_NAME", "Conscript: Mastery"); LanguageAPI.Add(text + "MASTERYUNLOCKABLE_ACHIEVEMENT_DESC", "As Conscript, beat the game or obliterate on Monsoon."); LanguageAPI.Add(text + "MASTERYUNLOCKABLE_UNLOCKABLE_NAME", "Conscript: Mastery"); } } public abstract class BaseMasteryUnlockable : GenericModdedUnlockable { public abstract string RequiredCharacterBody { get; } public abstract float RequiredDifficultyCoefficient { get; } public override void OnBodyRequirementMet() { ((ModdedUnlockable)this).OnBodyRequirementMet(); Run.onClientGameOverGlobal += OnClientGameOverGlobal; } public override void OnBodyRequirementBroken() { Run.onClientGameOverGlobal -= OnClientGameOverGlobal; ((ModdedUnlockable)this).OnBodyRequirementBroken(); } private void OnClientGameOverGlobal(Run run, RunReport runReport) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Invalid comparison between Unknown and I4 //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Invalid comparison between Unknown and I4 if (Object.op_Implicit((Object)(object)runReport.gameEnding) && runReport.gameEnding.isWin) { DifficultyIndex val = runReport.ruleBook.FindDifficulty(); DifficultyDef difficultyDef = DifficultyCatalog.GetDifficultyDef(runReport.ruleBook.FindDifficulty()); if ((difficultyDef.countsAsHardMode && difficultyDef.scalingValue >= RequiredDifficultyCoefficient) || ((int)val >= 3 && (int)val <= 10) || difficultyDef.nameToken == "INFERNO_NAME") { ((BaseAchievement)this).Grant(); } } } public override BodyIndex LookUpRequiredBodyIndex() { //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 BodyCatalog.FindBodyIndex(RequiredCharacterBody); } } public abstract class GenericModdedUnlockable : ModdedUnlockable { public abstract string AchievementTokenPrefix { get; } public abstract string AchievementSpriteName { get; } public override string AchievementIdentifier => AchievementTokenPrefix + "UNLOCKABLE_ACHIEVEMENT_ID"; public override string UnlockableIdentifier => AchievementTokenPrefix + "UNLOCKABLE_REWARD_ID"; public override string AchievementNameToken => AchievementTokenPrefix + "UNLOCKABLE_ACHIEVEMENT_NAME"; public override string AchievementDescToken => AchievementTokenPrefix + "UNLOCKABLE_ACHIEVEMENT_DESC"; public override string UnlockableNameToken => AchievementTokenPrefix + "UNLOCKABLE_UNLOCKABLE_NAME"; public override Sprite Sprite => Assets.mainAssetBundle.LoadAsset<Sprite>(AchievementSpriteName); public override Func<string> GetHowToUnlock => () => Language.GetStringFormatted("UNLOCK_VIA_ACHIEVEMENT_FORMAT", new object[2] { Language.GetString(((ModdedUnlockable)this).AchievementNameToken), Language.GetString(((ModdedUnlockable)this).AchievementDescToken) }); public override Func<string> GetUnlocked => () => Language.GetStringFormatted("UNLOCKED_FORMAT", new object[2] { Language.GetString(((ModdedUnlockable)this).AchievementNameToken), Language.GetString(((ModdedUnlockable)this).AchievementDescToken) }); } } namespace ConscriptMod.Modules.Survivors { internal class MyCharacter : SurvivorBase { public const string CONSCRIPT_PREFIX = "MANTI_CONSCRIPT_BODY_"; private static UnlockableDef masterySkinUnlockableDef; public override string prefabBodyName => "Conscript"; public override string survivorTokenPrefix => "MANTI_CONSCRIPT_BODY_"; public override BodyInfo bodyInfo { get; set; } = new BodyInfo {