Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of Artifact of the King v1.2.5
plugins/viliger-ArtifactofTheKing/ArtifactofTheKing.dll
Decompiled 2 weeks agousing System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using EntityStates; using EntityStates.BrotherMonster; using EntityStates.BrotherMonster.Weapon; using JetBrains.Annotations; using On.EntityStates.BrotherMonster; using On.EntityStates.BrotherMonster.Weapon; using On.RoR2; using R2API; using RoR2; using RoR2.Projectile; using RoR2.Skills; using RoR2BepInExPack.GameAssetPathsBetter; using UnityEngine; using UnityEngine.AddressableAssets; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("ArtifactofTheKing")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("ArtifactofTheKing")] [assembly: AssemblyTitle("ArtifactofTheKing")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace ArtifactofTheKing; [BepInPlugin("com.Blobface.ArtifactKing", "Artifact of the King", "1.2.5")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class ArtifactOfTheKing : BaseUnityPlugin { public const string Author = "Original by Blobface, ported to SoTS by viliger"; public const string ModName = "Artifact of the King"; public const string Version = "1.2.5"; public const string GUID = "com.Blobface.ArtifactKing"; public static ArtifactDef King; private static GameObject Mithrix; private static GameObject BrotherGlassBody; private static bool hasFiredWeaponSlam; private static bool hasFiredSkyLeapFirst; private static bool hasFiredSkyLeapSecond; private static bool isEnabled; private void Awake() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Expected O, but got Unknown //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Expected O, but got Unknown KingConfiguration.PopulateConfig(((BaseUnityPlugin)this).Config); AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "assetbundles", "artifactoftheking")); Mithrix = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Brother/BrotherBody.prefab").WaitForCompletion(); King = ScriptableObject.CreateInstance<ArtifactDef>(); ((Object)King).name = "ArtifactOfKing_Blobface"; King.nameToken = "ARTIFACT_OF_THE_KING_NAME"; King.descriptionToken = "ARTIFACT_OF_THE_KING_DESCRIPTION"; King.smallIconSelectedSprite = val.LoadAsset<Sprite>("Assets/ArtifactOfTheKing/headon.png"); King.smallIconDeselectedSprite = val.LoadAsset<Sprite>("Assets/ArtifactOfTheKing/headoff.png"); ContentAddition.AddArtifactDef(King); Language.collectLanguageRootFolders += Language_collectLanguageRootFolders; RunArtifactManager.onArtifactEnabledGlobal += new ArtifactStateChangeDelegate(RunArtifactManager_onArtifactEnabledGlobal); RunArtifactManager.onArtifactDisabledGlobal += new ArtifactStateChangeDelegate(RunArtifactManager_onArtifactDisabledGlobal); ModifyBrotherGlass(); } private void ModifyBrotherGlass() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) BrotherGlassBody = Addressables.LoadAssetAsync<GameObject>((object)RoR2_Junk_BrotherGlass.BrotherGlassBody_prefab).WaitForCompletion(); Transform val = BrotherGlassBody.transform.Find("ModelBase/mdlBrother"); GameObject val2 = Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_Brother.mdlBrother_fbx).WaitForCompletion(); if (Object.op_Implicit((Object)(object)val)) { ModelSkinController val3 = default(ModelSkinController); if (((Component)val).TryGetComponent<ModelSkinController>(ref val3)) { Object.DestroyImmediate((Object)(object)val3); } Animator val4 = default(Animator); if (((Component)val).TryGetComponent<Animator>(ref val4)) { val4.runtimeAnimatorController = Addressables.LoadAssetAsync<RuntimeAnimatorController>((object)RoR2_Base_Brother.animBrother_controller).WaitForCompletion(); val4.avatar = val2.GetComponent<Animator>().avatar; } } Transform val5 = BrotherGlassBody.transform.Find("ModelBase/mdlBrother/BrotherArmature/ROOT/base/stomach/chest/neck/head/eyeball/BrotherEye"); if (Object.op_Implicit((Object)(object)val5)) { ((Component)val5).GetComponent<MeshFilter>().mesh = ((Component)val2.transform.Find("BrotherArmature/ROOT/base/stomach/chest/neck/head/eyeball/BrotherEye")).GetComponent<MeshFilter>().mesh; ((Renderer)((Component)val5).GetComponent<MeshRenderer>()).material = Addressables.LoadAssetAsync<Material>((object)RoR2_Base_Brother.matBrotherEye_mat).WaitForCompletion(); } Transform val6 = BrotherGlassBody.transform.Find("ModelBase/mdlBrother/BrotherBodyMesh"); if (Object.op_Implicit((Object)(object)val6)) { ((Component)val6).GetComponent<SkinnedMeshRenderer>().sharedMesh = ((Component)val2.transform.Find("BrotherBodyMesh")).GetComponent<SkinnedMeshRenderer>().sharedMesh; } Transform val7 = BrotherGlassBody.transform.Find("ModelBase/mdlBrother/BrotherHammerConcrete"); if (Object.op_Implicit((Object)(object)val7)) { ((Component)val7).GetComponent<SkinnedMeshRenderer>().sharedMesh = ((Component)val2.transform.Find("BrotherHammerConcrete")).GetComponent<SkinnedMeshRenderer>().sharedMesh; } Transform val8 = BrotherGlassBody.transform.Find("ModelBase/mdlBrother/BrotherHammerConcrete/BrotherHammerStib"); if (Object.op_Implicit((Object)(object)val8)) { SkinnedMeshRenderer component = ((Component)val8).GetComponent<SkinnedMeshRenderer>(); component.sharedMesh = ((Component)val2.transform.Find("BrotherHammerConcrete/BrotherHammerStib")).GetComponent<SkinnedMeshRenderer>().sharedMesh; ((Renderer)component).material = Addressables.LoadAssetAsync<Material>((object)RoR2_Base_Brother.matBrotherStib_mat).WaitForCompletion(); } Transform val9 = BrotherGlassBody.transform.Find("ModelBase/mdlBrother/BrotherStibPieces"); if (Object.op_Implicit((Object)(object)val9)) { SkinnedMeshRenderer component2 = ((Component)val9).GetComponent<SkinnedMeshRenderer>(); component2.sharedMesh = ((Component)val2.transform.Find("BrotherStibPieces")).GetComponent<SkinnedMeshRenderer>().sharedMesh; ((Renderer)component2).material = Addressables.LoadAssetAsync<Material>((object)RoR2_Base_Brother.matBrotherStib_mat).WaitForCompletion(); } } private void RunArtifactManager_onArtifactEnabledGlobal([NotNull] RunArtifactManager runArtifactManager, [NotNull] ArtifactDef artifactDef) { if ((Object)(object)artifactDef == (Object)(object)King && !isEnabled) { isEnabled = true; ((BaseUnityPlugin)this).Logger.LogMessage((object)"Initializing modded stats"); AddHooks(); AdjustSkills(); AdjustStats(); } } private void RunArtifactManager_onArtifactDisabledGlobal([NotNull] RunArtifactManager runArtifactManager, [NotNull] ArtifactDef artifactDef) { if ((Object)(object)artifactDef == (Object)(object)King && isEnabled) { isEnabled = false; ((BaseUnityPlugin)this).Logger.LogMessage((object)"Reverting to vanilla stats"); RemoveHooks(); RevertSkills(); RevertStats(); } } private void AddHooks() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Expected O, but got Unknown //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Expected O, but got Unknown HealthComponent.ServerFixedUpdate += new hook_ServerFixedUpdate(HealthComponent_ServerFixedUpdate); HealthComponent.TakeDamage += new hook_TakeDamage(HealthComponent_TakeDamage); SlideIntroState.OnEnter += new hook_OnEnter(SlideIntroState_OnEnter); SprintBash.OnEnter += new hook_OnEnter(SprintBash_OnEnter); WeaponSlam.OnEnter += new hook_OnEnter(WeaponSlam_OnEnter); WeaponSlam.FixedUpdate += new hook_FixedUpdate(WeaponSlam_FixedUpdate); FireLunarShards.OnEnter += new hook_OnEnter(FireLunarShards_OnEnter); if (KingConfiguration.EnableFixes.Value) { ExitSkyLeap.OnEnter += new hook_OnEnter(ExitSkyLeap_OnEnter); ExitSkyLeap.FixedUpdate += new hook_FixedUpdate(ExitSkyLeap_FixedUpdate); } } private void RemoveHooks() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Expected O, but got Unknown //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Expected O, but got Unknown HealthComponent.ServerFixedUpdate -= new hook_ServerFixedUpdate(HealthComponent_ServerFixedUpdate); HealthComponent.TakeDamage -= new hook_TakeDamage(HealthComponent_TakeDamage); SlideIntroState.OnEnter -= new hook_OnEnter(SlideIntroState_OnEnter); SprintBash.OnEnter -= new hook_OnEnter(SprintBash_OnEnter); WeaponSlam.OnEnter -= new hook_OnEnter(WeaponSlam_OnEnter); WeaponSlam.FixedUpdate -= new hook_FixedUpdate(WeaponSlam_FixedUpdate); FireLunarShards.OnEnter -= new hook_OnEnter(FireLunarShards_OnEnter); ExitSkyLeap.OnEnter -= new hook_OnEnter(ExitSkyLeap_OnEnter); ExitSkyLeap.FixedUpdate -= new hook_FixedUpdate(ExitSkyLeap_FixedUpdate); } private void ExitSkyLeap_FixedUpdate(orig_FixedUpdate orig, ExitSkyLeap self) { if (((EntityState)self).isAuthority) { if (((EntityState)self).fixedAge > 0.45f * self.duration && !hasFiredSkyLeapFirst) { hasFiredSkyLeapFirst = true; self.FireRingAuthority(); } if (((EntityState)self).fixedAge > 0.9f * self.duration && !hasFiredSkyLeapSecond) { hasFiredSkyLeapSecond = true; self.FireRingAuthority(); } } orig.Invoke(self); } private void ExitSkyLeap_OnEnter(orig_OnEnter orig, ExitSkyLeap self) { if (((EntityState)self).isAuthority) { hasFiredSkyLeapFirst = false; hasFiredSkyLeapSecond = false; } orig.Invoke(self); } private void FireLunarShards_OnEnter(orig_OnEnter orig, FireLunarShards self) { if (((EntityState)self).isAuthority) { if (!(self is FireLunarShardsHurt) && KingConfiguration.AdditionalShards.Value) { FireAdditionalShards(); } if (self is FireLunarShardsHurt && KingConfiguration.AdditionalShardsHurt.Value) { FireAdditionalShards(); } } orig.Invoke(self); void FireAdditionalShards() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: 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_00b5: 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_0028: 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_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0141: 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_014b: Unknown result type (might be due to invalid IL or missing references) Ray aimRay = ((BaseState)self).GetAimRay(); Transform val = ((BaseState)self).FindModelChild(FireLunarShards.muzzleString); if (Object.op_Implicit((Object)(object)val)) { ((Ray)(ref aimRay)).origin = val.position; } FireProjectileInfo val2 = default(FireProjectileInfo); val2.position = ((Ray)(ref aimRay)).origin; val2.rotation = Quaternion.LookRotation(((Ray)(ref aimRay)).direction); val2.crit = ((BaseState)self).RollCrit(); val2.damage = ((BaseState)self).damageStat * self.damageCoefficient; val2.owner = ((EntityState)self).gameObject; val2.force = 0f; val2.projectilePrefab = FireLunarShards.projectilePrefab; FireProjectileInfo val3 = val2; for (int i = 0; i < KingConfiguration.LunarShardAdd.Value; i++) { ProjectileManager.instance.FireProjectile(val3); ((Ray)(ref aimRay)).direction = Util.ApplySpread(((Ray)(ref aimRay)).direction, 0f, self.maxSpread * (1f + 0.45f * (float)i), self.spreadYawScale * (1f + 0.45f * (float)i), self.spreadPitchScale * (1f + 0.45f * (float)i), 0f, 0f); val3.rotation = Quaternion.LookRotation(((Ray)(ref aimRay)).direction); } } } private void WeaponSlam_FixedUpdate(orig_FixedUpdate orig, WeaponSlam self) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: 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) if (((EntityState)self).isAuthority && self.hasDoneBlastAttack && Object.op_Implicit((Object)(object)self.modelTransform) && !hasFiredWeaponSlam) { hasFiredWeaponSlam = true; float num = 360f / KingConfiguration.SlamOrbCount.Value; Vector3 val = Vector3.ProjectOnPlane(((EntityState)self).inputBank.aimDirection, Vector3.up); Transform val2 = ((BaseState)self).FindModelChild(WeaponSlam.muzzleString); for (int i = 0; (float)i < KingConfiguration.SlamOrbCount.Value; i++) { Vector3 val3 = Quaternion.AngleAxis(num * (float)i, Vector3.up) * val; ProjectileManager.instance.FireProjectile(FistSlam.waveProjectilePrefab, val2.position, Util.QuaternionSafeLookRotation(val3), ((EntityState)self).gameObject, ((BaseState)self).damageStat * FistSlam.waveProjectileDamageCoefficient, FistSlam.waveProjectileForce, ((BaseState)self).RollCrit(), (DamageColorIndex)0, (GameObject)null, -1f, (DamageTypeCombo?)null); } } orig.Invoke(self); } private void WeaponSlam_OnEnter(orig_OnEnter orig, WeaponSlam self) { if (((EntityState)self).isAuthority) { hasFiredWeaponSlam = false; } orig.Invoke(self); } private void SprintBash_OnEnter(orig_OnEnter orig, SprintBash self) { //IL_000c: 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) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_00bf: 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_00d1: 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_00d7: Unknown result type (might be due to invalid IL or missing references) if (((EntityState)self).isAuthority) { Ray aimRay = ((BaseState)self).GetAimRay(); for (int i = 0; i < KingConfiguration.SecondaryFan.Value; i++) { Vector3 val = Util.ApplySpread(((Ray)(ref aimRay)).direction, 0f, 0f, 1f, 0f, (float)i * 5f, 0f); ProjectileManager.instance.FireProjectile(FireLunarShards.projectilePrefab, ((Ray)(ref aimRay)).origin, Util.QuaternionSafeLookRotation(val), ((EntityState)self).gameObject, ((BaseState)self).damageStat * 0.1f / 12f, 0f, ((BaseState)self).RollCrit(), (DamageColorIndex)0, (GameObject)null, -1f, (DamageTypeCombo?)null); val = Util.ApplySpread(((Ray)(ref aimRay)).direction, 0f, 0f, 1f, 0f, (float)(-i) * 5f, 0f); ProjectileManager.instance.FireProjectile(FireLunarShards.projectilePrefab, ((Ray)(ref aimRay)).origin, Util.QuaternionSafeLookRotation(val), ((EntityState)self).gameObject, ((BaseState)self).damageStat * 0.1f / 12f, 0f, ((BaseState)self).RollCrit(), (DamageColorIndex)0, (GameObject)null, -1f, (DamageTypeCombo?)null); } } orig.Invoke(self); } private void SlideIntroState_OnEnter(orig_OnEnter orig, SlideIntroState self) { //IL_000c: 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) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0072: 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) if (((EntityState)self).isAuthority) { Ray aimRay = ((BaseState)self).GetAimRay(); for (int i = 0; i < KingConfiguration.UtilityShotgun.Value; i++) { ProjectileManager.instance.FireProjectile(FireLunarShards.projectilePrefab, ((Ray)(ref aimRay)).origin, Quaternion.LookRotation(((Ray)(ref aimRay)).direction), ((EntityState)self).gameObject, ((BaseState)self).damageStat * 0.05f / 12f, 0f, ((BaseState)self).RollCrit(), (DamageColorIndex)0, (GameObject)null, -1f, (DamageTypeCombo?)null); ((Ray)(ref aimRay)).direction = Util.ApplySpread(((Ray)(ref aimRay)).direction, 0f, 4f, 4f, 4f, 0f, 0f); } } orig.Invoke(self); } private void HealthComponent_TakeDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo) { orig.Invoke(self, damageInfo); if (Object.op_Implicit((Object)(object)self) && ((Object)self).name.StartsWith("Brother")) { float num = damageInfo.damage / self.fullCombinedHealth * 100f * 50f * (float)self.itemCounts.adaptiveArmor; self.adaptiveArmorValue = Mathf.Min(self.adaptiveArmorValue + num, 900f); } } private void HealthComponent_ServerFixedUpdate(orig_ServerFixedUpdate orig, HealthComponent self, float deltaTime) { orig.Invoke(self, deltaTime); if (Object.op_Implicit((Object)(object)self) && ((Object)self).name.StartsWith("Brother")) { self.adaptiveArmorValue = Mathf.Max(0f, self.adaptiveArmorValue - 100f * deltaTime); } } private void AdjustSkills() { if (Object.op_Implicit((Object)(object)Mithrix)) { SkillLocator component = Mithrix.GetComponent<SkillLocator>(); if (!((Object)(object)component == (Object)null)) { ModifySkill(component.primary.skillFamily.variants[0].skillDef, KingConfiguration.PrimCD.Value, KingConfiguration.PrimStocks.Value); ModifySkill(component.secondary.skillFamily.variants[0].skillDef, KingConfiguration.SecCD.Value, KingConfiguration.SecStocks.Value); ModifySkill(component.utility.skillFamily.variants[0].skillDef, KingConfiguration.UtilCD.Value, KingConfiguration.UtilStocks.Value); ModifySkill(component.special.skillFamily.variants[0].skillDef, KingConfiguration.SpecialCD.Value, KingConfiguration.SpecialStocks.Value); } } } private void AdjustStats() { if (Object.op_Implicit((Object)(object)Mithrix)) { CharacterBody component = Mithrix.GetComponent<CharacterBody>(); component.baseMaxHealth = KingConfiguration.basehealth.Value; component.levelMaxHealth = KingConfiguration.levelhealth.Value; component.baseAttackSpeed = KingConfiguration.baseattackspeed.Value; component.baseMoveSpeed = KingConfiguration.basespeed.Value; component.baseAcceleration = KingConfiguration.acceleration.Value; component.baseJumpPower = KingConfiguration.jumpingpower.Value; component.baseArmor = KingConfiguration.basearmor.Value; component.baseDamage = KingConfiguration.basedamage.Value; component.levelDamage = KingConfiguration.leveldamage.Value; Mithrix.GetComponent<CharacterDirection>().turnSpeed = KingConfiguration.turningspeed.Value; CharacterMotor component2 = Mithrix.GetComponent<CharacterMotor>(); component2.mass = KingConfiguration.mass.Value; component2.airControl = KingConfiguration.aircontrol.Value; component2.jumpCount = KingConfiguration.jumpcount.Value; FireLunarShards.projectilePrefab.GetComponent<ProjectileSteerTowardTarget>().rotationSpeed = KingConfiguration.ShardHoming.Value; ProjectileDirectionalTargetFinder component3 = FireLunarShards.projectilePrefab.GetComponent<ProjectileDirectionalTargetFinder>(); component3.lookRange = KingConfiguration.ShardRange.Value; component3.lookCone = KingConfiguration.ShardCone.Value; component3.allowTargetLoss = true; WeaponSlam.duration = 3.5f / KingConfiguration.baseattackspeed.Value; HoldSkyLeap.duration = KingConfiguration.JumpPause.Value; ExitSkyLeap.cloneCount = KingConfiguration.clonecount.Value; ExitSkyLeap.cloneDuration = KingConfiguration.cloneduration.Value; ExitSkyLeap.recastChance = KingConfiguration.JumpRecast.Value; UltChannelState.waveProjectileCount = KingConfiguration.UltimateWaves.Value; UltChannelState.maxDuration = KingConfiguration.UltimateDuration.Value; UltChannelState.totalWaves = KingConfiguration.UltimateCount.Value; } } private void RevertStats() { if (Object.op_Implicit((Object)(object)Mithrix)) { CharacterBody component = Mithrix.GetComponent<CharacterBody>(); component.baseMaxHealth = 1000f; component.levelMaxHealth = 300f; component.baseAttackSpeed = 1f; component.baseMoveSpeed = 15f; component.baseAcceleration = 45f; component.baseJumpPower = 25f; component.baseArmor = 20f; component.baseDamage = 16f; component.levelDamage = 3.2f; Mithrix.GetComponent<CharacterDirection>().turnSpeed = 270f; CharacterMotor component2 = Mithrix.GetComponent<CharacterMotor>(); component2.mass = 900f; component2.airControl = 0.25f; component2.jumpCount = 0; FireLunarShards.projectilePrefab.GetComponent<ProjectileSteerTowardTarget>().rotationSpeed = 20f; ProjectileDirectionalTargetFinder component3 = FireLunarShards.projectilePrefab.GetComponent<ProjectileDirectionalTargetFinder>(); component3.lookRange = 80f; component3.lookCone = 90f; component3.allowTargetLoss = false; WeaponSlam.duration = 4f; HoldSkyLeap.duration = 3f; ExitSkyLeap.cloneCount = 0; ExitSkyLeap.cloneDuration = 0; ExitSkyLeap.recastChance = 0f; UltChannelState.waveProjectileCount = 9; UltChannelState.maxDuration = 8f; UltChannelState.totalWaves = 4; } } private void RevertSkills() { if (Object.op_Implicit((Object)(object)Mithrix)) { SkillLocator component = Mithrix.GetComponent<SkillLocator>(); if (!((Object)(object)component == (Object)null)) { ModifySkill(component.primary.skillFamily.variants[0].skillDef, 4f, 1); ModifySkill(component.secondary.skillFamily.variants[0].skillDef, 5f, 1); ModifySkill(component.utility.skillFamily.variants[0].skillDef, 3f, 2); ModifySkill(component.special.skillFamily.variants[0].skillDef, 30f, 5); } } } private void ModifySkill(SkillDef skillDef, float newRecharge, int newStock) { skillDef.baseRechargeInterval = newRecharge; skillDef.baseMaxStock = newStock; } private void Language_collectLanguageRootFolders(List<string> folders) { folders.Add(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "Language")); } } public static class KingConfiguration { public static ConfigEntry<bool> EnableFixes; public static ConfigEntry<int> PrimStocks { get; set; } public static ConfigEntry<int> SecStocks { get; set; } public static ConfigEntry<int> UtilStocks { get; set; } public static ConfigEntry<int> SpecialStocks { get; set; } public static ConfigEntry<float> PrimCD { get; set; } public static ConfigEntry<float> SecCD { get; set; } public static ConfigEntry<float> UtilCD { get; set; } public static ConfigEntry<float> SpecialCD { get; set; } public static ConfigEntry<float> basehealth { get; set; } public static ConfigEntry<float> levelhealth { get; set; } public static ConfigEntry<float> basearmor { get; set; } public static ConfigEntry<float> baseattackspeed { get; set; } public static ConfigEntry<float> basedamage { get; set; } public static ConfigEntry<float> leveldamage { get; set; } public static ConfigEntry<float> basespeed { get; set; } public static ConfigEntry<float> mass { get; set; } public static ConfigEntry<float> turningspeed { get; set; } public static ConfigEntry<float> jumpingpower { get; set; } public static ConfigEntry<float> acceleration { get; set; } public static ConfigEntry<int> jumpcount { get; set; } public static ConfigEntry<float> aircontrol { get; set; } public static ConfigEntry<float> SlamOrbCount { get; set; } public static ConfigEntry<int> SecondaryFan { get; set; } public static ConfigEntry<int> UtilityShotgun { get; set; } public static ConfigEntry<int> LunarShardAdd { get; set; } public static ConfigEntry<int> UltimateWaves { get; set; } public static ConfigEntry<int> UltimateCount { get; set; } public static ConfigEntry<float> UltimateDuration { get; set; } public static ConfigEntry<int> clonecount { get; set; } public static ConfigEntry<int> cloneduration { get; set; } public static ConfigEntry<float> JumpRecast { get; set; } public static ConfigEntry<float> JumpPause { get; set; } public static ConfigEntry<float> ShardHoming { get; set; } public static ConfigEntry<float> ShardRange { get; set; } public static ConfigEntry<float> ShardCone { get; set; } public static ConfigEntry<bool> AdditionalShards { get; set; } public static ConfigEntry<bool> AdditionalShardsHurt { get; set; } public static void PopulateConfig(ConfigFile config) { EnableFixes = config.Bind<bool>("Update", "Enabled quote fixes unquote", true, "Enables fixes to what I (viliger) believe to be bugs. This ammounts to two more wave attacks as Mithix lands. Leave disabled if you want it to function as it was originally."); basehealth = config.Bind<float>("Stats", "BaseHealth", 1400f, "base health"); levelhealth = config.Bind<float>("Stats", "LevelHealth", 420f, "level health"); basedamage = config.Bind<float>("Stats", "BaseDamage", 16f, "base damage"); leveldamage = config.Bind<float>("Stats", "LevelDamage", 3.2f, "level damage"); basearmor = config.Bind<float>("Stats", "BaseArmor", 20f, "base armor"); baseattackspeed = config.Bind<float>("Stats", "BaseAttackSpeed", 1f, "base attack speed"); basespeed = config.Bind<float>("Movement", "BaseSpeed", 18f, "Mithrix's base movement speed"); mass = config.Bind<float>("Movement", "Mass", 1200f, "mass, recommended to increase if you increase his movement speed"); turningspeed = config.Bind<float>("Movement", "TurnSpeed", 900f, "how fast mithrix turns"); jumpingpower = config.Bind<float>("Movement", "MoonShoes", 75f, "how hard mithrix jumps, vanilla is 25 for context"); acceleration = config.Bind<float>("Movement", "Acceleration", 180f, "acceleration"); jumpcount = config.Bind<int>("Movement", "JumpCount", 3, "jump count, probably doesn't do anything"); aircontrol = config.Bind<float>("Movement", "Aircontrol", 1f, "air control"); PrimStocks = config.Bind<int>("Skills", "PrimStocks", 2, "Max Stocks for Mithrix's Weapon Slam"); SecStocks = config.Bind<int>("Skills", "SecondaryStocks", 2, "Max Stocks for Mithrix's Dash Attack"); UtilStocks = config.Bind<int>("Skills", "UtilStocks", 4, "Max Stocks for Mithrix's Dash"); SpecialStocks = config.Bind<int>("Skills", "SpecialStocks", 5, "Max Stocks for Mithrix's Sky Leap"); PrimCD = config.Bind<float>("Skills", "PrimCD", 3f, "Cooldown for Mithrix's Weapon Slam"); SecCD = config.Bind<float>("Skills", "SecCD", 3f, "Cooldown for Mithrix's Dash Attack"); UtilCD = config.Bind<float>("Skills", "UtilCD", 1f, "Cooldown for Mithrix's Dash"); SpecialCD = config.Bind<float>("Skills", "SpecialCD", 30f, "Cooldown for Mithrix's Jump Attack"); SlamOrbCount = config.Bind<float>("Skillmods", "OrbCount", 16f, "Orbs fired by weapon slam in a circle, note, set this to an integer"); SecondaryFan = config.Bind<int>("Skillmods", "FanCount", 5, "half the shards fired in a fan by the secondary skill"); UtilityShotgun = config.Bind<int>("Skillmods", "ShotgunCount", 5, "shots fired in a shotgun by utility"); LunarShardAdd = config.Bind<int>("Skillmods", "ShardAddCount", 5, "Bonus shards added to each shot of lunar shards"); UltimateWaves = config.Bind<int>("Skillmods", "WavePerShot", 16, "waves fired by ultimate per shot"); UltimateCount = config.Bind<int>("Skillmods", "WaveShots", 6, "Total shots of ultimate"); UltimateDuration = config.Bind<float>("Skillmods", "WaveDuration", 5.5f, "how long ultimate lasts"); clonecount = config.Bind<int>("Skillmods", "CloneCount", 2, "clones spawned in phase 3 by jump attack"); cloneduration = config.Bind<int>("Skillmods", "CloneDuration", 30, "how long clones take to despawn (like happiest mask)"); JumpRecast = config.Bind<float>("Skillmods", "RecastChance", 0f, "chance mithrix has to recast his jump skill. USE WITH CAUTION."); JumpPause = config.Bind<float>("Skillmods", "JumpDelay", 0.2f, "How long Mithrix spends in the air when using his jump special"); ShardHoming = config.Bind<float>("Skillmods", "ShardHoming", 30f, "How strongly lunar shards home in to targets. Vanilla is 20f"); ShardRange = config.Bind<float>("Skillmods", "ShardRange", 60f, "Range (distance) in which shards look for targets"); ShardCone = config.Bind<float>("Skillmods", "ShardCone", 180f, "Cone (Angle) in which shards look for targets"); AdditionalShards = config.Bind<bool>("Skillmods", "Additional Shards in P1 and P3", true, "Fire additional shards in P1 and P3."); AdditionalShardsHurt = config.Bind<bool>("Skillmods", "Additional Shards in P4", true, "Fire additional shards in P4."); } }