Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of YoungVagrant v4.0.0
YoungVagrant.dll
Decompiled 21 hours agousing System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using EntityStates; using EntityStates.JellyfishMonster; using EntityStates.VagrantMonster; using EntityStates.VagrantMonster.Weapon; using R2API; using RoR2; using RoR2.Navigation; using RoR2.Skills; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("YoungVagrant")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("YoungVagrant")] [assembly: AssemblyTitle("YoungVagrant")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace YoungVagrant; [BepInPlugin("com.rob.YoungVagrant", "YoungVagrant", "4.0.0")] public class Plugin : BaseUnityPlugin { public const string MODUID = "com.rob.YoungVagrant"; public static AssetBundle mainAssetBundle; public static GameObject bodyPrefab; public static GameObject masterPrefab; public static CharacterSpawnCard spawnCard; public static List<StageSpawnInfo> StageList = new List<StageSpawnInfo>(); private void Awake() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: 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_0125: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_037e: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Unknown result type (might be due to invalid IL or missing references) //IL_03ca: Unknown result type (might be due to invalid IL or missing references) //IL_03cf: Unknown result type (might be due to invalid IL or missing references) //IL_03eb: Unknown result type (might be due to invalid IL or missing references) //IL_03f0: Unknown result type (might be due to invalid IL or missing references) //IL_041d: Unknown result type (might be due to invalid IL or missing references) //IL_043d: Unknown result type (might be due to invalid IL or missing references) //IL_043f: Unknown result type (might be due to invalid IL or missing references) //IL_0497: Unknown result type (might be due to invalid IL or missing references) //IL_049c: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: 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_05ec: Unknown result type (might be due to invalid IL or missing references) //IL_05f4: Unknown result type (might be due to invalid IL or missing references) //IL_05fc: Unknown result type (might be due to invalid IL or missing references) //IL_0604: Unknown result type (might be due to invalid IL or missing references) //IL_061f: Unknown result type (might be due to invalid IL or missing references) //IL_0629: Expected O, but got Unknown //IL_063a: Unknown result type (might be due to invalid IL or missing references) //IL_063f: Unknown result type (might be due to invalid IL or missing references) //IL_0647: Unknown result type (might be due to invalid IL or missing references) //IL_064e: Unknown result type (might be due to invalid IL or missing references) //IL_0655: Unknown result type (might be due to invalid IL or missing references) //IL_065c: Unknown result type (might be due to invalid IL or missing references) //IL_065e: Unknown result type (might be due to invalid IL or missing references) //IL_0665: Expected O, but got Unknown //IL_0665: Unknown result type (might be due to invalid IL or missing references) //IL_066a: Unknown result type (might be due to invalid IL or missing references) //IL_0672: Unknown result type (might be due to invalid IL or missing references) //IL_0674: Unknown result type (might be due to invalid IL or missing references) //IL_067b: Expected O, but got Unknown //IL_067b: Unknown result type (might be due to invalid IL or missing references) //IL_0680: Unknown result type (might be due to invalid IL or missing references) //IL_0688: Unknown result type (might be due to invalid IL or missing references) //IL_068f: Unknown result type (might be due to invalid IL or missing references) //IL_0696: Unknown result type (might be due to invalid IL or missing references) //IL_069d: Unknown result type (might be due to invalid IL or missing references) //IL_069f: Unknown result type (might be due to invalid IL or missing references) //IL_06a6: Expected O, but got Unknown //IL_06a6: Unknown result type (might be due to invalid IL or missing references) //IL_06ab: Unknown result type (might be due to invalid IL or missing references) //IL_06b3: Unknown result type (might be due to invalid IL or missing references) //IL_06b5: Unknown result type (might be due to invalid IL or missing references) //IL_06bc: Expected O, but got Unknown //IL_06c1: Unknown result type (might be due to invalid IL or missing references) //IL_06c6: Unknown result type (might be due to invalid IL or missing references) //IL_0591: Unknown result type (might be due to invalid IL or missing references) //IL_0755: Unknown result type (might be due to invalid IL or missing references) //IL_075a: Unknown result type (might be due to invalid IL or missing references) //IL_071b: Unknown result type (might be due to invalid IL or missing references) using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("YoungVagrant.youngvagrant")) { mainAssetBundle = AssetBundle.LoadFromStream(stream); } bool flag = default(bool); ContentAddition.AddEntityState(typeof(SpawnState), ref flag); bool flag2 = default(bool); ContentAddition.AddEntityState(typeof(DeathState), ref flag2); bool flag3 = default(bool); ContentAddition.AddEntityState(typeof(ChargeBarrage), ref flag3); bodyPrefab = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Vagrant/VagrantBody.prefab").WaitForCompletion(), "RobYoungVagrantBody", true); CharacterBody component = bodyPrefab.GetComponent<CharacterBody>(); component.portraitIcon = mainAssetBundle.LoadAsset<Texture>("texYoungVagrantIcon"); component.baseMoveSpeed = 10f; component.baseMaxHealth = 750f; component.levelMaxHealth = 225f; component.baseDamage = 4.5f; component.levelDamage = 0.9375f; component.baseAcceleration = 20f; component.preferredInitialStateType = new SerializableEntityStateType(typeof(SpawnState)); component.hullClassification = (HullClassification)0; component.isChampion = false; component.baseNameToken = "YOUNGVAGRANT_BODY_NAME"; component.subtitleNameToken = ""; component.bodyFlags = (BodyFlags)0; SetStateOnHurt val = bodyPrefab.AddComponent<SetStateOnHurt>(); val.canBeFrozen = true; val.canBeHitStunned = true; val.canBeStunned = true; val.hitThreshold = 0.1f; EntityStateMachine[] components = bodyPrefab.GetComponents<EntityStateMachine>(); foreach (EntityStateMachine val2 in components) { if (Object.op_Implicit((Object)(object)val2) && val2.customName == "Body") { val2.initialStateType = new SerializableEntityStateType(typeof(SpawnState)); val.targetStateMachine = val2; } else { val.idleStateMachine = (EntityStateMachine[])(object)new EntityStateMachine[1] { val2 }; } } UnlockableDef val3 = Object.Instantiate<UnlockableDef>(Addressables.LoadAssetAsync<UnlockableDef>((object)"RoR2/Base/Jellyfish/Logs.JellyfishBody.0.asset").WaitForCompletion()); val3.cachedName = "Logs.YoungVagrantBody.0"; val3.nameToken = "UNLOCKABLE_LOG_YOUNGVAGRANT"; ContentAddition.AddUnlockableDef(val3); LanguageAPI.Add("YOUNGVAGRANT_BODY_NAME", "Young Vagrant"); LanguageAPI.Add("UNLOCKABLE_LOG_YOUNGVAGRANT", ""); bodyPrefab.GetComponent<DeathRewards>().logUnlockableDef = val3; bodyPrefab.GetComponent<CameraTargetParams>().cameraParams = Addressables.LoadAssetAsync<CharacterCameraParams>((object)"RoR2/Base/Common/ccpStandard.asset").WaitForCompletion(); CapsuleCollider component2 = bodyPrefab.GetComponent<CapsuleCollider>(); component2.radius = 2f; component2.height = 5f; bodyPrefab.transform.Find("Model Base").localScale = Vector3.one * 1.15f; bodyPrefab.transform.Find("Model Base").rotation = Quaternion.Euler(new Vector3(0f, 0f, 180f)); ((Component)bodyPrefab.transform.Find("Model Base/mdlVagrant/BaseEffects/Point light")).GetComponent<Light>().range = 10f; ((Component)bodyPrefab.transform.Find("Model Base/mdlVagrant/VagrantArmature/DetatchedHull/Tentacle1.001")).gameObject.AddComponent<YoungVagrantTentacle>(); ((Component)bodyPrefab.transform.Find("Model Base/mdlVagrant/VagrantArmature/DetatchedHull/Tentacle2.001")).gameObject.AddComponent<YoungVagrantTentacle>(); ((Component)bodyPrefab.transform.Find("Model Base/mdlVagrant/VagrantArmature/DetatchedHull/Tentacle3.001")).gameObject.AddComponent<YoungVagrantTentacle>(); ((Component)component).GetComponent<CharacterDeathBehavior>().deathState = new SerializableEntityStateType(typeof(DeathState)); GenericSkill[] components2 = bodyPrefab.GetComponents<GenericSkill>(); foreach (GenericSkill val4 in components2) { Object.Destroy((Object)(object)val4); } GenericSkill val5 = bodyPrefab.AddComponent<GenericSkill>(); SkillDef val6 = Object.Instantiate<SkillDef>(Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/Vagrant/VagrantBodyJellyBarrage.asset").WaitForCompletion()); val6.activationState = new SerializableEntityStateType(typeof(ChargeBarrage)); val6.baseRechargeInterval = 12f; SkillFamily val7 = ScriptableObject.CreateInstance<SkillFamily>(); val7.catalogIndex = 0; Variant[] array = new Variant[1]; Variant val8 = new Variant { skillDef = val6, unlockableDef = null }; ((Variant)(ref val8)).viewableNode = null; array[0] = val8; val7.variants = (Variant[])(object)array; val5._skillFamily = val7; val5.skillName = "Barrage"; val5.hideInCharacterSelect = false; bodyPrefab.GetComponent<SkillLocator>().primary = val5; ContentAddition.AddSkillDef(val6); ContentAddition.AddSkillFamily(val7); ContentAddition.AddBody(bodyPrefab); masterPrefab = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/GreaterWisp/GreaterWispMaster.prefab").WaitForCompletion(), "RobYoungVagrantMaster", true); CharacterMaster component3 = masterPrefab.GetComponent<CharacterMaster>(); component3.bodyPrefab = bodyPrefab; ContentAddition.AddMaster(masterPrefab); string value = ((BaseUnityPlugin)this).Config.Bind<string>("Young Vagrant", "Stage List", "blackbeach, blackbeach2, golemplains, golemplains2, foggyswamp, shipgraveyard, rootjungle, artifactworld, itdampcave, itgolemplains, arena", "What stages the monster will show up on. Add a '- loop' after the stagename to make it only spawn after looping. List of stage names can be found at https://github.com/risk-of-thunder/R2Wiki/wiki/Mod-Creation_Developer-Reference_Scene-Names").Value; value = new string((from c in value.ToCharArray() where !char.IsWhiteSpace(c) select c).ToArray()); string[] array2 = value.Split(','); string[] array3 = array2; foreach (string text in array3) { string[] array4 = text.Split('-'); string text2 = array4[0]; int minStages = 0; if (array4.Length > 1) { minStages = 5; } SceneDef val9 = ScriptableObject.CreateInstance<SceneDef>(); val9.baseSceneNameOverride = text2; Helpers.RemoveExistingMonsterFromStage(MonsterNames.GreaterWisp, DirectorAPI.GetStageEnumFromSceneDef(val9), text2); StageList.Add(new StageSpawnInfo(text2, minStages)); } CharacterSpawnCard val10 = ScriptableObject.CreateInstance<CharacterSpawnCard>(); ((Object)val10).name = "cscRobYoungVagrant"; ((SpawnCard)val10).prefab = masterPrefab; ((SpawnCard)val10).sendOverNetwork = true; ((SpawnCard)val10).hullSize = (HullClassification)0; ((SpawnCard)val10).nodeGraphType = (GraphType)1; ((SpawnCard)val10).requiredFlags = (NodeFlags)0; ((SpawnCard)val10).forbiddenFlags = (NodeFlags)0; ((SpawnCard)val10).directorCreditCost = 200; ((SpawnCard)val10).occupyPosition = false; val10.loadout = new SerializableLoadout(); val10.noElites = false; val10.forbiddenAsBoss = false; DirectorCard val11 = new DirectorCard { spawnCard = (SpawnCard)(object)val10, selectionWeight = 1, preventOverhead = false, minimumStageCompletions = 0, spawnDistance = (MonsterSpawnDistance)0 }; DirectorCardHolder val12 = new DirectorCardHolder { Card = val11, MonsterCategory = (MonsterCategory)3 }; DirectorCard card = new DirectorCard { spawnCard = (SpawnCard)(object)val10, selectionWeight = 1, preventOverhead = false, minimumStageCompletions = 5, spawnDistance = (MonsterSpawnDistance)1 }; DirectorCardHolder val13 = new DirectorCardHolder { Card = card, MonsterCategory = (MonsterCategory)3 }; DirectorCardCategorySelection val14 = Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/Base/MixEnemy/dccsMixEnemy.asset").WaitForCompletion(); val14.AddCard(FindCategoryIndexByName(val14, "Minibosses"), val11); foreach (StageSpawnInfo stage in StageList) { DirectorCardHolder val15 = ((stage.GetMinStages() == 0) ? val12 : val13); Helpers.AddNewMonsterToStage(val15, false, DirectorAPI.ParseInternalStageName(stage.GetStageName()), stage.GetStageName()); } AddMonsterToCardCategory(val11, "Minibosses", (DirectorCardCategorySelection)(object)Addressables.LoadAssetAsync<FamilyDirectorCardCategorySelection>((object)"RoR2/Base/Common/dccsJellyfishFamily.asset").WaitForCompletion()); } private void AddMonsterToCardCategory(DirectorCard card, string categoryName, DirectorCardCategorySelection stageCard) { int num = FindCategoryIndexByName(stageCard, categoryName); if (num >= 0) { stageCard.AddCard(num, card); } } public static int FindCategoryIndexByName(DirectorCardCategorySelection dcs, string categoryName) { for (int i = 0; i < dcs.categories.Length; i++) { if (string.CompareOrdinal(dcs.categories[i].name, categoryName) == 0) { return i; } } return -1; } } public class StageSpawnInfo { private string stageName; private int minStages; public StageSpawnInfo(string stageName, int minStages) { this.stageName = stageName; this.minStages = minStages; } public string GetStageName() { return stageName; } public int GetMinStages() { return minStages; } } public class SpawnState : BaseState { public override void OnEnter() { ((BaseState)this).OnEnter(); ((EntityState)this).PlayAnimation("Body", "Spawn", "Spawn.playbackRate", 2f, 0f); Util.PlaySound(SpawnState.spawnSoundString, ((EntityState)this).gameObject); } public override void FixedUpdate() { ((EntityState)this).FixedUpdate(); if (((EntityState)this).fixedAge >= 2f && ((EntityState)this).isAuthority) { ((EntityState)this).outer.SetNextStateToMain(); } } public override InterruptPriority GetMinimumInterruptPriority() { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) return (InterruptPriority)9; } } public class DeathState : GenericCharacterDeath { public override void OnEnter() { ((GenericCharacterDeath)this).OnEnter(); ((GenericCharacterDeath)this).DestroyModel(); if (NetworkServer.active) { ((GenericCharacterDeath)this).DestroyBodyAsapServer(); } } public override void CreateDeathEffects() { //IL_0021: 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) ((GenericCharacterDeath)this).CreateDeathEffects(); if (Object.op_Implicit((Object)(object)DeathState.enterEffectPrefab)) { EffectManager.SimpleEffect(DeathState.enterEffectPrefab, ((EntityState)this).transform.position, ((EntityState)this).transform.rotation, false); } } public override InterruptPriority GetMinimumInterruptPriority() { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) return (InterruptPriority)9; } } public class ChargeBarrage : BaseState { private float duration; private float stopwatch; private GameObject chargeEffectInstance; private uint soundID; public override void OnEnter() { //IL_00bb: 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) ((BaseState)this).OnEnter(); stopwatch = 0f; duration = 0.75f / base.attackSpeedStat; Transform modelTransform = ((EntityState)this).GetModelTransform(); ((EntityState)this).PlayCrossfade("Gesture, Override", "ChargeTrackingBomb", "ChargeTrackingBomb.playbackRate", duration, 0.3f); soundID = Util.PlayAttackSpeedSound(ChargeTrackingBomb.chargingSoundString, ((EntityState)this).gameObject, base.attackSpeedStat); if (Object.op_Implicit((Object)(object)modelTransform)) { ChildLocator component = ((Component)modelTransform).GetComponent<ChildLocator>(); if (Object.op_Implicit((Object)(object)component)) { Transform val = component.FindChild("TrackingBombMuzzle"); if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)ChargeTrackingBomb.chargingEffectPrefab)) { chargeEffectInstance = Object.Instantiate<GameObject>(ChargeTrackingBomb.chargingEffectPrefab, val.position, val.rotation); chargeEffectInstance.transform.parent = val; chargeEffectInstance.GetComponent<ScaleParticleSystemDuration>().newDuration = duration; } } } if (NetworkServer.active) { ((EntityState)this).characterBody.AddTimedBuff(Buffs.Slow50, duration); } } public override void OnExit() { ((EntityState)this).OnExit(); AkSoundEngine.StopPlayingID(soundID); if (Object.op_Implicit((Object)(object)chargeEffectInstance)) { Object.Destroy((Object)(object)chargeEffectInstance, 0.75f); } } public override void FixedUpdate() { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown ((EntityState)this).FixedUpdate(); stopwatch += Time.fixedDeltaTime; if (stopwatch >= duration) { ((EntityState)this).PlayAnimation("Gesture, Override", "FireTrackingBomb", "FireTrackingBomb.playbackRate", FireTrackingBomb.baseDuration, 0f); EffectManager.SimpleMuzzleFlash(FireTrackingBomb.muzzleEffectPrefab, ((EntityState)this).gameObject, "TrackingBombMuzzle", false); if (((EntityState)this).isAuthority) { ((EntityState)this).outer.SetNextState((EntityState)new JellyBarrage()); } } } 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)3; } } public class YoungVagrantTentacle : MonoBehaviour { private void LateUpdate() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) ((Component)this).transform.localScale = new Vector3(1f, 1.5f, 1f); } }