using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; 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 System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using EntityStates; using EntityStates.AI.Walker; using EntityStates.Mage; using EntityStates.Missions.BrotherEncounter; using EntityStates.Missions.GeodeSecretMission; using EntityStates.Missions.Moon; using EntityStates.MoonElevator; using HG; using HG.Reflection; using MoreStats; using NewMoon.Artifacts; using NewMoon.Components; using NewMoon.Items; using NewMoon.Modules; using On.EntityStates; using On.EntityStates.Missions.BrotherEncounter; using On.EntityStates.Missions.GeodeSecretMission; using On.RoR2; using ProcSolver; using R2API; using R2API.Utils; using RainrotSharedUtils; using RainrotSharedUtils.Shelters; using RoR2; using RoR2.Achievements; using RoR2.Audio; using RoR2.CharacterAI; using RoR2.ContentManagement; using RoR2.EntitlementManagement; using RoR2.ExpansionManagement; using RoR2.Items; using RoR2.Navigation; using RoR2.Orbs; using RoR2.Projectile; using RoR2.Skills; using RoR2BepInExPack.GameAssetPaths; using RoR2BepInExPack.GameAssetPaths.Version_1_39_0; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.Rendering; using UnityEngine.ResourceManagement.AsyncOperations; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: OptIn] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")] [assembly: AssemblyCompany("NewMoon")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("NewMoon")] [assembly: AssemblyTitle("NewMoon")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: UnverifiableCode] namespace NewMoon { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.RiskOfBrainrot.NewMoon", "NewMoon", "2.0.0")] public class NewMoonPlugin : BaseUnityPlugin { public static int requiredPillarCt = 2; public static int maxPillarCt = 4; public static float pillarDropOffset = 2.5f; public static float pillarDropForce = 20f; public static int baseRewardCount = 1; public static bool scaleRewardsByPlayerCount = true; private static bool isBossRush = false; public static SpawnCard exploderCard = Resources.Load("spawncards/characterspawncards/cscLunarExploder"); private List exploderCards = new List(); public static ExploderDirector exploderDirector; internal static float phaseTwoRate = 0f; internal static float phaseThreeRate = 1f; public const string guid = "com.RiskOfBrainrot.NewMoon"; public const string teamName = "RiskOfBrainrot"; public const string modName = "NewMoon"; public const string version = "2.0.0"; public static NewMoonPlugin instance; public static ItemTag IsMoonRelic; public static bool DoPillarItemDrop = false; public static AssetBundle mainAssetBundle => CommonAssets.mainAssetBundle; public static bool procSolverInstalled => Tools.isLoaded("com.RiskOfBrainrot.ProcSolver"); internal static event Action onLoaded; private void MakePillarsFun() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_00f6: 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_0128: 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_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) MoonBatteryMissionController.Awake += new hook_Awake(ReduceRequiredPillars); MoonBatteryMissionController.OnEnable += new hook_OnEnable(MoonBossRush); MoonBatteryMissionController.OnBatteryCharged += new hook_OnBatteryCharged(ChangePillarRequirement); GeodeSecretMissionRewardState.DropRewards += new hook_DropRewards(ReplaceGeodeSecretMissionRewards); NewMoonPlugin.LoadAsync(RoR2_Base_moon2.MoonBatteryBlood_prefab, (Action)delegate(GameObject ctx) { AddPillarItemDrop(ctx, PillarItemDropper.PillarType.Blood); }); NewMoonPlugin.LoadAsync(RoR2_Base_moon2.MoonBatteryDesign_prefab, (Action)delegate(GameObject ctx) { AddPillarItemDrop(ctx, PillarItemDropper.PillarType.Blood); }); NewMoonPlugin.LoadAsync(RoR2_Base_moon2.MoonBatteryMass_prefab, (Action)delegate(GameObject ctx) { AddPillarItemDrop(ctx, PillarItemDropper.PillarType.Blood); }); NewMoonPlugin.LoadAsync(RoR2_Base_moon2.MoonBatterySoul_prefab, (Action)delegate(GameObject ctx) { AddPillarItemDrop(ctx, PillarItemDropper.PillarType.Blood); }); AsyncOperationHandle val = Addressables.LoadAssetAsync((object)RoR2_Base_moon2.MoonBatteryBlood_prefab); val.Completed += delegate(AsyncOperationHandle ctx) { AddPillarItemDrop(ctx.Result, PillarItemDropper.PillarType.Blood); }; val = Addressables.LoadAssetAsync((object)RoR2_Base_moon2.MoonBatteryDesign_prefab); val.Completed += delegate(AsyncOperationHandle ctx) { AddPillarItemDrop(ctx.Result, PillarItemDropper.PillarType.Design); }; val = Addressables.LoadAssetAsync((object)RoR2_Base_moon2.MoonBatteryMass_prefab); val.Completed += delegate(AsyncOperationHandle ctx) { AddPillarItemDrop(ctx.Result, PillarItemDropper.PillarType.Mass); }; val = Addressables.LoadAssetAsync((object)RoR2_Base_moon2.MoonBatterySoul_prefab); val.Completed += delegate(AsyncOperationHandle ctx) { AddPillarItemDrop(ctx.Result, PillarItemDropper.PillarType.Soul); }; static void AddPillarItemDrop(GameObject pillarPrefab, PillarItemDropper.PillarType pillarType) { PillarItemDropper pillarItemDropper = pillarPrefab.AddComponent(); pillarItemDropper.pillarType = pillarType; } } private void MoonBossRush(orig_OnEnable orig, MoonBatteryMissionController self) { orig.Invoke(self); if (TeamHasRelics((TeamIndex)1) && NetworkServer.active) { isBossRush = true; Chat.ServerAttemptBroadcastChat(Language.Styling.MithrixStyle("The King of Nothing welcomes you...") ?? ""); ServerUpdatePillarsAndElevators(self, wasCharged: false, hasMetRequirement: true, hasMetMax: false); } } private void ReplaceGeodeSecretMissionRewards(orig_DropRewards orig, GeodeSecretMissionRewardState self) { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: 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_0098: 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_00a2: 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) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: 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_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_0105: 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_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: 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_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0174: 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_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) int participatingPlayerCount = Run.instance.participatingPlayerCount; if (participatingPlayerCount > 0 && Object.op_Implicit((Object)(object)((EntityState)self).gameObject) && Object.op_Implicit((Object)(object)((GeodeSecretMissionEntityStates)self).geodeSecretMissionController.rewardDropTable)) { int num = ((GeodeSecretMissionEntityStates)self).geodeSecretMissionController.numberOfRewardsSpawned; if (((GeodeSecretMissionEntityStates)self).geodeSecretMissionController.increaseRewardPerPlayer) { num *= participatingPlayerCount; } float num2 = 360f / (float)num; Vector3 val = Quaternion.AngleAxis((float)Random.Range(0, 360), Vector3.up) * (Vector3.up * 40f + Vector3.forward * 5f); Quaternion val2 = Quaternion.AngleAxis(num2, Vector3.up); Vector3 position = ((GeodeSecretMissionEntityStates)self).geodeSecretMissionController.rewardSpawnLocation.transform.position; int num3 = 0; while (num3 < num) { CreatePickupInfo val3 = default(CreatePickupInfo); ((CreatePickupInfo)(ref val3)).pickupIndex = PickupCatalog.FindPickupIndex(((GeodeSecretMissionEntityStates)self).geodeSecretMissionController.rewardDisplayTier); val3.pickerOptions = (Option[])(object)new Option[4] { TPkp(ItemBase.instance.ItemsDef), TPkp(ItemBase.instance.ItemsDef), TPkp(ItemBase.instance.ItemsDef), TPkp(ItemBase.instance.ItemsDef) }; val3.rotation = Quaternion.identity; val3.prefabOverride = ((GeodeSecretMissionEntityStates)self).geodeSecretMissionController.rewardPrefab; PickupDropletController.CreatePickupDroplet(val3, position, val); num3++; val = val2 * val; } } static Option TPkp(ItemDef itemDef) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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_003c: Unknown result type (might be due to invalid IL or missing references) return new Option { available = true, pickup = new UniquePickup { pickupIndex = PickupCatalog.itemIndexToPickupIndex[itemDef.itemIndex] } }; } } private void ServerUpdatePillarsAndElevators(MoonBatteryMissionController self, bool wasCharged, bool hasMetRequirement, bool hasMetMax) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Expected O, but got Unknown if (!hasMetRequirement) { return; } if (!wasCharged) { Chat.ServerAttemptBroadcastChat(Language.Styling.MithrixStyle("A path forward is cleared...") ?? ""); } for (int i = 0; i < self.elevatorStateMachines.Length; i++) { self.elevatorStateMachines[i].SetNextState((EntityState)new InactiveToReady()); } if (!hasMetMax) { return; } for (int j = 0; j < self.batteryHoldoutZones.Length; j++) { if (((Behaviour)self.batteryHoldoutZones[j]).enabled) { self.batteryHoldoutZones[j].FullyChargeHoldoutZone(); ((UnityEvent)(object)self.batteryHoldoutZones[j].onCharged).RemoveListener((UnityAction)self.OnBatteryCharged); } } self.batteryHoldoutZones = (HoldoutZoneController[])(object)new HoldoutZoneController[0]; for (int k = 0; k < self.batteryStateMachines.Length; k++) { if (!(self.batteryStateMachines[k].state is MoonBatteryComplete)) { self.batteryStateMachines[k].SetNextState((EntityState)new MoonBatteryDisabled()); } } } private void ChangePillarRequirement(orig_OnBatteryCharged orig, MoonBatteryMissionController self, HoldoutZoneController holdoutZone) { int num = requiredPillarCt; int num2 = maxPillarCt; if (isBossRush) { num = 0; num2 -= requiredPillarCt; } bool wasCharged = self._numChargedBatteries >= requiredPillarCt; if ((Object)(object)holdoutZone != (Object)null) { self.Network_numChargedBatteries = self._numChargedBatteries + 1; } if (NetworkServer.active) { ServerUpdatePillarsAndElevators(self, wasCharged, self._numChargedBatteries >= num, self._numChargedBatteries >= num2); } } private void ReduceRequiredPillars(orig_Awake orig, MoonBatteryMissionController self) { isBossRush = false; orig.Invoke(self); GameObject[] moonBatteries = self.moonBatteries; foreach (GameObject val in moonBatteries) { PillarItemDropper pillarItemDropper = val.GetComponent(); if (!Object.op_Implicit((Object)(object)pillarItemDropper)) { pillarItemDropper = val.AddComponent(); PillarItemDropper.PillarType pillarType = PillarItemDropper.PillarType.None; string name = ((Object)val).name; switch (name.Substring(11, 4)) { case "Mass": pillarType = PillarItemDropper.PillarType.Mass; break; case "Desi": pillarType = PillarItemDropper.PillarType.Design; break; case "Bloo": pillarType = PillarItemDropper.PillarType.Blood; break; case "Soul": pillarType = PillarItemDropper.PillarType.Soul; break; } pillarItemDropper.pillarType = pillarType; } pillarItemDropper.shouldDropItem = true; } } private void PillarsDropItems(orig_OnBatteryCharged orig, MoonBatteryMissionController self, HoldoutZoneController holdoutZone) { //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Expected O, but got Unknown int participatingPlayerCount = Run.instance.participatingPlayerCount; if (participatingPlayerCount != 0) { DropPillarItemFromHoldout(holdoutZone, participatingPlayerCount); } self.Network_numChargedBatteries = self._numChargedBatteries + 1; if (self._numChargedBatteries < self._numRequiredBatteries || !NetworkServer.active) { return; } for (int i = 0; i < self.batteryHoldoutZones.Length; i++) { if (((Behaviour)self.batteryHoldoutZones[i]).enabled) { self.batteryHoldoutZones[i].FullyChargeHoldoutZone(); ((UnityEvent)(object)self.batteryHoldoutZones[i].onCharged).RemoveListener((UnityAction)self.OnBatteryCharged); } } for (int j = 0; j < self.elevatorStateMachines.Length; j++) { self.elevatorStateMachines[j].SetNextState((EntityState)new InactiveToReady()); } } public static void DropPillarItemFromHoldout(HoldoutZoneController holdoutZone) { Log.Warning(((Object)((Component)holdoutZone).gameObject).name + "3"); DropPillarItemFromHoldout(holdoutZone, Object.op_Implicit((Object)(object)Run.instance) ? Run.instance.participatingPlayerCount : 0); } public static void DropPillarItemFromHoldout(HoldoutZoneController holdoutZone, int participatingPlayerCount) { //IL_0034: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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_0054: 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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_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_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: 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_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_011d: 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_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0136: 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) Log.Warning(((Object)((Component)holdoutZone).gameObject).name + "4"); if (participatingPlayerCount == 0) { return; } Vector3 val = ((Component)holdoutZone).gameObject.transform.position + Vector3.up * pillarDropOffset; PickupIndex pickupIndexFromPillarType = GetPickupIndexFromPillarType(((Component)holdoutZone).gameObject); if (pickupIndexFromPillarType != PickupIndex.none) { Log.Warning(((Object)((Component)holdoutZone).gameObject).name + "5"); int num = baseRewardCount; if (scaleRewardsByPlayerCount) { num *= participatingPlayerCount; } float num2 = 360f / (float)num; Vector3 val2 = Quaternion.AngleAxis((float)Random.Range(0, 360), Vector3.up) * (Vector3.up * pillarDropForce + Vector3.forward * 5f); Quaternion val3 = Quaternion.AngleAxis(num2, Vector3.up); int num3 = 0; while (num3 < num) { Log.Warning(((Object)((Component)holdoutZone).gameObject).name + "6"); PickupDropletController.CreatePickupDroplet(new UniquePickup(pickupIndexFromPillarType), val, val2, false); num3++; val2 = val3 * val2; } } } public static PickupIndex GetPickupIndexFromPillarType(GameObject pillar) { //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) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: 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) ItemBase itemBase = null; string name = ((Object)pillar).name; switch (name.Substring(11, 4)) { case "Mass": itemBase = ItemBase.instance; break; case "Desi": itemBase = ItemBase.instance; break; case "Bloo": itemBase = ItemBase.instance; break; case "Soul": itemBase = ItemBase.instance; break; } if (itemBase != null) { ItemIndex itemIndex = itemBase.ItemsDef.itemIndex; return PickupCatalog.FindPickupIndex(itemIndex); } Debug.Log((object)"No pickup index found!"); return PickupIndex.none; } public void LunarExplodersDuringBrother() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown Phase1.OnEnter += new hook_OnEnter(InitializeExploderDirector); Phase2.OnEnter += new hook_OnEnter(DisableExploderDirector); Phase3.OnEnter += new hook_OnEnter(RestoreExploderDirector); Phase4.OnEnter += new hook_OnEnter(KillExploderDirector); } private void GetExploderCard(List cardList, StageInfo currentStage) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Invalid comparison between Unknown and I4 //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Invalid comparison between Unknown and I4 Debug.Log((object)"jsd fjsn"); if ((int)currentStage.stage != 65536) { return; } List list = new List(); foreach (DirectorCardHolder card2 in cardList) { if ((int)card2.MonsterCategory == 2) { DirectorCard card = card2.Card; SpawnCard spawnCard = card.spawnCard; GameObject prefab = spawnCard.prefab; if (((Object)spawnCard).name == "cscLunarExploder") { exploderCards.Add(card); } } } foreach (DirectorCardHolder item in list) { cardList.Remove(item); } } private void InitializeExploderDirector(orig_OnEnter orig, Phase1 self) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); if ((Object)(object)exploderDirector == (Object)null) { GameObject val = new GameObject("CommencementPerfected_ChimeraExploderDirector_OrTheCPCEDForShort"); val.transform.position = new Vector3(-88f, 491.1f, 0f); exploderDirector = val.AddComponent(); exploderDirector.baseState = (BrotherEncounterBaseState)(object)self; } } private void DisableExploderDirector(orig_OnEnter orig, Phase2 self) { orig.Invoke(self); exploderDirector.SetDirectorRate(phaseTwoRate); } private void RestoreExploderDirector(orig_OnEnter orig, Phase3 self) { orig.Invoke(self); exploderDirector.SetDirectorRate(phaseThreeRate); } private void KillExploderDirector(orig_OnEnter orig, Phase4 self) { orig.Invoke(self); Object.Destroy((Object)(object)((Component)exploderDirector).gameObject); } public static bool TeamHasRelics(TeamIndex teamIndex) { //IL_003c: 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) if (!DoPillarItemDrop) { return false; } int num = 0; ReadOnlyCollection readOnlyInstancesList = CharacterMaster.readOnlyInstancesList; int num2 = 0; int num3 = 0; int count = readOnlyInstancesList.Count; while (num2 < count) { CharacterMaster val = readOnlyInstancesList[num2]; if (val.teamIndex == teamIndex && Object.op_Implicit((Object)(object)val.playerCharacterMasterController) && val.playerCharacterMasterController.isConnected) { num3++; num += val.inventory.GetItemCountEffective(ItemBase.instance.ItemsDef) + val.inventory.GetItemCountEffective(ItemBase.instance.ItemsDef) + val.inventory.GetItemCountEffective(ItemBase.instance.ItemsDef) + val.inventory.GetItemCountEffective(ItemBase.instance.ItemsDef); } num2++; Debug.Log((object)("relics: " + num)); if (num >= num3) { return true; } } return false; } public static float GetProcRate(DamageInfo damageInfo) { if (damageInfo.procCoefficient <= 0f || !procSolverInstalled) { return damageInfo.procCoefficient; } return _GetProcRate(damageInfo); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static float _GetProcRate(DamageInfo damageInfo) { return ProcSolverPlugin.GetProcRateMod(damageInfo); } private void Awake() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) instance = this; Config.Init(); Log.Init(((BaseUnityPlugin)this).Logger); IsMoonRelic = ItemAPI.AddItemTag("IsMoonRelic"); Language.Init(); Hooks.Init(); CommonAssets.Init(); EliteModule.Init(); DoPillarItemDrop = GetConfigBool(defaultValue: true, "Global : Endgame Items", "Setting to TRUE will enable the Moon Relic items, which drop from pillars, and all features that rely on these items."); if (DoPillarItemDrop) { MakePillarsFun(); } if (GetConfigBool(defaultValue: true, "Global : Mithrix : Lunar Exploders Spawn On Ramps", "Setting to TRUE will cause Lunar Exploders to spawn on arena ramps during the fight.")) { LunarExplodersDuringBrother(); } InitializeContent(); NewMoonPlugin.onLoaded(); Config.Save(); new ContentPacks().Initialize(); } private void InitializeContent() { Type[] types = Assembly.GetExecutingAssembly().GetTypes(); BeginInitializing(types, "NewMoonItems.txt"); BeginInitializing(types, "NewMoonArtifacts.txt"); } private void BeginInitializing(Type[] allTypes, string fileName = "") where T : SharedBase { Type baseType = typeof(T); if (!baseType.IsAbstract) { Log.Error(Log.Combine() + "Incorrect BaseType: " + baseType.Name); return; } IEnumerable source = allTypes.Where((Type type) => !type.IsAbstract && type.IsSubclassOf(baseType)); if (source.Count() <= 0) { return; } IEnumerable enumerable = from objType in source select (T)Activator.CreateInstance(objType) into sharedBase orderby sharedBase.loadOrder select sharedBase; Log.Debug(Log.Combine(baseType.Name) + "Initializing"); foreach (SharedBase item in enumerable) { string text = Log.Combine(baseType.Name, item.ConfigName); if (ValidateBaseType(item)) { Log.Debug(text + "Validated"); InitializeBaseType(item); Log.Debug(text + "Initialized"); } } if (!string.IsNullOrEmpty(fileName)) { Language.TryPrintOutput(fileName); } } private bool ValidateBaseType(SharedBase obj) { bool isEnabled = obj.isEnabled; if (obj.forcePrerequisites) { return isEnabled && obj.GetPrerequisites(); } return obj.Bind(isEnabled, "Should This Content Be Enabled") && obj.GetPrerequisites(); } private void InitializeBaseType(SharedBase obj) { obj.Init(); } public static bool GetConfigBool(bool defaultValue, string packetTitle, string desc = "") { return ConfigManager.DualBindToConfig(packetTitle, Config.MyConfig, "Should This Content Be Enabled", defaultValue, desc); } public static Sprite TryLoadSpriteFromBundle(string path, AssetBundle assetBundle = null, bool fallBackOnWrench = false) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) Sprite val = NewMoonPlugin.TryLoadFromBundle(path, assetBundle); if (Object.op_Implicit((Object)(object)val)) { return val; } return Addressables.LoadAssetAsync((object)(fallBackOnWrench ? RoR2_Base_Core.texNullIcon_png : RoR2_Base_Common_MiscIcons.texWIPIcon_png)).WaitForCompletion(); } public static T TryLoadFromBundle(string path, AssetBundle assetBundle = null) where T : Object { if ((Object)(object)assetBundle == (Object)null) { assetBundle = mainAssetBundle; } if (Object.op_Implicit((Object)(object)assetBundle) && !string.IsNullOrWhiteSpace(path) && assetBundle.Contains(path)) { return assetBundle.LoadAsset(path); } return default(T); } public static AssetReferenceT LoadAsync(string guid, Action callback) where T : Object { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) AssetReferenceT val = new AssetReferenceT(guid); AsyncOperationHandle handle = AssetAsyncReferenceManager.LoadAsset(val, (AsyncReferenceHandleUnloadType)2); if (callback == null) { return val; } if (handle.IsDone) { onCompleted(handle); return val; } handle.Completed += onCompleted; return val; void onCompleted(AsyncOperationHandle val2) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Invalid comparison between Unknown and I4 if (val2.Result == null || (int)val2.Status != 1) { Debug.LogError((object)$"Failed to load asset [{val2.DebugName}] : {val2.OperationException}"); } else { callback(val2.Result); } } } public static void RemoveCraftingRecipe(string guid) { NewMoonPlugin.LoadAsync(guid, (Action)delegate(CraftableDef craftableDef) { craftableDef.recipes = (Recipe[])(object)new Recipe[0]; }); } public static void RetierItemAsync(string itemGuid, ItemTier tier = (ItemTier)5, Action callback = null) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) AssetReferenceT val = new AssetReferenceT(itemGuid); AsyncOperationHandle val2 = AssetAsyncReferenceManager.LoadAsset(val, (AsyncReferenceHandleUnloadType)2); val2.Completed += delegate(AsyncOperationHandle ctx) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) ItemDef result = ctx.Result; result.tier = tier; result.deprecatedTier = tier; if (callback != null) { callback(result); } }; } public static void RemoveEquipmentAsync(string equipmentGuid, Action callback = null) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) AssetReferenceT val = new AssetReferenceT(equipmentGuid); AsyncOperationHandle val2 = AssetAsyncReferenceManager.LoadAsset(val, (AsyncReferenceHandleUnloadType)2); val2.Completed += delegate(AsyncOperationHandle ctx) { EquipmentDef result = ctx.Result; result.canDrop = false; result.canBeRandomlyTriggered = false; result.enigmaCompatible = false; result.dropOnDeathChance = 0f; if (callback != null) { callback(result); } }; } } internal static class Log { public static bool enableDebugging; internal static ManualLogSource _logSource; public static void DebugBreakpoint(string methodName, int breakpointNumber = -1) { string text = "NewMoon: " + methodName + " IL hook failed!"; if (breakpointNumber >= 0) { text += $" (breakpoint {breakpointNumber})"; } Error(text); } internal static void Init(ManualLogSource logSource) { enableDebugging = ConfigManager.DualBindToConfig("Swan Song", Config.MyConfig, "Enable Debugging", defaultValue: false, "Enable debug outputs to the log for troubleshooting purposes. Enabling this will slow down the game."); _logSource = logSource; } internal static string Combine(params string[] parameters) { string text = "NewMoon : "; foreach (string text2 in parameters) { text = text + text2 + " : "; } return text; } internal static void Debug(object data) { if (enableDebugging) { _logSource.LogDebug(data); } } internal static void Error(object data) { _logSource.LogError(data); } internal static void ErrorAssetBundle(string assetName, string bundleName) { Error("failed to load asset, " + assetName + ", because it does not exist in asset bundle, " + bundleName); } 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); } } public abstract class SharedBase { public virtual int loadOrder => 0; public virtual bool forcePrerequisites { get; } = false; public abstract string ConfigName { get; } public virtual bool isEnabled { get; } = true; public static ManualLogSource Logger => Log._logSource; public abstract AssetBundle assetBundle { get; } public abstract void Hooks(); public abstract void Lang(); public virtual bool GetPrerequisites() { return true; } public virtual void Init() { ConfigManager.HandleConfigAttributes(GetType(), ConfigName, Config.MyConfig); Hooks(); Lang(); NewMoonPlugin.onLoaded += PostInit; } public T Bind(T defaultValue, string configName, string configDesc = "") { return ConfigManager.DualBindToConfig(ConfigName, Config.MyConfig, configName, defaultValue, configDesc); } public virtual void PostInit() { } public static float GetHyperbolic(float firstStack, float cap, float chance) { if (firstStack >= cap) { return cap * (chance / firstStack); } float num = chance / firstStack; float num2 = 100f * firstStack / (cap - firstStack); return cap * (1f - 100f / (num * num2 + 100f)); } public static ExpansionDef SotvExpansionDef() { //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) return Addressables.LoadAssetAsync((object)"RoR2/DLC1/Common/DLC1.asset").WaitForCompletion(); } } public class ExploderDirector : MonoBehaviour { internal BrotherEncounterBaseState baseState; private bool isActive = false; private static float baseSpawnFrequency = 20f; private static float spawnRateModifier = 1f; private float spawnFrequency; private float exploderSpawnTimer = 0f; public const float rampHeight = 524.3f; public List SpawnNodes = new List(); public void SetDirectorRate(float rate) { if (rate <= 0f) { exploderSpawnTimer = 0f; spawnRateModifier = 0f; isActive = false; } else { isActive = true; spawnRateModifier = rate; spawnFrequency = baseSpawnFrequency / spawnRateModifier; } } private void Start() { if (baseState != null) { CreateSpawnNodes(); SetDirectorRate(1f); isActive = true; } else { Object.Destroy((Object)(object)this); } } private void CreateSpawnNodes() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: 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_005f: 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_007a: 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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown //IL_00a8: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active) { Vector3[] array = (Vector3[])(object)new Vector3[4] { new Vector3(65f, 524.3f, 155f), new Vector3(65f, 524.3f, -145f), new Vector3(-240f, 524.3f, 155f), new Vector3(-240f, 524.3f, -145f) }; for (int i = 0; i < array.Length; i++) { GameObject val = new GameObject($"CommencementPerfected_ExploderSpawnNode_{i}"); val.transform.position = array[i]; val.transform.parent = ((Component)this).transform; ExploderSpawnNode item = val.AddComponent(); SpawnNodes.Add(item); } } } private void FixedUpdate() { if (NetworkServer.active && spawnFrequency != 0f) { exploderSpawnTimer += Time.fixedDeltaTime * spawnRateModifier; while (exploderSpawnTimer > spawnFrequency) { exploderSpawnTimer -= spawnFrequency; List list = new List(); foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { if (instance.body.healthComponent.alive) { list.Add(instance.master); } } StartExploderWaveStacked(list.Count, list); } } else { Debug.Log((object)"uuu"); } if (((EntityState)baseState).outer.destroying) { SetDirectorRate(0f); Debug.Log((object)"Destroying Exploder Director! Ahhhhhh!!!!!!"); Object.Destroy((Object)(object)this); } } private void StartExploderWaveStacked(int spawnCount, List playersList) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: 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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < playersList.Count; i++) { CharacterMaster val = playersList[i]; Vector3 position = val.GetBody().transform.position; float num = float.PositiveInfinity; ExploderSpawnNode exploderSpawnNode = null; foreach (ExploderSpawnNode spawnNode in SpawnNodes) { float num2 = Vector3.Distance(((Component)spawnNode).transform.position, position); Vector2 zero = Vector2.zero; if (num2 < num) { exploderSpawnNode = spawnNode; num = num2; } } int num3 = playersList.Count - i; int num4 = spawnCount / num3; if (spawnCount % num3 != 0) { num4 = Mathf.CeilToInt((float)num4); } if ((Object)(object)exploderSpawnNode != (Object)null && num4 > 0) { exploderSpawnNode.QueueSpawns(num4); } } } private void StartExploderWaveDispersed(int spawnCount, List playersList, Vector2 searchRange) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: 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) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0097: 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) if (searchRange.x >= searchRange.y && searchRange.y != 0f) { StartExploderWaveStacked(spawnCount, playersList); return; } for (int i = 0; i < playersList.Count; i++) { CharacterMaster val = playersList[i]; float num = float.PositiveInfinity; ExploderSpawnNode exploderSpawnNode = null; foreach (ExploderSpawnNode spawnNode in SpawnNodes) { if ((float)spawnNode.spawnQueue <= searchRange.y) { float num2 = Vector3.Distance(((Component)spawnNode).transform.position, ((Component)val).transform.position); if (num2 < num) { exploderSpawnNode = spawnNode; num = num2; } } else { if (searchRange.x < (float)spawnNode.spawnQueue) { searchRange.x = searchRange.y; } searchRange.y = spawnNode.spawnQueue; } } int num3 = playersList.Count - i; int num4 = spawnCount / num3; if (spawnCount % num3 != 0) { num4 = Mathf.CeilToInt((float)num4); } if ((Object)(object)exploderSpawnNode != (Object)null && num4 > 0) { exploderSpawnNode.QueueSpawns(num4); } } } } public class ExploderSpawnNode : MonoBehaviour { internal int spawnQueue = 0; private static float spawnInterval = 1f; private float spawnTimer = 0f; private void Start() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) spawnQueue = 0; Debug.Log((object)((Component)this).transform.position); } public void QueueSpawns(int spawnCount, float delay = 0f) { spawnQueue += spawnCount; spawnTimer = 0f - delay; } private void FixedUpdate() { //IL_0070: 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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Expected O, but got Unknown //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Expected O, but got Unknown if (spawnQueue > 0) { spawnTimer += Time.fixedDeltaTime; while (spawnTimer > spawnInterval && spawnQueue > 0) { spawnTimer -= spawnInterval; spawnQueue--; Debug.Log((object)$"Spawn {((Object)NewMoonPlugin.exploderCard).name} at position {((Component)this).transform.position}!. Remaining queue: {spawnQueue}"); DirectorSpawnRequest val = new DirectorSpawnRequest(NewMoonPlugin.exploderCard, new DirectorPlacementRule { placementMode = (PlacementMode)1, minDistance = 0f, maxDistance = 10f, spawnOnTarget = ((Component)this).transform }, RoR2Application.rng); val.teamIndexOverride = (TeamIndex)2; val.ignoreTeamMemberLimit = true; DirectorCore instance = DirectorCore.instance; if ((Object)(object)instance == (Object)null) { break; } instance.TrySpawnObject(val); } } else { spawnTimer = 0f; } } } public static class Extensions { public static bool InteractableIsPermittedForSpawn(this GameObject interactableObject, bool disallowPickups = true) { if ((Object)(object)interactableObject == (Object)null) { return false; } InteractionProcFilter val = default(InteractionProcFilter); if (interactableObject.TryGetComponent(ref val)) { return val.shouldAllowOnInteractionBeginProc; } PurchaseInteraction val2 = default(PurchaseInteraction); if (interactableObject.TryGetComponent(ref val2)) { return !val2.disableSpawnOnInteraction; } DelusionChestController val3 = default(DelusionChestController); if (interactableObject.TryGetComponent(ref val3)) { PickupPickerController val4 = default(PickupPickerController); if (interactableObject.TryGetComponent(ref val4) && ((Behaviour)val4).enabled) { return false; } return true; } GenericPickupController val5 = default(GenericPickupController); if (interactableObject.TryGetComponent(ref val5)) { return disallowPickups || val5.Duplicated; } if (Object.op_Implicit((Object)(object)interactableObject.GetComponent())) { return false; } if (Object.op_Implicit((Object)(object)interactableObject.GetComponent())) { return false; } PowerPedestal val6 = default(PowerPedestal); if (interactableObject.TryGetComponent(ref val6)) { return val6.CanTriggerFireworks; } AccessCodesNodeController val7 = default(AccessCodesNodeController); if (interactableObject.TryGetComponent(ref val7)) { return val7.CheckInteractionOrder(); } return true; } public static GameObject FixItemModel(this GameObject prefab) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown //IL_0076: 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_00b4: Expected O, but got Unknown //IL_00cb: 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) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: 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_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)prefab == (Object)null) { prefab = Resources.Load("prefabs/NullModel"); } ModelPanelParameters val = prefab.AddComponent(); val.minDistance = 1f; val.maxDistance = 15f; Transform val2 = prefab.transform.Find("FocusPos"); if ((Object)(object)val2 == (Object)null) { GameObject val3 = new GameObject("FocusPos"); val2 = val3.transform; val2.parent = prefab.transform; val2.localPosition = Vector3.zero; } val.focusPointTransform = val2; Transform val4 = prefab.transform.Find("CameraPos"); if ((Object)(object)val4 == (Object)null) { GameObject val5 = new GameObject("CameraPos"); val4 = val5.transform; val4.parent = prefab.transform; val4.SetPositionAndRotation(val2.position + Vector3.forward * -7f + Vector3.right * -1f, val4.rotation); } val.cameraPositionTransform = val4; return prefab; } public static string AsPercent(this float d) { return d * 100f + "%"; } public static void AddPersistentListener(this HoldoutZoneControllerChargedUnityEvent unityEvent, UnityAction action) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_004c: 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) PersistentCallGroup persistentCalls = ((UnityEventBase)unityEvent).m_PersistentCalls; PersistentCall val = new PersistentCall(); ref Object target = ref val.m_Target; object? target2 = ((Delegate)(object)action).Target; target = (Object)((target2 is Object) ? target2 : null); val.m_TargetAssemblyTypeName = UnityEventTools.TidyAssemblyTypeName(((Delegate)(object)action).Method.DeclaringType.AssemblyQualifiedName); val.m_MethodName = ((Delegate)(object)action).Method.Name; val.m_CallState = (UnityEventCallState)2; val.m_Mode = (PersistentListenerMode)0; persistentCalls.AddListener(val); } public static void AddPersistentListener(this UnityEvent unityEvent, UnityAction action) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_004c: 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) PersistentCallGroup persistentCalls = ((UnityEventBase)unityEvent).m_PersistentCalls; PersistentCall val = new PersistentCall(); ref Object target = ref val.m_Target; object? target2 = ((Delegate)(object)action).Target; target = (Object)((target2 is Object) ? target2 : null); val.m_TargetAssemblyTypeName = UnityEventTools.TidyAssemblyTypeName(((Delegate)(object)action).Method.DeclaringType.AssemblyQualifiedName); val.m_MethodName = ((Delegate)(object)action).Method.Name; val.m_CallState = (UnityEventCallState)2; val.m_Mode = (PersistentListenerMode)0; persistentCalls.AddListener(val); } public static void AddPersistentListener(this UnityEvent unityEvent, UnityAction action) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_004c: 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) PersistentCallGroup persistentCalls = ((UnityEventBase)unityEvent).m_PersistentCalls; PersistentCall val = new PersistentCall(); ref Object target = ref val.m_Target; object? target2 = ((Delegate)(object)action).Target; target = (Object)((target2 is Object) ? target2 : null); val.m_TargetAssemblyTypeName = UnityEventTools.TidyAssemblyTypeName(((Delegate)(object)action).Method.DeclaringType.AssemblyQualifiedName); val.m_MethodName = ((Delegate)(object)action).Method.Name; val.m_CallState = (UnityEventCallState)2; val.m_Mode = (PersistentListenerMode)0; persistentCalls.AddListener(val); } public static void AddPersistentListener(this UnityEvent unityEvent, UnityAction action) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_004c: 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) PersistentCallGroup persistentCalls = ((UnityEventBase)unityEvent).m_PersistentCalls; PersistentCall val = new PersistentCall(); ref Object target = ref val.m_Target; object? target2 = ((Delegate)(object)action).Target; target = (Object)((target2 is Object) ? target2 : null); val.m_TargetAssemblyTypeName = UnityEventTools.TidyAssemblyTypeName(((Delegate)(object)action).Method.DeclaringType.AssemblyQualifiedName); val.m_MethodName = ((Delegate)(object)action).Method.Name; val.m_CallState = (UnityEventCallState)2; val.m_Mode = (PersistentListenerMode)0; persistentCalls.AddListener(val); } } public static class Tools { public static string modPrefix = string.Format("@{0}+{1}", "ArtificerExtended", "artiskillicons"); public static AssetBundle LoadAssetBundle(byte[] resourceBytes) { if (resourceBytes == null) { throw new ArgumentNullException("resourceBytes"); } return AssetBundle.LoadFromMemory(resourceBytes); } public static string GetModPrefix(this BaseUnityPlugin plugin, string bundleName) { return $"@{plugin.Info.Metadata.Name}+{bundleName}"; } internal static bool isLoaded(string modguid) { foreach (KeyValuePair pluginInfo in Chainloader.PluginInfos) { string key = pluginInfo.Key; PluginInfo value = pluginInfo.Value; if (key == modguid) { return true; } } return false; } internal static string ConvertDecimal(float d) { return d * 100f + "%"; } internal static void GetMaterial(GameObject model, string childObject, Color color, ref Material material, float scaleMultiplier = 1f, bool replaceAll = false) { //IL_0030: 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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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_006a: Expected O, but got Unknown //IL_0092: Unknown result type (might be due to invalid IL or missing references) Renderer[] componentsInChildren = model.GetComponentsInChildren(); Renderer[] array = componentsInChildren; foreach (Renderer val in array) { Renderer val2 = val; if (string.Equals(((Object)val).name, childObject)) { if (color == Color.clear) { Object.Destroy((Object)(object)val); break; } if ((Object)(object)material == (Object)null) { material = new Material(val.material); material.mainTexture = val.material.mainTexture; material.shader = val.material.shader; material.color = color; } val.material = material; Transform transform = ((Component)val).transform; transform.localScale *= scaleMultiplier; if (!replaceAll) { break; } } } } internal static void DebugMaterial(GameObject model) { Renderer[] componentsInChildren = model.GetComponentsInChildren(); Renderer[] array = componentsInChildren; foreach (Renderer val in array) { Renderer val2 = val; Debug.Log((object)("Material: " + ((Object)val2).name.ToString())); } } internal static void GetParticle(GameObject model, string childObject, Color color, float sizeMultiplier = 1f, bool replaceAll = false) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002e: 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_004b: 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_0069: 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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) ParticleSystem[] componentsInChildren = model.GetComponentsInChildren(); ParticleSystem[] array = componentsInChildren; foreach (ParticleSystem val in array) { ParticleSystem val2 = val; MainModule main = val2.main; ColorOverLifetimeModule colorOverLifetime = val2.colorOverLifetime; ColorBySpeedModule colorBySpeed = val2.colorBySpeed; if (string.Equals(((Object)val2).name, childObject)) { ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(color); ((MainModule)(ref main)).startSizeMultiplier = ((MainModule)(ref main)).startSizeMultiplier * sizeMultiplier; ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(color); ((ColorBySpeedModule)(ref colorBySpeed)).color = MinMaxGradient.op_Implicit(color); if (!replaceAll) { break; } } } } internal static void DebugParticleSystem(GameObject model) { ParticleSystem[] components = model.GetComponents(); ParticleSystem[] array = components; foreach (ParticleSystem val in array) { ParticleSystem val2 = val; Debug.Log((object)("Particle: " + ((Object)val2).name.ToString())); } } internal static void GetLight(GameObject model, string childObject, Color color, bool replaceAll = false) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) Light[] componentsInChildren = model.GetComponentsInChildren(); Light[] array = componentsInChildren; foreach (Light val in array) { Light val2 = val; if (string.Equals(((Object)val2).name, childObject)) { val2.color = color; if (!replaceAll) { break; } } } } internal static void DebugLight(GameObject model) { Light[] componentsInChildren = model.GetComponentsInChildren(); Light[] array = componentsInChildren; foreach (Light val in array) { Light val2 = val; Debug.Log((object)("Light: " + ((Object)val2).name.ToString())); } } public static void ClearDotStacksForType(this DotController dotController, DotIndex dotIndex) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) for (int num = dotController.dotStackList.Count - 1; num >= 0; num--) { if (dotController.dotStackList[num].dotIndex == dotIndex) { dotController.RemoveDotStackAtServer(num); } } } public static void ApplyCooldownScale(GenericSkill skillSlot, float cooldownScale) { if ((Object)(object)skillSlot != (Object)null) { skillSlot.cooldownScale *= cooldownScale; } } public static int CountOverspillTriangular(float totalValue, float incrementor = 1f) { int num = 0; while (totalValue > 0f) { num++; totalValue -= incrementor * (float)num; } return num; } public static int CountOverspillFibonacci(float totalValue, float thresholdScale = 1f, int startingIndex = 1) { int num = 1; int num2 = 1; int num3 = 0; while (totalValue > (float)num2 * thresholdScale) { num2 += num; num = num2 - num; if (num3 > startingIndex) { num3++; } } return num3; } public static RecipeIngredient[] GetAllBossKeyIngredients() { return GetAllIngredientsWithTags((ItemTag[])(object)new ItemTag[1] { (ItemTag)26 }, (ItemTag[])(object)new ItemTag[0], 4, 4); } public static RecipeIngredient[] GetAllIngredientsWithTags(ItemTag[] required, ItemTag[] forbidden, int minTier = 1, int maxTier = 3) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0065: 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) List list = new List(); for (int i = minTier; i <= maxTier; i++) { ItemTier itemTier = (ItemTier)0; switch (i) { case 1: itemTier = (ItemTier)0; break; case 2: itemTier = (ItemTier)1; break; case 3: itemTier = (ItemTier)2; break; case 4: itemTier = (ItemTier)4; break; case 5: itemTier = (ItemTier)10; break; } RecipeIngredient val = new RecipeIngredient(); val.requiredTags = required; val.forbiddenTags = forbidden; val.type = (IngredientTypeIndex)1; val.itemTier = itemTier; list.Add(val); } return list.ToArray(); } } } namespace NewMoon.Modules { public static class CommonAssets { private static AssetBundle _mainAssetBundle; public static string dropPrefabsPath = "Assets/Models/DropPrefabs"; public static string iconsPath = "Assets/Textures/Icons/"; public static string eliteMaterialsPath = "Assets/Textures/Materials/Elite/"; public static AssetBundle mainAssetBundle { get { if ((Object)(object)_mainAssetBundle == (Object)null) { _mainAssetBundle = Assets.LoadAssetBundle("fruityendings"); } return _mainAssetBundle; } set { _mainAssetBundle = value; } } public static void Init() { } } public class CustomRendererInfo { public string childName; public Material material = null; public bool dontHotpoo = false; public bool ignoreOverlays = false; } internal static class Assets { internal static Dictionary loadedBundles = new Dictionary(); internal static AssetBundle LoadAssetBundle(string bundleName) { if (loadedBundles.ContainsKey(bundleName)) { return loadedBundles[bundleName]; } AssetBundle val = null; val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)NewMoonPlugin.instance).Info.Location), bundleName)); loadedBundles[bundleName] = val; return val; } internal static GameObject CloneTracer(string originalTracerName, string newTracerName) { if ((Object)(object)LegacyResourcesAPI.Load("Prefabs/Effects/Tracers/" + originalTracerName) == (Object)null) { return null; } GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load("Prefabs/Effects/Tracers/" + originalTracerName), newTracerName, true); if (!Object.op_Implicit((Object)(object)val.GetComponent())) { val.AddComponent(); } if (!Object.op_Implicit((Object)(object)val.GetComponent())) { val.AddComponent(); } if (!Object.op_Implicit((Object)(object)val.GetComponent())) { val.AddComponent(); } val.GetComponent().speed = 250f; val.GetComponent().length = 50f; Content.CreateAndAddEffectDef(val); return val; } internal static void ConvertAllRenderersToHopooShader(GameObject objectToConvert) { if (!Object.op_Implicit((Object)(object)objectToConvert)) { return; } MeshRenderer[] componentsInChildren = objectToConvert.GetComponentsInChildren(); foreach (MeshRenderer val in componentsInChildren) { if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial)) { ((Renderer)val).sharedMaterial.ConvertDefaultShaderToHopoo(); } } SkinnedMeshRenderer[] componentsInChildren2 = objectToConvert.GetComponentsInChildren(); foreach (SkinnedMeshRenderer val2 in componentsInChildren2) { if (Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)((Renderer)val2).sharedMaterial)) { ((Renderer)val2).sharedMaterial.ConvertDefaultShaderToHopoo(); } } } internal static GameObject LoadCrosshair(string crosshairName) { GameObject val = LegacyResourcesAPI.Load("Prefabs/Crosshair/" + crosshairName + "Crosshair"); if ((Object)(object)val == (Object)null) { Log.Error("could not load crosshair with the name " + crosshairName + ". defaulting to Standard"); return LegacyResourcesAPI.Load("Prefabs/Crosshair/StandardCrosshair"); } return val; } internal static GameObject LoadEffect(this AssetBundle assetBundle, string resourceName, bool parentToTransform) { return assetBundle.LoadEffect(resourceName, "", parentToTransform); } internal static GameObject LoadEffect(this AssetBundle assetBundle, string resourceName, string soundName = "", bool parentToTransform = false) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) GameObject val = assetBundle.LoadAsset(resourceName); if (!Object.op_Implicit((Object)(object)val)) { Log.ErrorAssetBundle(resourceName, ((Object)assetBundle).name); return null; } val.AddComponent().duration = 12f; val.AddComponent(); val.AddComponent().vfxPriority = (VFXPriority)2; EffectComponent val2 = val.AddComponent(); val2.applyScale = false; val2.effectIndex = (EffectIndex)(-1); val2.parentToReferencedTransform = parentToTransform; val2.positionAtReferencedTransform = true; val2.soundName = soundName; Content.CreateAndAddEffectDef(val); return val; } internal static GameObject CreateProjectileGhostPrefab(this AssetBundle assetBundle, string ghostName) { GameObject val = assetBundle.LoadAsset(ghostName); if ((Object)(object)val == (Object)null) { Log.Error("Failed to load ghost prefab " + ghostName); } if (!Object.op_Implicit((Object)(object)val.GetComponent())) { val.AddComponent(); } if (!Object.op_Implicit((Object)(object)val.GetComponent())) { val.AddComponent(); } ConvertAllRenderersToHopooShader(val); return val; } internal static GameObject CreateProjectileGhostPrefab(GameObject ghostObject, string newName) { if ((Object)(object)ghostObject == (Object)null) { Log.Error("Failed to load ghost prefab " + ((Object)ghostObject).name); } GameObject val = PrefabAPI.InstantiateClone(ghostObject, newName); if (!Object.op_Implicit((Object)(object)val.GetComponent())) { val.AddComponent(); } if (!Object.op_Implicit((Object)(object)val.GetComponent())) { val.AddComponent(); } return val; } internal static GameObject CloneProjectilePrefab(string prefabName, string newPrefabName) { return PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load("Prefabs/Projectiles/" + prefabName), newPrefabName); } internal static GameObject LoadAndAddProjectilePrefab(this AssetBundle assetBundle, string newPrefabName) { GameObject val = assetBundle.LoadAsset(newPrefabName); if ((Object)(object)val == (Object)null) { Log.ErrorAssetBundle(newPrefabName, ((Object)assetBundle).name); return null; } Content.AddProjectilePrefab(val); return val; } } internal static class Prefabs { private static PhysicMaterial ragdollMaterial; public static GameObject CreateDisplayPrefab(AssetBundle assetBundle, string displayPrefabName, GameObject prefab) { GameObject val = assetBundle.LoadAsset(displayPrefabName); if ((Object)(object)val == (Object)null) { Log.Error("could not load display prefab " + displayPrefabName + ". Make sure this prefab exists in assetbundle " + ((Object)assetBundle).name); return null; } CharacterModel val2 = val.GetComponent(); if (!Object.op_Implicit((Object)(object)val2)) { val2 = val.AddComponent(); } val2.baseRendererInfos = prefab.GetComponentInChildren().baseRendererInfos; Assets.ConvertAllRenderersToHopooShader(val); return val; } public static CharacterModel SetupCharacterModel(GameObject bodyPrefab, CustomRendererInfo[] customInfos = null) { CharacterModel val = ((Component)bodyPrefab.GetComponent().modelTransform).gameObject.GetComponent(); bool flag = (Object)(object)val != (Object)null; if (!flag) { val = ((Component)bodyPrefab.GetComponent().modelTransform).gameObject.AddComponent(); } val.body = bodyPrefab.GetComponent(); val.autoPopulateLightInfos = true; val.invisibilityCount = 0; val.temporaryOverlays = new List(); if (!flag) { SetupCustomRendererInfos(val, customInfos); } else { SetupPreAttachedRendererInfos(val); } SetupHurtboxGroup(bodyPrefab, ((Component)val).gameObject); SetupAimAnimator(bodyPrefab, ((Component)val).gameObject); SetupFootstepController(((Component)val).gameObject); SetupRagdoll(((Component)val).gameObject); 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; } if ((Object)(object)characterModel.baseRendererInfos[i].defaultMaterial == (Object)null) { Log.Error($"no material for rendererinfo of this renderer: {characterModel.baseRendererInfos[i].renderer}"); } characterModel.baseRendererInfos[i].defaultMaterial.ConvertDefaultShaderToHopoo(); } } 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(); if (!Object.op_Implicit((Object)(object)component)) { Log.Error("Failed CharacterModel setup: ChildLocator component does not exist on the model"); return; } List list = new List(); 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(); if (Object.op_Implicit((Object)(object)component2)) { Material val = customInfos[i].material; if ((Object)(object)val == (Object)null) { val = ((!customInfos[i].dontHotpoo) ? component2.sharedMaterial.ConvertDefaultShaderToHopoo() : component2.sharedMaterial); } list.Add(new RendererInfo { renderer = component2, defaultMaterial = val, ignoreOverlays = customInfos[i].ignoreOverlays, defaultShadowCastingMode = (ShadowCastingMode)1 }); } } characterModel.baseRendererInfos = list.ToArray(); } private static void SetupHurtboxGroup(GameObject bodyPrefab, GameObject model) { SetupMainHurtboxesFromChildLocator(bodyPrefab, model); SetHurtboxesHealthComponents(bodyPrefab); } private static void SetupMainHurtboxesFromChildLocator(GameObject bodyPrefab, GameObject model) { //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)bodyPrefab.GetComponent() != (Object)null) { Log.Debug("Hitboxgroup already exists on model prefab. aborting code setup"); return; } ChildLocator component = model.GetComponent(); if (!Object.op_Implicit((Object)(object)component.FindChild("MainHurtbox"))) { Log.Error("Could not set up main hurtbox: make sure you have a transform pair in your prefab's ChildLocator called 'MainHurtbox'"); return; } HurtBoxGroup val = model.AddComponent(); HurtBox val2 = null; GameObject val3 = component.FindChildGameObject("HeadHurtbox"); if (Object.op_Implicit((Object)(object)val3)) { Log.Debug("HeadHurtboxFound. Setting up"); val2 = val3.AddComponent(); ((Component)val2).gameObject.layer = LayerIndex.entityPrecise.intVal; val2.healthComponent = bodyPrefab.GetComponent(); val2.isBullseye = false; val2.isSniperTarget = true; val2.damageModifier = (DamageModifier)0; val2.hurtBoxGroup = val; val2.indexInGroup = 1; } HurtBox val4 = component.FindChildGameObject("MainHurtbox").AddComponent(); ((Component)val4).gameObject.layer = LayerIndex.entityPrecise.intVal; val4.healthComponent = bodyPrefab.GetComponent(); val4.isBullseye = true; val4.isSniperTarget = (Object)(object)val2 == (Object)null; val4.damageModifier = (DamageModifier)0; val4.hurtBoxGroup = val; val4.indexInGroup = 0; if (Object.op_Implicit((Object)(object)val2)) { val.hurtBoxes = (HurtBox[])(object)new HurtBox[2] { val4, val2 }; } else { val.hurtBoxes = (HurtBox[])(object)new HurtBox[1] { val4 }; } val.mainHurtBox = val4; val.bullseyeCount = 1; } public static void SetHurtboxesHealthComponents(GameObject bodyPrefab) { HealthComponent component = bodyPrefab.GetComponent(); HurtBoxGroup[] componentsInChildren = bodyPrefab.GetComponentsInChildren(); 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(); val.baseFootstepString = "Play_player_footstep"; val.sprintFootstepOverrideString = ""; val.enableFootstepDust = true; val.footstepDustPrefab = LegacyResourcesAPI.Load("Prefabs/GenericFootstepDust"); } private static void SetupRagdoll(GameObject model) { RagdollController component = model.GetComponent(); if (!Object.op_Implicit((Object)(object)component)) { return; } if ((Object)(object)ragdollMaterial == (Object)null) { ragdollMaterial = ((Component)LegacyResourcesAPI.Load("Prefabs/CharacterBodies/CommandoBody").GetComponentInChildren().bones[1]).GetComponent().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(); if (Object.op_Implicit((Object)(object)component2)) { component2.sharedMaterial = ragdollMaterial; } else { Log.Error($"Ragdoll bone {((Component)val).gameObject} doesn't have a collider. Ragdoll will break."); } } } } private static void SetupAimAnimator(GameObject prefab, GameObject model) { AimAnimator val = model.AddComponent(); val.directionComponent = prefab.GetComponent(); 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(); } public static void CreateGenericDoppelganger(GameObject bodyPrefab, string masterName, string masterToCopy) { CloneDopplegangerMaster(bodyPrefab, masterName, masterToCopy); } public static GameObject CloneDopplegangerMaster(GameObject bodyPrefab, string masterName, string masterToCopy) { GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load("Prefabs/CharacterMasters/" + masterToCopy + "MonsterMaster"), masterName, true); val.GetComponent().bodyPrefab = bodyPrefab; Content.AddMasterPrefab(val); return val; } public static GameObject CreateBlankMasterPrefab(GameObject bodyPrefab, string masterName) { GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load("Prefabs/CharacterMasters/CommandoMonsterMaster"), masterName, true); ContentPacks.masterPrefabs.Add(val); CharacterMaster component = val.GetComponent(); component.bodyPrefab = bodyPrefab; AISkillDriver[] components = val.GetComponents(); for (int i = 0; i < components.Length; i++) { Object.Destroy((Object)(object)components[i]); } return val; } public static GameObject LoadMaster(this AssetBundle assetBundle, GameObject bodyPrefab, string assetName) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) GameObject val = assetBundle.LoadAsset(assetName); BaseAI val2 = val.GetComponent(); if ((Object)(object)val2 == (Object)null) { val2 = val.AddComponent(); val2.aimVectorDampTime = 0.1f; val2.aimVectorMaxSpeed = 360f; } val2.scanState = new SerializableEntityStateType(typeof(Wander)); EntityStateMachine component = val.GetComponent(); if ((Object)(object)component == (Object)null) { AddEntityStateMachine(val, "AI", typeof(Wander), typeof(Wander)); } val2.stateMachine = component; CharacterMaster val3 = val.GetComponent(); if ((Object)(object)val3 == (Object)null) { val3 = val.AddComponent(); } val3.bodyPrefab = bodyPrefab; val3.teamIndex = (TeamIndex)2; Content.AddMasterPrefab(val); return val; } public static void ClearEntityStateMachines(GameObject bodyPrefab) { EntityStateMachine[] components = bodyPrefab.GetComponents(); for (int num = components.Length - 1; num >= 0; num--) { Object.DestroyImmediate((Object)(object)components[num]); } NetworkStateMachine component = bodyPrefab.GetComponent(); component.stateMachines = Array.Empty(); CharacterDeathBehavior component2 = bodyPrefab.GetComponent(); if (Object.op_Implicit((Object)(object)component2)) { component2.idleStateMachine = Array.Empty(); } SetStateOnHurt component3 = bodyPrefab.GetComponent(); if (Object.op_Implicit((Object)(object)component3)) { component3.idleStateMachine = Array.Empty(); } } public static void AddMainEntityStateMachine(GameObject bodyPrefab, string machineName = "Body", Type mainStateType = null, Type initalStateType = null) { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) EntityStateMachine val = EntityStateMachine.FindByCustomName(bodyPrefab, machineName); if ((Object)(object)val == (Object)null) { val = bodyPrefab.AddComponent(); } else { Log.Message("An Entity State Machine already exists with the name " + machineName + ". replacing."); } val.customName = machineName; if (mainStateType == null) { mainStateType = typeof(GenericCharacterMain); } val.mainStateType = new SerializableEntityStateType(mainStateType); if (initalStateType == null) { initalStateType = typeof(SpawnTeleporterState); } val.initialStateType = new SerializableEntityStateType(initalStateType); NetworkStateMachine component = bodyPrefab.GetComponent(); if (Object.op_Implicit((Object)(object)component)) { component.stateMachines = component.stateMachines.Append(val).ToArray(); } CharacterDeathBehavior component2 = bodyPrefab.GetComponent(); if (Object.op_Implicit((Object)(object)component2)) { component2.deathStateMachine = val; } SetStateOnHurt component3 = bodyPrefab.GetComponent(); if (Object.op_Implicit((Object)(object)component3)) { component3.targetStateMachine = val; } } public static void AddEntityStateMachine(GameObject prefab, string machineName, Type mainStateType = null, Type initalStateType = null) { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) EntityStateMachine val = EntityStateMachine.FindByCustomName(prefab, machineName); if ((Object)(object)val == (Object)null) { val = prefab.AddComponent(); } else { Log.Message("An Entity State Machine already exists with the name " + machineName + ". replacing."); } val.customName = machineName; if (mainStateType == null) { mainStateType = typeof(Idle); } val.mainStateType = new SerializableEntityStateType(mainStateType); if (initalStateType == null) { initalStateType = typeof(Idle); } val.initialStateType = new SerializableEntityStateType(initalStateType); NetworkStateMachine component = prefab.GetComponent(); if (Object.op_Implicit((Object)(object)component)) { component.stateMachines = component.stateMachines.Append(val).ToArray(); } CharacterDeathBehavior component2 = prefab.GetComponent(); if (Object.op_Implicit((Object)(object)component2)) { component2.idleStateMachine = component2.idleStateMachine.Append(val).ToArray(); } SetStateOnHurt component3 = prefab.GetComponent(); if (Object.op_Implicit((Object)(object)component3)) { component3.idleStateMachine = component3.idleStateMachine.Append(val).ToArray(); } } public static void SetupHitBoxGroup(GameObject modelPrefab, string hitBoxGroupName, params string[] hitboxChildNames) { ChildLocator component = modelPrefab.GetComponent(); Transform[] array = (Transform[])(object)new Transform[hitboxChildNames.Length]; for (int i = 0; i < hitboxChildNames.Length; i++) { array[i] = component.FindChild(hitboxChildNames[i]); if ((Object)(object)array[i] == (Object)null) { Log.Error("missing hitbox for " + hitboxChildNames[i]); } } SetupHitBoxGroup(modelPrefab, hitBoxGroupName, array); } public static void SetupHitBoxGroup(GameObject prefab, string hitBoxGroupName, params Transform[] hitBoxTransforms) { List list = new List(); foreach (Transform val in hitBoxTransforms) { if ((Object)(object)val == (Object)null) { Log.Error("Error setting up hitboxGroup for " + hitBoxGroupName + ": hitbox transform was null"); continue; } HitBox item = ((Component)val).gameObject.AddComponent(); ((Component)val).gameObject.layer = LayerIndex.projectile.intVal; list.Add(item); } if (list.Count == 0) { Log.Error("No hitboxes were set up. aborting setting up hitboxGroup for " + hitBoxGroupName); return; } HitBoxGroup val2 = prefab.AddComponent(); val2.hitBoxes = list.ToArray(); val2.groupName = hitBoxGroupName; } } internal static class Materials { private static List cachedMaterials = new List(); internal static Shader hotpoo = LegacyResourcesAPI.Load("Shaders/Deferred/HGStandard"); public static List MaterialsWithSwappedShaders { get; } = new List(); internal static void GetMaterial(GameObject model, string childObject, Color color, ref Material material, float scaleMultiplier = 1f, bool replaceAll = false) { //IL_0030: 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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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_006a: Expected O, but got Unknown //IL_0092: Unknown result type (might be due to invalid IL or missing references) Renderer[] componentsInChildren = model.GetComponentsInChildren(); Renderer[] array = componentsInChildren; foreach (Renderer val in array) { Renderer val2 = val; if (string.Equals(((Object)val).name, childObject)) { if (color == Color.clear) { Object.Destroy((Object)(object)val); break; } if ((Object)(object)material == (Object)null) { material = new Material(val.material); material.mainTexture = val.material.mainTexture; material.shader = val.material.shader; material.color = color; } val.material = material; Transform transform = ((Component)val).transform; transform.localScale *= scaleMultiplier; if (!replaceAll) { break; } } } } internal static void DebugMaterial(GameObject model) { Renderer[] componentsInChildren = model.GetComponentsInChildren(); Renderer[] array = componentsInChildren; foreach (Renderer val in array) { Renderer val2 = val; Debug.Log((object)("Material: " + ((Object)val2).name.ToString())); } } public static void SwapShadersFromMaterialsInBundle(AssetBundle bundle) { SwapAllShaders(bundle); } internal static void SwapAllShaders(AssetBundle assetBundle) { Material[] array = assetBundle.LoadAllAssets(); foreach (Material val in array) { Log.Debug("Trying to swap shader for " + ((Object)val).name); TrySwapShader(val); } } internal static void TrySwapShader(Material material) { //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) //IL_0105: Unknown result type (might be due to invalid IL or missing references) string name = ((Object)material.shader).name; if (name.Contains("Stubbed")) { name = name.Replace("Stubbed", string.Empty) + ".shader"; Shader val = Addressables.LoadAssetAsync((object)name).WaitForCompletion(); if ((Object)(object)val != (Object)null) { material.shader = val; } else { Log.Error("Failed to load shader " + name); } } else if (name == "Standard") { Texture texture = material.GetTexture("_BumpMap"); float num = material.GetFloat("_BumpScale"); Texture texture2 = material.GetTexture("_EmissionMap"); material.shader = Resources.Load("Shaders/Deferred/HGStandard"); material.SetTexture("_NormalMap", texture); material.SetFloat("_NormalStrength", num); material.SetTexture("_EmTex", texture2); material.SetColor("_EmColor", new Color(0.2f, 0.2f, 0.2f)); material.SetFloat("_EmPower", 0.15f); } } private static void SwapShader(Material material) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) string text = ((Object)material.shader).name.Substring("Stubbed".Length); string text2 = text + ".shader"; Shader shader = Addressables.LoadAssetAsync((object)text2).WaitForCompletion(); material.shader = shader; MaterialsWithSwappedShaders.Add(material); } public static Material LoadMaterial(this AssetBundle assetBundle, string materialName) { return assetBundle.CreateHopooMaterialFromBundle(materialName); } public static Material CreateHopooMaterialFromBundle(this AssetBundle assetBundle, string materialName) { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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)) { Log.Debug(((Object)val).name + " has already been loaded. returning cached"); return val; } val = assetBundle.LoadAsset(materialName); if (!Object.op_Implicit((Object)(object)val)) { Log.ErrorAssetBundle(materialName, ((Object)assetBundle).name); return new Material(hotpoo); } return val.ConvertDefaultShaderToHopoo(); } public static Material SetHopooMaterial(this Material tempMat) { return tempMat.ConvertDefaultShaderToHopoo(); } public static Material ConvertDefaultShaderToHopoo(this Material tempMat) { //IL_007d: 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)) { Log.Debug(((Object)tempMat).name + " has already been loaded. returning cached"); 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.SetTexture("_EmTex", tempMat.GetTexture("_EmissionMap")); tempMat.EnableKeyword("DITHER"); if (num.HasValue) { tempMat.SetFloat("_NormalStrength", num.Value); tempMat.SetTexture("_NormalTex", tempMat.GetTexture("_BumpMap")); } 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; } public static Material SetSpecular(this Material material, float strength) { material.SetFloat("_SpecularStrength", strength); return material; } public static Material SetSpecular(this Material material, float strength, float exponent) { material.SetFloat("_SpecularStrength", strength); material.SetFloat("SpecularExponent", exponent); return material; } } internal static class Particles { internal static void GetParticle(GameObject model, string childObject, Color color, float sizeMultiplier = 1f, bool replaceAll = false) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002e: 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_004b: 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_0069: 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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) ParticleSystem[] componentsInChildren = model.GetComponentsInChildren(); ParticleSystem[] array = componentsInChildren; foreach (ParticleSystem val in array) { ParticleSystem val2 = val; MainModule main = val2.main; ColorOverLifetimeModule colorOverLifetime = val2.colorOverLifetime; ColorBySpeedModule colorBySpeed = val2.colorBySpeed; if (string.Equals(((Object)val2).name, childObject)) { ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(color); ((MainModule)(ref main)).startSizeMultiplier = ((MainModule)(ref main)).startSizeMultiplier * sizeMultiplier; ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(color); ((ColorBySpeedModule)(ref colorBySpeed)).color = MinMaxGradient.op_Implicit(color); if (!replaceAll) { break; } } } } internal static void DebugParticleSystem(GameObject model) { ParticleSystem[] componentsInChildren = model.GetComponentsInChildren(); ParticleSystem[] array = componentsInChildren; foreach (ParticleSystem val in array) { ParticleSystem val2 = val; Debug.Log((object)("Particle: " + ((Object)val2).name.ToString())); } } } internal class Content { internal static void AddExpansionDef(ExpansionDef expansion) { ContentPacks.expansionDefs.Add(expansion); } internal static void AddCharacterBodyPrefab(GameObject bprefab) { ContentPacks.bodyPrefabs.Add(bprefab); } internal static void AddMasterPrefab(GameObject prefab) { ContentPacks.masterPrefabs.Add(prefab); } internal static void AddProjectilePrefab(GameObject prefab) { ContentPacks.projectilePrefabs.Add(prefab); } internal static void AddSurvivorDef(SurvivorDef survivorDef) { ContentPacks.survivorDefs.Add(survivorDef); } internal static void AddVoidItemRelationship(ItemDef itemToCorrupt, ItemDef itemThatCorrupts) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) ItemRelationshipProvider val = ScriptableObject.CreateInstance(); ((Object)val).name = ((Object)itemThatCorrupts).name + ((Object)itemToCorrupt).name + "Relationship"; val.relationshipType = Addressables.LoadAssetAsync((object)"RoR2/DLC1/Common/ContagiousItem.asset").WaitForCompletion(); val.relationships = (Pair[])(object)new Pair[1] { new Pair { itemDef1 = itemToCorrupt, itemDef2 = itemThatCorrupts } }; ContentPacks.itemRelationships.Add(val); } internal static void AddItemDef(ItemDef itemDef) { ContentPacks.itemDefs.Add(itemDef); } internal static void AddCraftableDef(CraftableDef itemDef) { if (itemDef.recipes.Length != 0) { ContentPacks.craftableDefs.Add(itemDef); } } internal static void AddEliteDef(EliteDef eliteDef) { ContentPacks.eliteDefs.Add(eliteDef); } internal static void AddArtifactDef(ArtifactDef artifactDef) { ContentPacks.artifactDefs.Add(artifactDef); } internal static void AddNetworkedObjectPrefab(GameObject prefab) { ContentPacks.networkedObjectPrefabs.Add(prefab); } internal static void CreateSurvivor(GameObject bodyPrefab, GameObject displayPrefab, Color charColor, string tokenPrefix) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) CreateSurvivor(bodyPrefab, displayPrefab, charColor, tokenPrefix, null, 100f); } internal static void CreateSurvivor(GameObject bodyPrefab, GameObject displayPrefab, Color charColor, string tokenPrefix, float sortPosition) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) CreateSurvivor(bodyPrefab, displayPrefab, charColor, tokenPrefix, null, sortPosition); } internal static void CreateSurvivor(GameObject bodyPrefab, GameObject displayPrefab, Color charColor, string tokenPrefix, UnlockableDef unlockableDef) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) CreateSurvivor(bodyPrefab, displayPrefab, charColor, tokenPrefix, unlockableDef, 100f); } internal static void CreateSurvivor(GameObject bodyPrefab, GameObject displayPrefab, Color charColor, string tokenPrefix, UnlockableDef unlockableDef, float sortPosition) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) SurvivorDef val = ScriptableObject.CreateInstance(); val.bodyPrefab = bodyPrefab; val.displayPrefab = displayPrefab; val.primaryColor = charColor; val.cachedName = ((Object)bodyPrefab).name.Replace("Body", ""); val.displayNameToken = tokenPrefix + "NAME"; val.descriptionToken = tokenPrefix + "DESCRIPTION"; val.outroFlavorToken = tokenPrefix + "OUTRO_FLAVOR"; val.mainEndingEscapeFailureFlavorToken = tokenPrefix + "OUTRO_FAILURE"; val.desiredSortPosition = sortPosition; val.unlockableDef = unlockableDef; AddSurvivorDef(val); } internal static void AddUnlockableDef(UnlockableDef unlockableDef) { ContentPacks.unlockableDefs.Add(unlockableDef); } internal static UnlockableDef CreateAndAddUnlockbleDef(string identifier, string nameToken, Sprite achievementIcon) { UnlockableDef val = ScriptableObject.CreateInstance(); val.cachedName = identifier; val.nameToken = nameToken; val.achievementIcon = achievementIcon; AddUnlockableDef(val); return val; } internal static void AddSkillDef(SkillDef skillDef) { ContentPacks.skillDefs.Add(skillDef); } internal static void AddSkillFamily(SkillFamily skillFamily) { ContentPacks.skillFamilies.Add(skillFamily); } internal static void AddEntityState(Type entityState) { ContentPacks.entityStates.Add(entityState); } internal static void AddBuffDef(BuffDef buffDef) { ContentPacks.buffDefs.Add(buffDef); } internal static BuffDef CreateAndAddBuff(string buffName, Sprite buffIcon, Color buffColor, bool canStack, bool isDebuff, StackingDisplayMethod stackingDisplayMethod = (StackingDisplayMethod)0, bool isHidden = false) { //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) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) BuffDef val = ScriptableObject.CreateInstance(); ((Object)val).name = buffName; val.buffColor = buffColor; val.canStack = canStack; val.isDebuff = isDebuff; val.eliteDef = null; val.iconSprite = buffIcon; val.stackingDisplayMethod = stackingDisplayMethod; val.isHidden = isHidden; AddBuffDef(val); return val; } internal static void AddEffectDef(EffectDef effectDef) { ContentPacks.effectDefs.Add(effectDef); } internal static EffectDef CreateAndAddEffectDef(GameObject effectPrefab) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown EffectDef val = new EffectDef(effectPrefab); AddEffectDef(val); return val; } internal static void AddNetworkSoundEventDef(NetworkSoundEventDef networkSoundEventDef) { ContentPacks.networkSoundEventDefs.Add(networkSoundEventDef); } internal static NetworkSoundEventDef CreateAndAddNetworkSoundEventDef(string eventName) { NetworkSoundEventDef val = ScriptableObject.CreateInstance(); val.akId = AkSoundEngine.GetIDFromString(eventName); val.eventName = eventName; AddNetworkSoundEventDef(val); return val; } } internal static class Skills { public static Dictionary characterSkillLocators = new Dictionary(); public static void CreateSkillFamilies(GameObject targetPrefab) { SkillSlot[] array = new SkillSlot[4]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); CreateSkillFamilies(targetPrefab, (SkillSlot[])(object)array); } public static void CreateSkillFamilies(GameObject targetPrefab, params SkillSlot[] slots) { //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) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected I4, but got Unknown SkillLocator component = targetPrefab.GetComponent(); foreach (SkillSlot val in slots) { SkillSlot val2 = val; switch (val2 - -1) { case 1: component.primary = CreateGenericSkillWithSkillFamily(targetPrefab, "Primary"); break; case 2: component.secondary = CreateGenericSkillWithSkillFamily(targetPrefab, "Secondary"); break; case 3: component.utility = CreateGenericSkillWithSkillFamily(targetPrefab, "Utility"); break; case 4: component.special = CreateGenericSkillWithSkillFamily(targetPrefab, "Special"); break; } } } public static void ClearGenericSkills(GameObject targetPrefab) { GenericSkill[] componentsInChildren = targetPrefab.GetComponentsInChildren(); foreach (GenericSkill val in componentsInChildren) { Object.DestroyImmediate((Object)(object)val); } } public static GenericSkill CreateGenericSkillWithSkillFamily(GameObject targetPrefab, SkillSlot skillSlot, bool hidden = false) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: 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_000b: 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_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected I4, but got Unknown SkillLocator component = targetPrefab.GetComponent(); switch (skillSlot - -1) { case 1: return component.primary = CreateGenericSkillWithSkillFamily(targetPrefab, "Primary", hidden); case 2: return component.secondary = CreateGenericSkillWithSkillFamily(targetPrefab, "Secondary", hidden); case 3: return component.utility = CreateGenericSkillWithSkillFamily(targetPrefab, "Utility", hidden); case 4: return component.special = CreateGenericSkillWithSkillFamily(targetPrefab, "Special", hidden); case 0: Log.Error("Failed to create GenericSkill with skillslot None. If making a GenericSkill outside of the main 4, specify a familyName, and optionally a genericSkillName"); return null; default: return null; } } public static GenericSkill CreateGenericSkillWithSkillFamily(GameObject targetPrefab, string familyName, bool hidden = false) { return CreateGenericSkillWithSkillFamily(targetPrefab, familyName, familyName, hidden); } public static GenericSkill CreateGenericSkillWithSkillFamily(GameObject targetPrefab, string genericSkillName, string familyName, bool hidden = false) { GenericSkill val = targetPrefab.AddComponent(); val.skillName = genericSkillName; val.hideInCharacterSelect = hidden; SkillFamily val2 = ScriptableObject.CreateInstance(); ((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().primary.skillFamily, skillDefs); } public static void AddSecondarySkills(GameObject targetPrefab, params SkillDef[] skillDefs) { AddSkillsToFamily(targetPrefab.GetComponent().secondary.skillFamily, skillDefs); } public static void AddUtilitySkills(GameObject targetPrefab, params SkillDef[] skillDefs) { AddSkillsToFamily(targetPrefab.GetComponent().utility.skillFamily, skillDefs); } public static void AddSpecialSkills(GameObject targetPrefab, params SkillDef[] skillDefs) { AddSkillsToFamily(targetPrefab.GetComponent().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 Combo ComboFromType(Type t) { //IL_0003: 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_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) return new Combo { activationStateType = new SerializableEntityStateType(t) }; } } [AttributeUsage(AttributeTargets.Field, AllowMultiple = false)] public class AutoConfigAttribute : Attribute { public string name; public string desc; public object defaultValue; public AutoConfigAttribute(string name, object defaultValue) { Init(name, string.Empty, defaultValue); } public AutoConfigAttribute(string name, string desc, object defaultValue) { Init(name, desc, defaultValue); } public void Init(string name, string desc, object defaultValue) { this.name = name; this.desc = desc; this.defaultValue = defaultValue; } } public static class Config { public static ConfigFile MyConfig; public static ConfigFile BackupConfig; public static void Init() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown MyConfig = new ConfigFile(Paths.ConfigPath + "\\NewMoon.cfg", true); MyConfig.SaveOnConfigSet = false; BackupConfig = new ConfigFile(Paths.ConfigPath + "\\NewMoon.Backup.cfg", true); BackupConfig.SaveOnConfigSet = false; BackupConfig.Bind(": DO NOT MODIFY THIS FILES CONTENTS :", ": DO NOT MODIFY THIS FILES CONTENTS :", ": DO NOT MODIFY THIS FILES CONTENTS :", ": DO NOT MODIFY THIS FILES CONTENTS :"); } public static void Save() { MyConfig.SaveOnConfigSet = true; MyConfig.Save(); BackupConfig.SaveOnConfigSet = true; BackupConfig.Save(); } public static ConfigEntry CharacterEnableConfig(string section, string characterName, string description = "", bool enabledByDefault = true) { if (string.IsNullOrEmpty(description)) { description = "Set to false to disable this character and as much of its code and content as possible"; } return BindAndOptions(section, "Enable " + characterName, enabledByDefault, description, restartRequired: true); } public static ConfigEntry BindAndOptions(string section, string name, T defaultValue, string description = "", bool restartRequired = false) { return BindAndOptions(section, name, defaultValue, 0f, 20f, description, restartRequired); } public static ConfigEntry BindAndOptions(string section, string name, T defaultValue, float min, float max, string description = "", bool restartRequired = false) { if (string.IsNullOrEmpty(description)) { description = name; } if (restartRequired) { description += " (restart required)"; } ConfigEntry val = MyConfig.Bind(section, name, defaultValue, description); if (Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions")) { TryRegisterOption(val, min, max, restartRequired); } return val; } public static ConfigEntry BindAndOptionsSlider(string section, string name, float defaultValue, string description, float min = 0f, float max = 20f, bool restartRequired = false) { return BindAndOptions(section, name, defaultValue, min, max, description, restartRequired); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static void TryRegisterOption(ConfigEntry entry, float min, float max, bool restartRequired) { } public static bool GetKeyPressed(KeyboardShortcut entry) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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) foreach (KeyCode modifier in ((KeyboardShortcut)(ref entry)).Modifiers) { if (!Input.GetKey(modifier)) { return false; } } return Input.GetKeyDown(((KeyboardShortcut)(ref entry)).MainKey); } } public class ConfigManager { internal static bool ConfigChanged; internal static bool VersionChanged; public static void HandleConfigAttributes(Type type, string section, ConfigFile config) { TypeInfo typeInfo = type.GetTypeInfo(); FieldInfo[] fields = typeInfo.GetFields(); foreach (FieldInfo fieldInfo in fields) { if (fieldInfo.IsStatic) { Type fieldType = fieldInfo.FieldType; AutoConfigAttribute customAttribute = fieldInfo.GetCustomAttribute(); if (customAttribute != null) { string name = customAttribute.name; object defaultValue = customAttribute.defaultValue; string desc = customAttribute.desc; fieldInfo.SetValue(null, DualBindToConfig(fieldType, section, config, name, defaultValue, desc)); } } } } private static object DualBindToConfig(Type t, string section, ConfigFile config, string configName, object defaultValue, string configDesc) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Expected O, but got Unknown //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Expected O, but got Unknown if (string.IsNullOrWhiteSpace(section) || string.IsNullOrWhiteSpace(configName)) { return defaultValue; } ConfigDescription val = new ConfigDescription(configDesc, (AcceptableValueBase)null, Array.Empty()); MethodInfo methodInfo = (from x in typeof(ConfigFile).GetMethods() where x.Name == "Bind" select x).First(); methodInfo = methodInfo.MakeGenericMethod(t); ConfigEntryBase val2 = (ConfigEntryBase)methodInfo.Invoke(config, new object[3] { (object)new ConfigDefinition(section, configName), defaultValue, val }); ConfigEntryBase val3 = (ConfigEntryBase)methodInfo.Invoke(Config.BackupConfig, new object[3] { (object)new ConfigDefinition(Regex.Replace(config.ConfigFilePath, "\\W", "") + " : " + section, configName), defaultValue, val }); if (!ConfigEqual(val3.DefaultValue, val3.BoxedValue)) { bool flag = true; Log.Warning("Syncing config to new version"); val2.BoxedValue = val2.DefaultValue; val3.BoxedValue = val3.DefaultValue; } if (!ConfigEqual(val2.DefaultValue, val2.BoxedValue)) { ConfigChanged = true; } return val2.BoxedValue; } public static T DualBindToConfig(string section, ConfigFile config, string configName, T defaultValue, string configDesc) { return (T)DualBindToConfig(typeof(T), section, config, configName, defaultValue, configDesc); } private static bool ConfigEqual(object a, object b) { if (a.Equals(b)) { return true; } if (float.TryParse(a.ToString(), out var result) && float.TryParse(b.ToString(), out var result2) && (double)Mathf.Abs(result - result2) < 0.0001) { return true; } return false; } } internal class ContentPacks : IContentPackProvider { internal ContentPack contentPack = new ContentPack(); public static List expansionDefs = new List(); public static List bodyPrefabs = new List(); public static List masterPrefabs = new List(); public static List projectilePrefabs = new List(); public static List survivorDefs = new List(); public static List unlockableDefs = new List(); public static List skillFamilies = new List(); public static List skillDefs = new List(); public static List entityStates = new List(); public static List buffDefs = new List(); public static List effectDefs = new List(); public static List itemRelationships = new List(); public static List tierDefs = new List(); public static List craftableDefs = new List(); public static List itemDefs = new List(); public static List eliteDefs = new List(); public static List artifactDefs = new List(); public static List networkSoundEventDefs = new List(); public static List networkedObjectPrefabs = new List(); public string identifier => "com.RiskOfBrainrot.NewMoon"; 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.expansionDefs.Add(expansionDefs.ToArray()); contentPack.bodyPrefabs.Add(bodyPrefabs.ToArray()); contentPack.masterPrefabs.Add(masterPrefabs.ToArray()); contentPack.projectilePrefabs.Add(projectilePrefabs.ToArray()); contentPack.survivorDefs.Add(survivorDefs.ToArray()); contentPack.eliteDefs.Add(eliteDefs.ToArray()); contentPack.itemRelationshipProviders.Add(itemRelationships.ToArray()); contentPack.itemDefs.Add(itemDefs.ToArray()); contentPack.buffDefs.Add(buffDefs.ToArray()); contentPack.artifactDefs.Add(artifactDefs.ToArray()); contentPack.skillDefs.Add(skillDefs.ToArray()); contentPack.skillFamilies.Add(skillFamilies.ToArray()); contentPack.entityStateTypes.Add(entityStates.ToArray()); contentPack.unlockableDefs.Add(unlockableDefs.ToArray()); contentPack.effectDefs.Add(effectDefs.ToArray()); contentPack.networkSoundEventDefs.Add(networkSoundEventDefs.ToArray()); contentPack.networkedObjectPrefabs.Add(networkedObjectPrefabs.ToArray()); contentPack.itemTierDefs.Add(tierDefs.ToArray()); contentPack.craftableDefs.Add(craftableDefs.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; } } public static class EliteModule { public class CustomEliteDef : ScriptableObject { public EliteDef eliteDef; public EliteDef honorEliteDef; public EliteTiers eliteTier; public Color lightColor = Color.clear; public Texture eliteRamp; public Material overlayMaterial; public GameObject spawnEffect; } public enum EliteTiers { Tier1, Tier1AndHalf, Tier2, StormT1, StormT2, Lunar, Other } public static List Elites = new List(); public static Texture defaultShaderRamp = CommonAssets.mainAssetBundle.LoadAsset(CommonAssets.eliteMaterialsPath + "texRampFrenzied.tex"); public static void Init() { RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(AddElites)); } private static void AddElites() { foreach (CustomEliteDef elite in Elites) { switch (elite.eliteTier) { case EliteTiers.Tier1: { ArrayUtils.ArrayAppend(ref EliteAPI.VanillaEliteTiers[1].eliteTypes, ref elite.eliteDef); ref EliteDef[] eliteTypes2 = ref EliteAPI.VanillaEliteTiers[2].eliteTypes; EliteDef val = (((Object)(object)elite.honorEliteDef != (Object)null) ? elite.honorEliteDef : elite.eliteDef); ArrayUtils.ArrayAppend(ref eliteTypes2, ref val); ref EliteDef[] eliteTypes3 = ref EliteAPI.VanillaEliteTiers[3].eliteTypes; val = (((Object)(object)elite.honorEliteDef != (Object)null) ? elite.honorEliteDef : elite.eliteDef); ArrayUtils.ArrayAppend(ref eliteTypes3, ref val); ArrayUtils.ArrayAppend(ref EliteAPI.VanillaEliteTiers[4].eliteTypes, ref elite.eliteDef); break; } case EliteTiers.Tier1AndHalf: { ref EliteDef[] eliteTypes = ref EliteAPI.VanillaEliteTiers[3].eliteTypes; EliteDef val = (((Object)(object)elite.honorEliteDef != (Object)null) ? elite.honorEliteDef : elite.eliteDef); ArrayUtils.ArrayAppend(ref eliteTypes, ref val); ArrayUtils.ArrayAppend(ref EliteAPI.VanillaEliteTiers[4].eliteTypes, ref elite.eliteDef); break; } case EliteTiers.Tier2: ArrayUtils.ArrayAppend(ref EliteAPI.VanillaEliteTiers[5].eliteTypes, ref elite.eliteDef); break; case EliteTiers.Lunar: ArrayUtils.ArrayAppend(ref EliteAPI.VanillaEliteTiers[6].eliteTypes, ref elite.eliteDef); break; } } } } public static class Spawnlists { public static void Init() { SpawnCards.Init(); DirectorCards.Init(); } public static void AddMonsterCardToSpawnlist(DirectorCardCategorySelection categorySelection, DirectorCard directorCard, MonsterCategory monsterCategory) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected I4, but got Unknown categorySelection.AddCard((int)monsterCategory, directorCard); } } public static class SpawnCards { public static bool initialized; public static CharacterSpawnCard AlphaConstruct; public static CharacterSpawnCard Beetle; public static CharacterSpawnCard Lemurian; public static CharacterSpawnCard Larva; public static CharacterSpawnCard Wisp; public static CharacterSpawnCard Jellyfish; public static CharacterSpawnCard BlindPestSnowy; public static CharacterSpawnCard BlindVerminSnowy; public static CharacterSpawnCard Imp; public static CharacterSpawnCard Vulture; public static CharacterSpawnCard Golem; public static CharacterSpawnCard BeetleGuard; public static CharacterSpawnCard Mushrum; public static CharacterSpawnCard Bison; public static CharacterSpawnCard ClayApothecary; public static CharacterSpawnCard ElderLemurian; public static CharacterSpawnCard Parent; public static CharacterSpawnCard Gup; public static CharacterSpawnCard Bronzong; public static CharacterSpawnCard GreaterWisp; public static CharacterSpawnCard TitanBlackBeach; public static CharacterSpawnCard TitanDampCave; public static CharacterSpawnCard TitanGolemPlains; public static CharacterSpawnCard TitanGooLake; public static CharacterSpawnCard Vagrant; public static CharacterSpawnCard BeetleQueen; public static CharacterSpawnCard Dunestrider; public static CharacterSpawnCard MagmaWorm; public static CharacterSpawnCard ImpOverlord; public static CharacterSpawnCard Grovetender; public static CharacterSpawnCard RoboBall; public static CharacterSpawnCard XiConstruct; public static CharacterSpawnCard OverloadingWorm; public static void LoadSpawnCardAsync(string guid, Action callback) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) AssetReferenceT val = new AssetReferenceT(guid); AsyncOperationHandle val2 = AssetAsyncReferenceManager.LoadAsset(val, (AsyncReferenceHandleUnloadType)2); val2.Completed += delegate(AsyncOperationHandle ctx) { CharacterSpawnCard result = ctx.Result; if (callback != null) { callback(result); } }; } public static void Init() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: 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_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0105: 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_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) if (!initialized) { initialized = true; AlphaConstruct = Addressables.LoadAssetAsync((object)RoR2_DLC1_MajorAndMinorConstruct.cscMinorConstruct_asset).WaitForCompletion(); Beetle = LegacyResourcesAPI.Load("spawncards/characterspawncards/cscbeetle"); Lemurian = LegacyResourcesAPI.Load("spawncards/characterspawncards/csclemurian"); Wisp = LegacyResourcesAPI.Load("spawncards/characterspawncards/csclesserwisp"); Jellyfish = LegacyResourcesAPI.Load("spawncards/characterspawncards/cscjellyfish"); Imp = LegacyResourcesAPI.Load("spawncards/characterspawncards/cscimp"); Vulture = LegacyResourcesAPI.Load("spawncards/characterspawncards/cscvulture"); Golem = Addressables.LoadAssetAsync((object)"RoR2/Base/Golem/cscGolem.asset").WaitForCompletion(); BeetleGuard = LegacyResourcesAPI.Load("spawncards/characterspawncards/cscbeetleguard"); Mushrum = LegacyResourcesAPI.Load("spawncards/characterspawncards/cscminimushroom"); Bison = Addressables.LoadAssetAsync((object)"RoR2/Base/Bison/cscBison.asset").WaitForCompletion(); ElderLemurian = Addressables.LoadAssetAsync((object)"RoR2/Base/LemurianBruiser/cscLemurianBruiser.asset").WaitForCompletion(); Parent = Addressables.LoadAssetAsync((object)"RoR2/Base/Parent/cscParent.asset").WaitForCompletion(); Gup = Addressables.LoadAssetAsync((object)"RoR2/DLC1/Gup/cscGupBody.asset").WaitForCompletion(); Bronzong = LegacyResourcesAPI.Load("spawncards/characterspawncards/cscbell"); GreaterWisp = LegacyResourcesAPI.Load("spawncards/characterspawncards/cscgreaterwisp"); TitanBlackBeach = LegacyResourcesAPI.Load("spawncards/characterspawncards/csctitanblackbeach"); TitanDampCave = LegacyResourcesAPI.Load("spawncards/characterspawncards/csctitandampcave"); TitanGolemPlains = LegacyResourcesAPI.Load("spawncards/characterspawncards/csctitangolemplains"); TitanGooLake = LegacyResourcesAPI.Load("spawncards/characterspawncards/csctitangoolake"); Vagrant = LegacyResourcesAPI.Load("spawncards/characterspawncards/cscvagrant"); BeetleQueen = LegacyResourcesAPI.Load("spawncards/characterspawncards/cscbeetlequeen"); Dunestrider = LegacyResourcesAPI.Load("spawncards/characterspawncards/cscclayboss"); MagmaWorm = LegacyResourcesAPI.Load("spawncards/characterspawncards/cscmagmaworm"); ImpOverlord = LegacyResourcesAPI.Load("spawncards/characterspawncards/cscimpboss"); Grovetender = LegacyResourcesAPI.Load("spawncards/characterspawncards/cscgravekeeper"); RoboBall = LegacyResourcesAPI.Load("spawncards/characterspawncards/cscroboballboss"); OverloadingWorm = LegacyResourcesAPI.Load("spawncards/characterspawncards/cscelectricworm"); BlindVerminSnowy = Addressables.LoadAssetAsync((object)"RoR2/DLC1/Vermin/cscVerminSnowy.asset").WaitForCompletion(); BlindPestSnowy = Addressables.LoadAssetAsync((object)"RoR2/DLC1/FlyingVermin/cscFlyingVerminSnowy.asset").WaitForCompletion(); ClayApothecary = Addressables.LoadAssetAsync((object)"RoR2/DLC1/ClayGrenadier/cscClayGrenadier.asset").WaitForCompletion(); Larva = Addressables.LoadAssetAsync((object)"RoR2/DLC1/AcidLarva/cscAcidLarva.asset").WaitForCompletion(); XiConstruct = Addressables.LoadAssetAsync((object)"RoR2/DLC1/MajorAndMinorConstruct/cscMegaConstruct.asset").WaitForCompletion(); } } } public static class DirectorCards { public static bool initialized; public static DirectorCard AlphaConstruct; public static DirectorCard AlphaConstructNear; public static DirectorCard Beetle; public static DirectorCard Lemurian; public static DirectorCard Larva; public static DirectorCard Wisp; public static DirectorCard Jellyfish; public static DirectorCard BlindPestSnowy; public static DirectorCard BlindVerminSnowy; public static DirectorCard Imp; public static DirectorCard Vulture; public static DirectorCard Golem; public static DirectorCard BeetleGuard; public static DirectorCard Mushrum; public static DirectorCard ClayApothecary; public static DirectorCard Bison; public static DirectorCard BisonLoop; public static DirectorCard ElderLemurian; public static DirectorCard Parent; public static DirectorCard Gup; public static DirectorCard Bronzong; public static DirectorCard GreaterWisp; public static DirectorCard TitanBlackBeach; public static DirectorCard TitanDampCave; public static DirectorCard TitanGolemPlains; public static DirectorCard TitanGooLake; public static DirectorCard Vagrant; public static DirectorCard BeetleQueen; public static DirectorCard Dunestrider; public static DirectorCard MagmaWorm; public static DirectorCard ImpOverlord; public static DirectorCard Grovetender; public static DirectorCard RoboBall; public static DirectorCard OverloadingWorm; public static DirectorCard XiConstruct; public static DirectorCard LunarGolemSkyMeadow; public static DirectorCard LunarGolemSkyMeadowBasic; public static bool logCardInfo; public static void Init() { if (!initialized) { initialized = true; AlphaConstruct = BuildDirectorCard(SpawnCards.AlphaConstruct, 1, 1, (MonsterSpawnDistance)0); AlphaConstructNear = BuildDirectorCard(SpawnCards.AlphaConstruct, 1, 1, (MonsterSpawnDistance)1); Beetle = BuildDirectorCard(SpawnCards.Beetle); Lemurian = BuildDirectorCard(SpawnCards.Lemurian); Larva = BuildDirectorCard(SpawnCards.Larva); Wisp = BuildDirectorCard(SpawnCards.Wisp); Jellyfish = BuildDirectorCard(SpawnCards.Jellyfish, 1, 0, (MonsterSpawnDistance)2); BlindPestSnowy = BuildDirectorCard(SpawnCards.BlindPestSnowy); BlindVerminSnowy = BuildDirectorCard(SpawnCards.BlindVerminSnowy); Imp = BuildDirectorCard(SpawnCards.Imp); Vulture = BuildDirectorCard(SpawnCards.Vulture, 1, 3, (MonsterSpawnDistance)0); Golem = BuildDirectorCard(SpawnCards.Golem); BeetleGuard = BuildDirectorCard(SpawnCards.BeetleGuard); Mushrum = BuildDirectorCard(SpawnCards.Mushrum); ClayApothecary = BuildDirectorCard(SpawnCards.ClayApothecary); Bison = BuildDirectorCard(SpawnCards.Bison, 1, 2, (MonsterSpawnDistance)0); Bronzong = BuildDirectorCard(SpawnCards.Bronzong); GreaterWisp = BuildDirectorCard(SpawnCards.GreaterWisp); ElderLemurian = BuildDirectorCard(SpawnCards.ElderLemurian, 1, 3, (MonsterSpawnDistance)0); Parent = BuildDirectorCard(SpawnCards.Parent, 1, 3, (MonsterSpawnDistance)0); Gup = BuildDirectorCard(SpawnCards.Gup, 1, 3, (MonsterSpawnDistance)0); TitanBlackBeach = BuildDirectorCard(SpawnCards.TitanBlackBeach); TitanDampCave = BuildDirectorCard(SpawnCards.TitanDampCave); TitanGolemPlains = BuildDirectorCard(SpawnCards.TitanGolemPlains); TitanGooLake = BuildDirectorCard(SpawnCards.TitanGooLake); Vagrant = BuildDirectorCard(SpawnCards.Vagrant); BeetleQueen = BuildDirectorCard(SpawnCards.BeetleQueen); Dunestrider = BuildDirectorCard(SpawnCards.Dunestrider); ImpOverlord = BuildDirectorCard(SpawnCards.ImpOverlord, 1, 1, (MonsterSpawnDistance)0); Grovetender = BuildDirectorCard(SpawnCards.Grovetender); RoboBall = BuildDirectorCard(SpawnCards.RoboBall, 1, 3, (MonsterSpawnDistance)0); MagmaWorm = BuildDirectorCard(SpawnCards.MagmaWorm, 1, 2, (MonsterSpawnDistance)0); OverloadingWorm = BuildDirectorCard(SpawnCards.OverloadingWorm); XiConstruct = BuildDirectorCard(SpawnCards.XiConstruct, 1, 2, (MonsterSpawnDistance)0); } } public static DirectorCard BuildDirectorCard(CharacterSpawnCard spawnCard) { return BuildDirectorCard(spawnCard, 1, 0, (MonsterSpawnDistance)0); } public static DirectorCard BuildDirectorCard(CharacterSpawnCard spawnCard, int weight, int minStages, MonsterSpawnDistance spawnDistance) { //IL_0001: 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) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown return new DirectorCard { spawnCard = (SpawnCard)(object)spawnCard, selectionWeight = weight, preventOverhead = false, minimumStageCompletions = minStages, spawnDistance = spawnDistance }; } public static DirectorCard BuildDirectorCard(InteractableSpawnCard spawnCard, int weight, int minStages) { //IL_0001: 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) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_0023: Expected O, but got Unknown return new DirectorCard { spawnCard = (SpawnCard)(object)spawnCard, selectionWeight = weight, preventOverhead = false, minimumStageCompletions = minStages }; } } public static class Hooks { public static void Init() { } } internal static class ItemDisplayCheck { public static List allDisplayedItems; public static void PrintUnused(ItemDisplayRuleSet itemDisplayRuleSet, string bodyName = "") { PrintUnused((IEnumerable)itemDisplayRuleSet.keyAssetRuleGroups.ToList(), bodyName); } public static void PrintUnused(IEnumerable ruleSet = null, string bodyName = "") { //IL_0048: 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_0050: 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_0069: 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_0085: Unknown result type (might be due to invalid IL or missing references) string text = "generating item displays for " + bodyName; if (allDisplayedItems == null) { LazyGatherAllItems(); } List list = new List(allDisplayedItems); string text2 = ""; if (ruleSet != null) { foreach (KeyAssetRuleGroup item in ruleSet) { if (item.displayRuleGroup.rules.Length != 0) { list.Remove(item.keyAsset); if (string.IsNullOrEmpty(text2)) { text2 = item.displayRuleGroup.rules[0].childName; } } } } if (string.IsNullOrEmpty(text2)) { text2 = "Chest"; } foreach (Object item2 in list) { string text3 = ""; if (ItemDisplays.KeyAssetDisplayPrefabs.ContainsKey(item2)) { text3 += SpitOutNewRule(item2, text2, ItemDisplays.KeyAssetDisplayPrefabs[item2]); } else { Log.Error($"COULD NOT FIND DISPLAY PREFABS FOR KEYASSET {item2}"); } text += text3; } Log.Message(text); } private static void LazyGatherAllItems() { allDisplayedItems = new List(ItemDisplays.KeyAssetDisplayPrefabs.Keys); allDisplayedItems.Sort(delegate(Object item1, Object item2) { if (item1 is ItemDef && item2 is ItemDef) { return item1.name.CompareTo(item2.name); } if (item1 is EquipmentDef && item2 is EquipmentDef) { return item1.name.CompareTo(item2.name); } if (item1 is ItemDef && item2 is EquipmentDef) { return -1; } return (item1 is EquipmentDef && item2 is ItemDef) ? 1 : 0; }); } private static string SpitOutNewRule(Object asset, string firstCompatibleChild, ItemDisplayRule[] displayRules) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Invalid comparison between Unknown and I4 //IL_00a5: Unknown result type (might be due to invalid IL or missing references) if (displayRules.Length == 0) { return $"\n[NO DISPLAY RULES FOUND FOR THE KEYASSET {asset}"; } string text = "\n itemDisplayRules.Add(ItemDisplays.CreateDisplayRuleGroupWithRules(ItemDisplays.KeyAssets[\"" + asset.name + "\"]"; for (int i = 0; i < displayRules.Length; i++) { text = (((int)displayRules[i].limbMask != 0) ? (text + ",\n" + $" ItemDisplays.CreateLimbMaskDisplayRule(LimbFlags.{displayRules[i].limbMask})") : (text + ",\n ItemDisplays.CreateDisplayRule(ItemDisplays.LoadDisplay(\"" + ((Object)displayRules[i].followerPrefab).name + "\"),\n \"" + firstCompatibleChild + "\",\n new Vector3(2, 2, 2),\n new Vector3(0, 0, 0),\n new Vector3(1, 1, 1)\n )")); } return text + "\n ));"; } } internal static class ItemDisplays { private static Dictionary itemDisplayPrefabs = new Dictionary(); public static Dictionary KeyAssetDisplayPrefabs = new Dictionary(); public static Dictionary KeyAssets = new Dictionary(); public static int queuedDisplays; public static bool initialized = false; public static void LazyInit() { if (!initialized) { initialized = true; PopulateDisplays(); } } internal static void DisposeWhenDone() { queuedDisplays--; if (queuedDisplays <= 0 && initialized) { initialized = false; itemDisplayPrefabs = null; KeyAssetDisplayPrefabs = null; KeyAssets = null; } } internal static void PopulateDisplays() { PopulateFromBody("LoaderBody"); } private static void PopulateFromBody(string bodyName) { ItemDisplayRuleSet itemDisplayRuleSet = ((Component)LegacyResourcesAPI.Load("Prefabs/CharacterBodies/" + bodyName).GetComponent().modelTransform).GetComponent().itemDisplayRuleSet; KeyAssetRuleGroup[] keyAssetRuleGroups = itemDisplayRuleSet.keyAssetRuleGroups; for (int i = 0; i < keyAssetRuleGroups.Length; i++) { ItemDisplayRule[] rules = keyAssetRuleGroups[i].displayRuleGroup.rules; KeyAssetDisplayPrefabs[keyAssetRuleGroups[i].keyAsset] = rules; KeyAssets[keyAssetRuleGroups[i].keyAsset.name] = keyAssetRuleGroups[i].keyAsset; 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(); 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; } public static KeyAssetRuleGroup CreateDisplayRuleGroupWithRules(string itemName, params ItemDisplayRule[] rules) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) return CreateDisplayRuleGroupWithRules(GetKeyAssetFromString(itemName), rules); } public static KeyAssetRuleGroup CreateDisplayRuleGroupWithRules(Object keyAsset_, params ItemDisplayRule[] rules) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_002b: 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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0040: 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) if (keyAsset_ == (Object)null) { Log.Error("could not find keyasset"); } return new KeyAssetRuleGroup { keyAsset = keyAsset_, displayRuleGroup = new DisplayRuleGroup { rules = rules } }; } public static ItemDisplayRule CreateDisplayRule(string prefabName, string childName, Vector3 position, Vector3 rotation, Vector3 scale) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: 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) return CreateDisplayRule(LoadDisplay(prefabName), childName, position, rotation, scale); } public static ItemDisplayRule CreateDisplayRule(GameObject itemPrefab, string childName, Vector3 position, Vector3 rotation, Vector3 scale) { //IL_0003: 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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002b: 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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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_0046: Unknown result type (might be due to invalid IL or missing references) return new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, childName = childName, followerPrefab = itemPrefab, limbMask = (LimbFlags)0, localPos = position, localAngles = rotation, localScale = scale }; } public static ItemDisplayRule CreateLimbMaskDisplayRule(LimbFlags limb) { //IL_0003: 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_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: 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) return new ItemDisplayRule { ruleType = (ItemDisplayRuleType)1, limbMask = limb, childName = "", followerPrefab = null }; } private static Object GetKeyAssetFromString(string itemName) { Object val = (Object)(object)LegacyResourcesAPI.Load("ItemDefs/" + itemName); if (val == (Object)null) { val = (Object)(object)LegacyResourcesAPI.Load("EquipmentDefs/" + itemName); } if (val == (Object)null) { Log.Error("Could not load keyasset for " + itemName); } return val; } } internal static class Language { public static class Styling { public static string MithrixStyle(string text) { return "" + text + ""; } public static string ConvertDecimal(float value) { return value * 100f + "%"; } public static string DamageColor(string text) { return "" + text + ""; } public static string HealingColor(string text) { return "" + text + ""; } public static string DamageValueText(float value) { return DamageColor(value.AsPercent() + " damage"); } public static string UtilityColor(string text) { return "" + text + ""; } public static string RedText(string text) { return HealthColor(text); } public static string HealthColor(string text) { return "" + text + ""; } public static string KeywordText(string keyword, string sub) { return "" + keyword + "" + sub + ""; } public static string ScepterDescription(string desc) { return "\nSCEPTER: " + desc + ""; } public static string VoidColor(string text) { return "" + text + ""; } public static string StackText(string text) { return StackColor("(" + text + " per stack)"); } public static string StackColor(string text) { return "" + text + ""; } public static string GetAchievementNameToken(string identifier) { return "ACHIEVEMENT_" + identifier.ToUpperInvariant() + "_NAME"; } public static string GetAchievementDescriptionToken(string identifier) { return "ACHIEVEMENT_" + identifier.ToUpperInvariant() + "_DESCRIPTION"; } public static string NumToAdj(int num) { return num switch { 1 => num + "st", 2 => num + "nd", 3 => num + "rd", _ => num + "th", }; } } public static string TokensOutput = ""; public static bool usingLanguageFolder = false; public static bool printingEnabled = false; public static void Init() { if (usingLanguageFolder) { Language.collectLanguageRootFolders += Language_collectLanguageRootFolders; } } private static void Language_collectLanguageRootFolders(List obj) { string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)NewMoonPlugin.instance).Info.Location), "Language"); if (Directory.Exists(text)) { obj.Add(text); } } public static void Add(string token, string text) { if (!usingLanguageFolder) { LanguageAPI.Add(token, text); } if (printingEnabled) { TokensOutput = TokensOutput + "\n \"" + token + "\" : \"" + text.Replace(Environment.NewLine, "\\n").Replace("\n", "\\n") + "\","; } } public static void TryPrintOutput(string fileName = "") { if (usingLanguageFolder && printingEnabled) { PrintOutput(fileName); } } public static void PrintOutput(string fileName = "") { if (printingEnabled) { string text = "{\n strings:\n {" + TokensOutput + "\n }\n}"; Log.Message(fileName + ": \n" + text); if (!string.IsNullOrEmpty(fileName)) { string path = Path.Combine(Directory.GetParent(((BaseUnityPlugin)NewMoonPlugin.instance).Info.Location).FullName, "Language", "en", fileName); File.WriteAllText(path, text); } TokensOutput = ""; } } } 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 = new SkinDefInfo { BaseSkins = Array.Empty(), GameObjectActivations = (GameObjectActivation[])(object)new GameObjectActivation[0], Icon = skinIcon, MeshReplacements = (MeshReplacement[])(object)new MeshReplacement[0], MinionSkinReplacements = (MinionSkinReplacement[])(object)new MinionSkinReplacement[0], Name = skinName, NameToken = skinName, ProjectileGhostReplacements = (ProjectileGhostReplacement[])(object)new ProjectileGhostReplacement[0], RendererInfos = (RendererInfo[])(object)new RendererInfo[defaultRendererInfos.Length], RootObject = root, UnlockableDef = unlockableDef }; SkinDef.Awake += new hook_Awake(DoNothing); SkinDef val = ScriptableObject.CreateInstance(); val.baseSkins = skinDefInfo.BaseSkins; val.icon = skinDefInfo.Icon; val.unlockableDef = skinDefInfo.UnlockableDef; val.rootObject = skinDefInfo.RootObject; defaultRendererInfos.CopyTo(skinDefInfo.RendererInfos, 0); val.rendererInfos = skinDefInfo.RendererInfos; val.gameObjectActivations = skinDefInfo.GameObjectActivations; val.meshReplacements = skinDefInfo.MeshReplacements; val.projectileGhostReplacements = skinDefInfo.ProjectileGhostReplacements; val.minionSkinReplacements = skinDefInfo.MinionSkinReplacements; val.nameToken = skinDefInfo.NameToken; ((Object)val).name = skinDefInfo.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(AssetBundle assetBundle, RendererInfo[] defaultRendererInfos, params string[] meshes) { //IL_001d: 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) List list = new List(); for (int i = 0; i < defaultRendererInfos.Length; i++) { if (!string.IsNullOrEmpty(meshes[i])) { list.Add(new MeshReplacement { renderer = defaultRendererInfos[i].renderer, mesh = assetBundle.LoadAsset(meshes[i]) }); } } return list.ToArray(); } } } namespace NewMoon.Modules.BaseStates { public abstract class BaseMeleeAttack : BaseSkillState, IStepSetter { public int swingIndex; protected string hitboxGroupName = "SwordGroup"; 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 attackStartPercentTime = 0.2f; protected float attackEndPercentTime = 0.4f; protected float earlyExitPercentTime = 0.4f; protected float hitStopDuration = 0.012f; protected float attackRecoil = 0.75f; protected float hitHopVelocity = 4f; protected string swingSoundString = ""; protected string hitSoundString = ""; protected string muzzleString = "SwingCenter"; protected string playbackRateParam = "Slash.playbackRate"; protected GameObject swingEffectPrefab; protected GameObject hitEffectPrefab; protected NetworkSoundEventIndex impactSound = (NetworkSoundEventIndex)(-1); 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown //IL_0054: 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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: 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_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) ((BaseState)this).OnEnter(); duration = baseDuration / ((BaseState)this).attackSpeedStat; animator = ((EntityState)this).GetModelAnimator(); ((BaseState)this).StartAimMode(0.5f + duration, false); PlayAttackAnimation(); attack = new OverlapAttack(); attack.damageType = DamageTypeCombo.op_Implicit(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 = ((BaseState)this).FindHitBoxGroup(hitboxGroupName); attack.isCrit = ((BaseState)this).RollCrit(); attack.impactSound = impactSound; } protected virtual void PlayAttackAnimation() { ((EntityState)this).PlayCrossfade("Gesture, Override", "Slash" + (1 + swingIndex), playbackRateParam, duration, 0.05f); } public override void OnExit() { if (inHitPause) { RemoveHitstop(); } ((EntityState)this).OnExit(); } protected virtual void PlaySwingEffect() { EffectManager.SimpleMuzzleFlash(swingEffectPrefab, ((EntityState)this).gameObject, muzzleString, false); } protected virtual void OnHitEnemyAuthority() { 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; } ApplyHitstop(); } protected void ApplyHitstop() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) if (!inHitPause && hitStopDuration > 0f) { storedVelocity = ((EntityState)this).characterMotor.velocity; hitStopCachedState = ((BaseState)this).CreateHitStopCachedState(((EntityState)this).characterMotor, animator, playbackRateParam); hitPauseTimer = hitStopDuration / ((BaseState)this).attackSpeedStat; inHitPause = true; } } private void FireAttack() { if (((EntityState)this).isAuthority && attack.Fire((List)null)) { OnHitEnemyAuthority(); } } private void EnterAttack() { hasFired = true; Util.PlayAttackSpeedSound(swingSoundString, ((EntityState)this).gameObject, ((BaseState)this).attackSpeedStat); PlaySwingEffect(); if (((EntityState)this).isAuthority) { ((BaseState)this).AddRecoil(-1f * attackRecoil, -2f * attackRecoil, -0.5f * attackRecoil, 0.5f * attackRecoil); } } public override void FixedUpdate() { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) ((EntityState)this).FixedUpdate(); hitPauseTimer -= Time.fixedDeltaTime; if (hitPauseTimer <= 0f && inHitPause) { RemoveHitstop(); } 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(playbackRateParam, 0f); } } bool flag = stopwatch >= duration * attackStartPercentTime; bool flag2 = stopwatch >= duration * attackEndPercentTime; if ((flag && !flag2) || (flag && flag2 && !hasFired)) { if (!hasFired) { EnterAttack(); } FireAttack(); } if (stopwatch >= duration && ((EntityState)this).isAuthority) { ((EntityState)this).outer.SetNextStateToMain(); } } private void RemoveHitstop() { //IL_0003: 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_002d: Unknown result type (might be due to invalid IL or missing references) ((BaseState)this).ConsumeHitStopCachedState(hitStopCachedState, ((EntityState)this).characterMotor, animator); inHitPause = false; ((EntityState)this).characterMotor.velocity = storedVelocity; } public override InterruptPriority GetMinimumInterruptPriority() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) if (stopwatch >= duration * earlyExitPercentTime) { return (InterruptPriority)0; } 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 void SetStep(int i) { swingIndex = i; } } public class BaseTimedSkillState : BaseSkillState { public float TimedBaseDuration; public float TimedBaseCastStartTime; public float TimedBaseCastEndTime; protected float duration; protected float castStartPercentTime; protected float castEndPercentTime; protected bool hasFired; protected bool isFiring; protected bool hasExited; protected virtual void InitDurationValues(float baseDuration, float castStartPercentTime, float castEndPercentTime = 1f) { TimedBaseDuration = baseDuration; TimedBaseCastStartTime = castStartPercentTime; TimedBaseCastEndTime = castEndPercentTime; duration = TimedBaseDuration / ((BaseState)this).attackSpeedStat; this.castStartPercentTime = castStartPercentTime * duration; this.castEndPercentTime = castEndPercentTime * 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 > castStartPercentTime) { hasFired = true; OnCastEnter(); } bool flag = ((EntityState)this).fixedAge >= castStartPercentTime; bool flag2 = ((EntityState)this).fixedAge >= castEndPercentTime; 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 NewMoon.Modules.Achievements { public abstract class BaseMasteryAchievement : BaseAchievement { public abstract string RequiredCharacterBody { get; } public abstract float RequiredDifficultyCoefficient { get; } 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 override void OnBodyRequirementMet() { ((BaseAchievement)this).OnBodyRequirementMet(); Run.onClientGameOverGlobal += OnClientGameOverGlobal; } public override void OnBodyRequirementBroken() { Run.onClientGameOverGlobal -= OnClientGameOverGlobal; ((BaseAchievement)this).OnBodyRequirementBroken(); } private void OnClientGameOverGlobal(Run run, RunReport runReport) { //IL_002f: 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_0035: 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_0079: Invalid comparison between Unknown and I4 //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Invalid comparison between Unknown and I4 if (!Object.op_Implicit((Object)(object)runReport.gameEnding) || !runReport.gameEnding.isWin) { return; } DifficultyIndex val = runReport.ruleBook.FindDifficulty(); DifficultyDef difficultyDef = DifficultyCatalog.GetDifficultyDef(val); if (difficultyDef != null) { bool flag = difficultyDef.countsAsHardMode && difficultyDef.scalingValue >= RequiredDifficultyCoefficient; bool flag2 = difficultyDef.nameToken == "INFERNO_NAME"; bool flag3 = (int)val >= 3 && (int)val <= 10; if (flag || flag2 || flag3) { ((BaseAchievement)this).Grant(); } } } } } namespace NewMoon.Items { public abstract class ItemBase : ItemBase where T : ItemBase { public static T instance { get; private set; } public ItemBase() { if (instance != null) { throw new InvalidOperationException("Singleton class \"" + typeof(T).Name + "\" inheriting ItemBoilerplate/Item was instantiated twice"); } instance = this as T; } } public abstract class ItemBase : SharedBase { public static Dictionary DefDictionary = new Dictionary(); public ItemDef ItemsDef; public override AssetBundle assetBundle => NewMoonPlugin.mainAssetBundle; public override string ConfigName => "Items : " + ItemName; public abstract string ItemName { get; } public abstract string ItemLangTokenName { get; } public abstract string ItemPickupDesc { get; } public abstract string ItemFullDescription { get; } public abstract string ItemLore { get; } public abstract ItemTier Tier { get; } public abstract ItemTag[] ItemTags { get; } public abstract GameObject ItemModel { get; } public abstract Sprite ItemIcon { get; } public virtual bool CanRemove { get; } = false; public virtual bool IsHidden { get; } = false; public virtual ExpansionDef RequiredExpansion { get; } = null; public virtual bool CanBeTemporary { get; } = true; public override void Init() { CreateItem(); base.Init(); } internal static bool CheckDLC1Entitlement() { //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) EntitlementDef expansion = Addressables.LoadAssetAsync((object)"RoR2/DLC1/Common/entitlementDLC1.asset").WaitForCompletion(); return CheckDLCEntitlement(expansion); } internal static bool CheckDLCEntitlement(EntitlementDef expansion) { if (EntitlementAbstractions.VerifyLocalSteamUser(expansion)) { return true; } return false; } internal static void CloneVanillaDisplayRules(Object newDef, Object vanillaDef) { Debug.LogError((object)"Unable to clone vanilla display rules!"); } public override void Lang() { DoLangForItem(ItemsDef, ItemName, ItemPickupDesc, ItemFullDescription, ItemLore); } public abstract ItemDisplayRuleDict CreateItemDisplayRules(); protected void CreateItem() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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_0087: Expected O, but got Unknown string text = ((object)Tier/*cast due to .constrained prefix*/).ToString(); if (!text.Contains("Tier")) { text += "Tier"; } ItemsDef = CreateNewItem(ItemLangTokenName, ItemModel, ItemIcon, Tier, ItemTags, RequiredExpansion, IsHidden); ItemDisplayRuleDict val = CreateItemDisplayRules(); if (val == null) { val = new ItemDisplayRuleDict(Array.Empty()); } } public static ItemDef CreateNewItem(string langTokenName, GameObject modelPrefab, Sprite iconSprite, ItemTier tier, ItemTag[] itemTags = null, ExpansionDef requiredExpansion = null, bool isHidden = false, bool canBeTemporary = true) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) ItemDef val = CreateNewUntieredItem(langTokenName, iconSprite, tier, itemTags, isHidden); val.pickupModelPrefab = modelPrefab; val.requiredExpansion = requiredExpansion; return val; } public static ItemDef CreateNewUntieredItem(string langTokenName, Sprite iconSprite, ItemTier tier = (ItemTier)5, ItemTag[] itemTags = null, bool isHidden = false, bool canBeTemporary = true) { //IL_0079: 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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) ItemDef val = ScriptableObject.CreateInstance(); ((Object)val).name = "ITEM_" + langTokenName; val.nameToken = "ITEM_" + langTokenName + "_NAME"; val.pickupToken = "ITEM_" + langTokenName + "_PICKUP"; val.descriptionToken = "ITEM_" + langTokenName + "_DESCRIPTION"; val.loreToken = "ITEM_" + langTokenName + "_LORE"; val.pickupIconSprite = iconSprite; val.tier = tier; val.deprecatedTier = tier; val.hidden = isHidden; if (itemTags != null && itemTags.Length != 0) { val.tags = itemTags; if (canBeTemporary) { int num = val.tags.Length; ref ItemTag[] tags = ref val.tags; ItemTag val2 = (ItemTag)31; ArrayUtils.ArrayAppend(ref tags, ref num, ref val2); } } Content.AddItemDef(val); return val; } public void AddVoidItemRelationship(string itemToCorruptGuid) { AddVoidItemRelationship(itemToCorruptGuid, ItemsDef); } public static void AddVoidItemRelationship(string itemToCorruptGuid, ItemDef itemThatCorrupts) { NewMoonPlugin.LoadAsync(itemToCorruptGuid, (Action)delegate(ItemDef itemToCorrupt) { Content.AddVoidItemRelationship(itemToCorrupt, itemThatCorrupts); }); } public void AddVoidItemRelationship(ItemDef itemToCorrupt) { AddVoidItemRelationship(itemToCorrupt, ItemsDef); } public static void AddVoidItemRelationship(ItemDef itemToCorrupt, ItemDef itemThatCorrupts) { Content.AddVoidItemRelationship(itemToCorrupt, itemThatCorrupts); } public static void DoLangForItem(ItemDef itemDef, string name, string pickupDesc, string fullDesc = "", string lore = "") { LanguageAPI.Add(itemDef.nameToken, name); LanguageAPI.Add(itemDef.pickupToken, pickupDesc); LanguageAPI.Add(itemDef.descriptionToken, string.IsNullOrWhiteSpace(fullDesc) ? pickupDesc : fullDesc); LanguageAPI.Add(itemDef.loreToken, lore); } public int GetCount(CharacterBody body, bool permanentOnly = false) { if ((Object)(object)body == (Object)null) { return 0; } return GetCount(body.inventory, permanentOnly); } public int GetCount(Inventory inventory, bool permanentOnly = false) { if ((Object)(object)inventory == (Object)null) { return 0; } if (permanentOnly) { return inventory.GetItemCountPermanent(ItemsDef); } return inventory.GetItemCountEffective(ItemsDef); } public int GetCount(CharacterMaster master, bool permanentOnly = false) { if ((Object)(object)master == (Object)null) { return 0; } return GetCount(master.inventory, permanentOnly); } public int GetCountSpecific(CharacterBody body, ItemDef itemIndex) { if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.inventory)) { return 0; } return body.inventory.GetItemCountEffective(itemIndex); } public static float GetStackValue(float baseValue, float stackValue, int itemCount) { return baseValue + stackValue * (float)(itemCount - 1); } public static GameObject LoadDropPrefab(string prefabName = "", AssetBundle bundle = null) { return NewMoonPlugin.TryLoadFromBundle("Assets/Models/DropPrefabs/Item/" + prefabName + ".prefab", bundle).FixItemModel(); } public static GameObject LoadDisplayPrefab(string prefabName = "", AssetBundle bundle = null) { return NewMoonPlugin.TryLoadFromBundle("Assets/Models/DisplayPrefabs/Item/" + prefabName + ".prefab", bundle) ?? Resources.Load("prefabs/NullModel"); } public static Sprite LoadItemIcon(string spriteName = "", AssetBundle bundle = null, bool fallBackOnWrench = false) { return NewMoonPlugin.TryLoadSpriteFromBundle("Assets/Textures/Icons/Item/" + spriteName + ".png", bundle, fallBackOnWrench); } } internal class BloodAnomaly : ItemBase { [AutoConfig("Heal Fraction On Kill Base", 0.08f)] public static float healFractionOnKillBase = 0.08f; [AutoConfig("Heal Fraction On Kill Stack", 0.08f)] public static float healFractionOnKillStack = 0.08f; [AutoConfig("On-Kill Force Triggers Base", 4)] public static int onKillForceTriggersBase = 4; [AutoConfig("On-Kill Force Triggers Stack", 2)] public static int onKillForceTriggersStack = 2; public static GameObject radiusIndicatorPrefab; [AutoConfig("Life Steal Radius Base", 16f)] public static float lifeStealRadiusBase = 16f; [AutoConfig("Life Steal Radius Stack", 0)] public static float lifeStealRadiusStack = 0f; [AutoConfig("Life Steal Fraction Base", 0.05f)] public static float lifeStealAmountBase = 0.05f; [AutoConfig("Life Steal Fraction Stack", 0.025f)] public static float lifeStealAmountStack = 0.025f; [AutoConfig("Bleed Chance Base", 10f)] public static float bleedChanceBase = 10f; [AutoConfig("Bleed Chance Stack", 0f)] public static float bleedChanceStack = 0f; [AutoConfig("Bleed Damage Life Steal Multiplier", 0.5f)] public static float bleedEffectiveProcCoeff = 0.5f; public static BuffDef hiddenForceTriggerCount; public override bool forcePrerequisites => true; public override string ConfigName => "Items : Commencement : Relic of Blood"; public override string ItemName => "Relic of Blood"; public override string ItemLangTokenName => "BLOODANOMALY"; public override string ItemPickupDesc => "Gain life steal against nearby enemies. Bleeding enemies heal you for more."; public override string ItemFullDescription => Language.Styling.DamageColor(bleedChanceBase + "%") + " chance to " + Language.Styling.DamageColor("bleed") + " an enemy. " + Language.Styling.HealingColor("Heal") + " for " + Language.Styling.HealingColor(lifeStealAmountBase.AsPercent()) + " " + Language.Styling.StackText(lifeStealAmountStack.AsPercent()) + " of " + Language.Styling.DamageColor("total damage") + " dealt against enemies within " + Language.Styling.DamageColor($"{lifeStealRadiusBase}m") + ". Damage dealt by " + Language.Styling.DamageColor("bleed status") + " heals for " + Language.Styling.DamageColor("+" + bleedEffectiveProcCoeff.AsPercent()) + " more."; public override string ItemLore => ""; public override ItemTier Tier => (ItemTier)3; public override GameObject ItemModel => ItemBase.LoadDropPrefab("PickupBloodAnomaly"); public override Sprite ItemIcon => ItemBase.LoadItemIcon("texIconBloodAnomaly"); public override ItemTag[] ItemTags { get { ItemTag[] array = new ItemTag[6]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); return (ItemTag[])(object)array; } } public override bool GetPrerequisites() { return NewMoonPlugin.DoPillarItemDrop; } public override ItemDisplayRuleDict CreateItemDisplayRules() { return null; } public override void Init() { //IL_0007: 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) hiddenForceTriggerCount = Content.CreateAndAddBuff("bdHiddenRelicForceTriggerCount", null, Color.black, canStack: true, isDebuff: false, (StackingDisplayMethod)0); hiddenForceTriggerCount.isHidden = true; NewMoonPlugin.LoadAsync(RoR2_Base_NearbyDamageBonus.NearbyDamageBonusIndicator_prefab, (Action)CreateRangeIndicator); base.Init(); ItemAPI.ApplyTagToItem(NewMoonPlugin.IsMoonRelic, ItemsDef); } private void CreateRangeIndicator(GameObject obj) { //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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) radiusIndicatorPrefab = PrefabAPI.InstantiateClone(obj, "BloodAnomalyRangeIndicator", true); Transform child = radiusIndicatorPrefab.transform.GetChild(1); if (Object.op_Implicit((Object)(object)child)) { ((Component)child).transform.localScale = Vector3.one * lifeStealRadiusBase * 2f; MeshRenderer val = default(MeshRenderer); if (((Component)child).gameObject.TryGetComponent(ref val)) { Material val2 = Object.Instantiate(((Renderer)val).material); val2.SetColor("_TintColor", Color32.op_Implicit(new Color32(byte.MaxValue, (byte)168, (byte)36, (byte)139))); ((Renderer)val).material = val2; } } Content.AddNetworkedObjectPrefab(radiusIndicatorPrefab); } public override void PostInit() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) base.PostInit(); CraftableDef val = ScriptableObject.CreateInstance(); ((Object)val).name = "CRAFTABLE_" + ItemLangTokenName; val.pickup = (Object)(object)ItemsDef; val.itemIndex = ItemsDef.itemIndex; List list = new List(); Extensions.TryLoadAndAddIngredient(list, RoR2_Base_RepeatHeal.RepeatHeal_asset, "relic of blood - corpsebloom"); Extensions.TryLoadAndAddIngredient(list, RoR2_Base_GoldOnHit.GoldOnHit_asset, "relic of blood - brittle crown"); Extensions.TryLoadAndAddIngredient(list, RoR2_Base_ShieldOnly.ShieldOnly_asset, "relic of blood - transcendence"); Extensions.TryLoadAndAddIngredient(list, RoR2_Base_LunarPotion.LunarPotion_asset, "relic of blood - spinel tonic"); Extensions.TryLoadAndAddIngredient(list, RoR2_Base_Syringe.Syringe_asset, "relic of blood - soldiers syringe"); Extensions.TryLoadAndAddIngredient(list, RoR2_Base_BleedOnHit.BleedOnHit_asset, "relic of blood - tritip dagger"); Extensions.TryLoadAndAddIngredient(list, RoR2_Base_CritGlasses.CritGlasses_asset, "relic of blood - lensmakers glasses"); Extensions.TryLoadAndAddIngredient(list, RoR2_Base_HealOnCrit.HealOnCrit_asset, "relic of blood - harvesters scythe"); Extensions.TryLoadAndAddIngredient(list, RoR2_Base_AttackSpeedOnCrit.AttackSpeedOnCrit_asset, "relic of blood - predatory instincts"); Extensions.TryLoadAndAddIngredient(list, RoR2_Base_Thorns.Thorns_asset, "relic of blood - razorwire"); Extensions.TryLoadAndAddIngredient(list, RoR2_Base_Infusion.Infusion_asset, "relic of blood - infusion"); Extensions.TryLoadAndAddIngredient(list, RoR2_DLC1_StrengthenBurn.StrengthenBurn_asset, "relic of blood - ignition tank"); Extensions.TryLoadAndAddIngredient(list, RoR2_DLC2_Items_TriggerEnemyDebuffs.TriggerEnemyDebuffs_asset, "relic of blood - noxious thorn"); Extensions.TryLoadAndAddIngredient(list, RoR2_Base_Saw.Saw_asset, "relic of blood - sawmeranng"); Extensions.TryLoadAndAddIngredient(list, RoR2_Base_LifestealOnHit.LifestealOnHit_asset, "relic of blood - super massive leech"); Extensions.AddAllRecipePermutations(val, list.ToArray(), CraftingUtils.VanillaBossKeys); Content.AddCraftableDef(val); } public override void Hooks() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown GlobalEventManager.onServerDamageDealt += BloodRelicLifeSteal; RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(BloodRelicBleed); } private void BloodRelicBleed(CharacterBody sender, StatHookEventArgs args) { int count = GetCount(sender); if (count > 0) { args.bleedChanceAdd += ItemBase.GetStackValue(bleedChanceBase, bleedChanceStack, count); } } private void BloodRelicLifeSteal(DamageReport damageReport) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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_00e4: Expected O, but got Unknown //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) CharacterBody attackerBody = damageReport.attackerBody; CharacterBody victimBody = damageReport.victimBody; DamageInfo damageInfo = damageReport.damageInfo; if ((Object)(object)attackerBody == (Object)null || (Object)(object)victimBody == (Object)null || damageInfo == null) { return; } float num = (((int)damageInfo.dotIndex == 0) ? bleedEffectiveProcCoeff : damageInfo.procCoefficient); if (num <= 0f) { return; } int count = GetCount(attackerBody); if (count > 0) { Vector3 val = attackerBody.corePosition - victimBody.corePosition; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; float num2 = Mathf.Pow(ItemBase.GetStackValue(lifeStealRadiusBase, lifeStealRadiusStack, count), 2f); if (!(sqrMagnitude > num2)) { float stackValue = ItemBase.GetStackValue(lifeStealAmountBase, lifeStealAmountStack, count); HealOrb val2 = new HealOrb(); val2.healValue = damageInfo.damage * stackValue * num; ((Orb)val2).origin = damageInfo.position; ((Orb)val2).target = attackerBody.mainHurtBox; val2.overrideDuration = 0.1f; OrbManager.instance.AddOrb((Orb)(object)val2); } } } private void BloodRelicNearbyLifeSteal(CharacterBody attackerBody, DamageInfo damageInfo, CharacterBody victimBody) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_0077: 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) int count = GetCount(attackerBody); if (count > 0) { Vector3 val = attackerBody.corePosition - victimBody.corePosition; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; float stackValue = ItemBase.GetStackValue(lifeStealRadiusBase, lifeStealRadiusStack, count); if (!(sqrMagnitude > stackValue)) { float stackValue2 = ItemBase.GetStackValue(lifeStealAmountBase, lifeStealAmountStack, count); HealOrb val2 = new HealOrb(); val2.healValue = stackValue2; ((Orb)val2).origin = damageInfo.position; ((Orb)val2).target = attackerBody.mainHurtBox; val2.overrideDuration = 0.1f; OrbManager.instance.AddOrb((Orb)(object)val2); } } } private void BloodRelicOnDamageDealt(DamageReport damageReport) { //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) DamageInfo damageInfo = damageReport.damageInfo; if (!NetworkServer.active) { return; } GameObject attacker = damageInfo.attacker; if (!Object.op_Implicit((Object)(object)attacker)) { return; } CharacterBody victimBody = damageReport.victimBody; CharacterBody val = default(CharacterBody); if (!attacker.TryGetComponent(ref val) || !Object.op_Implicit((Object)(object)victimBody) || !victimBody.isChampion) { return; } int count = GetCount(val); int num = (Object.op_Implicit((Object)(object)val.teamComponent) ? count : Util.GetItemCountForTeam(val.teamComponent.teamIndex, ItemsDef.itemIndex, false, false)); int buffCount = victimBody.GetBuffCount(hiddenForceTriggerCount); if (num <= 0) { return; } int num2 = onKillForceTriggersBase + onKillForceTriggersStack * (num - 1); float num3 = 1f / ((float)num2 + 1f); float num4 = num3 * (float)(buffCount + 1); HealthComponent healthComponent = victimBody.healthComponent; if (healthComponent.combinedHealthFraction <= 1f - num4) { victimBody.AddBuff(hiddenForceTriggerCount); List attackers = (from master in CharacterMaster.instancesList select master.GetBody() into body where Object.op_Implicit((Object)(object)body) && (int)body.teamComponent.teamIndex == 1 && GetCount(body) > 0 select body).ToList(); MakeFakeDeath(healthComponent, damageInfo, attackers); } } private void BloodRelicOnKill(DamageReport damageReport) { //IL_0047: 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) CharacterBody attackerBody = damageReport.attackerBody; if ((Object)(object)attackerBody != (Object)null) { int count = GetCount(attackerBody); if (count > 0) { float num = Util.ConvertAmplificationPercentageIntoReductionNormalized(healFractionOnKillBase + healFractionOnKillStack * (float)(count - 1)); attackerBody.healthComponent.HealFraction(num, default(ProcChainMask)); } } } private void MakeFakeDeath(HealthComponent self, DamageInfo damageInfo, List attackers) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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_0078: Expected O, but got Unknown //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown foreach (CharacterBody attacker in attackers) { DamageInfo val = new DamageInfo { attacker = (((Object)(object)attacker != (Object)null) ? ((Component)attacker).gameObject : null), crit = false, damage = damageInfo.damage, position = damageInfo.position, procCoefficient = damageInfo.procCoefficient, damageType = damageInfo.damageType, damageColorIndex = damageInfo.damageColorIndex }; DamageReport val2 = new DamageReport(val, self, damageInfo.damage, self.combinedHealth); GlobalEventManager.instance.OnCharacterDeath(val2); } } } public class BloodAnomalyBehavior : BaseItemBodyBehavior { private GameObject nearbyDamageBonusIndicator; private bool indicatorEnabled { get { return Object.op_Implicit((Object)(object)nearbyDamageBonusIndicator); } set { //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) if (indicatorEnabled != value) { if (value) { nearbyDamageBonusIndicator = Object.Instantiate(BloodAnomaly.radiusIndicatorPrefab, ((BaseItemBodyBehavior)this).body.corePosition, Quaternion.identity); nearbyDamageBonusIndicator.GetComponent().AttachToGameObjectAndSpawn(((Component)this).gameObject, (string)null); } else { Object.Destroy((Object)(object)nearbyDamageBonusIndicator); nearbyDamageBonusIndicator = null; } } } } [ItemDefAssociation(useOnServer = true, useOnClient = false)] private static ItemDef GetItemDef() { return ItemBase.instance?.ItemsDef ?? null; } private void OnEnable() { indicatorEnabled = true; } private void OnDisable() { indicatorEnabled = false; } } internal class DesignAnomaly : ItemBase { public static BuffDef HoverChargeBuff; public static BuffDef HoverActiveBuff; public static float rechargeDelay = 2f; public static int rechargePerFrameBase = 1; public static int rechargePerFrameStack = 1; public static int maxHoverChargeBase = 60; public static int maxHoverChargeStack = 30; public static float movementSpeedWhileHoveringBase = 2f; public static float movementSpeedWhileHoveringStack = 0.5f; public override bool forcePrerequisites => true; public override string ConfigName => "Items : Commencement : Relic of Design"; public override string ItemName => "Relic of Design"; public override string ItemLangTokenName => "DESIGNANOMALY"; public override string ItemPickupDesc => "Double jump. Hold JUMP while falling to hover."; public override string ItemFullDescription => "Gain an additional air jump. While airborne, holding JUMP allows you to float in the air with " + Language.Styling.UtilityColor("+" + movementSpeedWhileHoveringBase.AsPercent()) + " movement speed " + Language.Styling.StackText("+" + movementSpeedWhileHoveringStack.AsPercent()) + " for up to " + Language.Styling.UtilityColor(((float)maxHoverChargeBase / 60f).ToString()) + " seconds " + Language.Styling.StackText("+" + (float)maxHoverChargeStack / 60f) + ". " + Language.Styling.StackColor("(Recharges " + ((float)rechargePerFrameStack / (float)rechargePerFrameBase).AsPercent() + " faster per stack)"); public override string ItemLore => ""; public override ItemTier Tier => (ItemTier)3; public override GameObject ItemModel => ItemBase.LoadDropPrefab("PickupDesignAnomaly"); public override Sprite ItemIcon => ItemBase.LoadItemIcon("texIconDesignAnomaly"); public override ItemTag[] ItemTags { get { ItemTag[] array = new ItemTag[4]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); return (ItemTag[])(object)array; } } public override bool GetPrerequisites() { return NewMoonPlugin.DoPillarItemDrop; } public override ItemDisplayRuleDict CreateItemDisplayRules() { return null; } public override void Init() { //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) //IL_001d: 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_003f: 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_0066: Unknown result type (might be due to invalid IL or missing references) HoverChargeBuff = Content.CreateAndAddBuff("bdDesignHoverCharge", Addressables.LoadAssetAsync((object)RoR2_Base_Common.bdOnFire_asset).WaitForCompletion().iconSprite, Color.grey, canStack: true, isDebuff: false, (StackingDisplayMethod)1); HoverActiveBuff = Content.CreateAndAddBuff("bdDesignHoverActive", Addressables.LoadAssetAsync((object)RoR2_Base_Common.bdOnFire_asset).WaitForCompletion().iconSprite, Color.grey, canStack: false, isDebuff: false, (StackingDisplayMethod)1); base.Init(); ItemAPI.ApplyTagToItem(NewMoonPlugin.IsMoonRelic, ItemsDef); } public override void PostInit() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) base.PostInit(); CraftableDef val = ScriptableObject.CreateInstance(); ((Object)val).name = "CRAFTABLE_" + ItemLangTokenName; val.pickup = (Object)(object)ItemsDef; val.itemIndex = ItemsDef.itemIndex; List list = new List(); Extensions.TryLoadAndAddIngredient(list, RoR2_Base_MonstersOnShrineUse.MonstersOnShrineUse_asset, "relic of design - defiant gouge"); Extensions.TryLoadAndAddIngredient(list, RoR2_Base_RandomDamageZone.RandomDamageZone_asset, "relic of design - mercurial rachis"); Extensions.TryLoadAndAddIngredient(list, RoR2_Base_FocusConvergence.FocusConvergence_asset, "relic of design - focused convergence"); Extensions.TryLoadAndAddIngredient(list, RoR2_Base_LunarPotion.LunarPotion_asset, "relic of design - spinel tonic"); Extensions.TryLoadAndAddIngredient(list, RoR2_Base_Hoof.Hoof_asset, "relic of design - goat hood"); Extensions.TryLoadAndAddIngredient(list, RoR2_Base_Mushroom.Mushroom_asset, "relic of design - bustling fungus"); Extensions.TryLoadAndAddIngredient(list, RoR2_Base_SprintBonus.SprintBonus_asset, "relic of design - energy drink"); Extensions.TryLoadAndAddIngredient(list, RoR2_DLC2_Items_SpeedBoostPickup.SpeedBoostPickup_asset, "relic of design - elusive antlers"); Extensions.TryLoadAndAddIngredient(list, RoR2_Base_Feather.Feather_asset, "relic of design - hopoo feather"); Extensions.TryLoadAndAddIngredient(list, RoR2_Base_SprintOutOfCombat.SprintOutOfCombat_asset, "relic of design - red whip"); Extensions.TryLoadAndAddIngredient(list, RoR2_Base_JumpBoost.JumpBoost_asset, "relic of design - wax quail"); Extensions.TryLoadAndAddIngredient(list, RoR2_DLC2_Items_KnockBackHitEnemies.KnockBackHitEnemies_asset, "relic of design - breaching fin"); Extensions.TryLoadAndAddIngredient(list, RoR2_DLC3_Items_JumpDamageStrike.JumpDamageStrike_asset, "relic of design - faraday spur"); Extensions.TryLoadAndAddIngredient(list, RoR2_Base_Jetpack.Jetpack_asset, "relic of design - milky chrysalis"); Extensions.TryLoadAndAddIngredient(list, RoR2_Base_FireBallDash.FireBallDash_asset, "relic of design - volcanic egg"); Extensions.TryLoadAndAddIngredient(list, RoR2_Base_TeamWarCry.TeamWarCry_asset, "relic of design - gorags opus"); Extensions.AddAllRecipePermutations(val, list.ToArray(), CraftingUtils.VanillaBossKeys); Content.AddCraftableDef(val); } public override void Hooks() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown GenericCharacterMain.FixedUpdate += new hook_FixedUpdate(Hover); RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(HoverMoveSpeed); } private void HoverMoveSpeed(CharacterBody sender, StatHookEventArgs args) { int count = GetCount(sender); if (count > 0) { args.jumpCountAdd++; if (sender.HasBuff(HoverActiveBuff)) { args.moveSpeedMultAdd += movementSpeedWhileHoveringBase + movementSpeedWhileHoveringStack * (float)(count - 1); } } } private void Hover(orig_FixedUpdate orig, GenericCharacterMain self) { //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); if (!((BaseCharacterMain)self).hasCharacterMotor || !((BaseCharacterMain)self).hasInputBank || !((EntityState)self).isAuthority) { return; } CharacterBody characterBody = ((EntityState)self).characterBody; CharacterMotor characterMotor = ((EntityState)self).characterMotor; if (!Object.op_Implicit((Object)(object)characterBody)) { return; } bool flag = ((EntityState)self).inputBank.jump.down && !((EntityState)self).characterMotor.isGrounded; if (flag && characterBody.HasBuff(HoverChargeBuff)) { float y = characterMotor.velocity.y; if (y <= float.Epsilon) { y = Mathf.MoveTowards(y, 0f, JetpackOn.hoverAcceleration * ((EntityState)self).GetDeltaTime() * 2f); characterMotor.velocity = new Vector3(characterMotor.velocity.x, Mathf.Min(y, 0f), characterMotor.velocity.z); characterBody.RemoveBuff(HoverChargeBuff); if (!characterBody.HasBuff(HoverChargeBuff)) { UpdateJetpackDownState(characterBody, isDown: false); } else if (!characterBody.HasBuff(HoverActiveBuff)) { UpdateJetpackDownState(characterBody, isDown: true); } } } if (flag != ((EntityState)self).inputBank.jump.wasDown) { UpdateJetpackDownState(characterBody, flag); } } private static void UpdateJetpackDownState(CharacterBody body, bool isDown) { DesignAnomalyBehavior designAnomalyBehavior = default(DesignAnomalyBehavior); if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.inventory) && body.inventory.GetItemCountEffective(ItemBase.instance.ItemsDef) > 0 && ((Component)body).TryGetComponent(ref designAnomalyBehavior)) { designAnomalyBehavior.UpdateInputState(isDown); } } } public class DesignAnomalyBehavior : BaseItemBodyBehavior { public bool isHoverButtonHeld = false; private float rechargeDelayCountdown = 0f; [ItemDefAssociation(useOnServer = true, useOnClient = false)] private static ItemDef GetItemDef() { return ItemBase.instance?.ItemsDef ?? null; } public void UpdateInputState(bool isDown) { isHoverButtonHeld = isDown; if (isDown && IsFalling(((BaseItemBodyBehavior)this).body)) { if (!((BaseItemBodyBehavior)this).body.HasBuff(DesignAnomaly.HoverActiveBuff)) { ((BaseItemBodyBehavior)this).body.AddBuff(DesignAnomaly.HoverActiveBuff); } } else if (((BaseItemBodyBehavior)this).body.HasBuff(DesignAnomaly.HoverActiveBuff)) { ((BaseItemBodyBehavior)this).body.RemoveBuff(DesignAnomaly.HoverActiveBuff); } } private static bool IsFalling(CharacterBody body) { return body.characterMotor.velocity.y <= 0.2f && !body.characterMotor.isGrounded; } private void FixedUpdate() { if (isHoverButtonHeld && IsFalling(((BaseItemBodyBehavior)this).body)) { rechargeDelayCountdown = DesignAnomaly.rechargeDelay; return; } if (rechargeDelayCountdown > 0f) { rechargeDelayCountdown -= Time.fixedDeltaTime; return; } int num = DesignAnomaly.rechargePerFrameBase + DesignAnomaly.rechargePerFrameStack * (base.stack - 1); int num2 = DesignAnomaly.maxHoverChargeBase + DesignAnomaly.maxHoverChargeStack * (base.stack - 1); for (int i = 0; i < num; i++) { if (((BaseItemBodyBehavior)this).body.GetBuffCount(DesignAnomaly.HoverChargeBuff) >= num2) { break; } ((BaseItemBodyBehavior)this).body.AddBuff(DesignAnomaly.HoverChargeBuff); } } private void OnEnable() { int num = DesignAnomaly.maxHoverChargeBase + DesignAnomaly.maxHoverChargeStack * (base.stack - 1); for (int i = ((BaseItemBodyBehavior)this).body.GetBuffCount(DesignAnomaly.HoverChargeBuff); i < num; i++) { ((BaseItemBodyBehavior)this).body.AddBuff(DesignAnomaly.HoverChargeBuff); } } private void OnDisable() { for (int num = ((BaseItemBodyBehavior)this).body.GetBuffCount(DesignAnomaly.HoverChargeBuff); num == 0; num--) { ((BaseItemBodyBehavior)this).body.RemoveBuff(DesignAnomaly.HoverChargeBuff); } } } internal class MassAnomaly : ItemBase { public static BuffDef beetleArmor; public static int maxBeetleArmorStacks = 3; public static int durationPerBeetleArmor = 3; public static int armorPerBuffBase = 50; public static int armorPerBuffStack = 25; public static float retaliateCrippleDuration = 9f; public override bool forcePrerequisites => true; public override string ConfigName => "Items : Commencement : Relic of Mass"; public override string ItemName => "Relic of Mass"; public override string ItemLangTokenName => "MASSANOMALY"; public override string ItemPickupDesc => "Periodically gain protection from damage."; public override string ItemFullDescription => "After not taking damage for " + Language.Styling.UtilityColor($"{durationPerBeetleArmor}") + " seconds, gain a layer of " + Language.Styling.DamageColor("Chimera Armor") + ", up to " + Language.Styling.UtilityColor($"{maxBeetleArmorStacks}") + " times. Each layer of " + Language.Styling.DamageColor("Chimera Armor") + " increases " + Language.Styling.HealingColor("armor") + " by " + Language.Styling.HealingColor($"{armorPerBuffBase}") + " " + Language.Styling.StackText("+" + armorPerBuffStack) + ". Taking damage while protected strips 1 layer of " + Language.Styling.DamageColor("Chimera Armor") + ", " + string.Format("{0} the enemy who attacked you for {1}s.", Language.Styling.DamageColor("Crippling"), retaliateCrippleDuration); public override string ItemLore => ""; public override ItemTier Tier => (ItemTier)3; public override GameObject ItemModel => ItemBase.LoadDropPrefab("PickupMassAnomaly"); public override Sprite ItemIcon => ItemBase.LoadItemIcon("texIconMassAnomaly"); public override ItemTag[] ItemTags { get { ItemTag[] array = new ItemTag[4]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); return (ItemTag[])(object)array; } } public override bool GetPrerequisites() { return NewMoonPlugin.DoPillarItemDrop; } public override ItemDisplayRuleDict CreateItemDisplayRules() { return null; } public override void Init() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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) base.Init(); beetleArmor = Content.CreateAndAddBuff("bdAnomalyArmor", Addressables.LoadAssetAsync((object)"RoR2/Base/LunarSkillReplacements/texBuffLunarDetonatorIcon.tif").WaitForCompletion(), Color.cyan, canStack: true, isDebuff: false, (StackingDisplayMethod)0); ItemAPI.ApplyTagToItem(NewMoonPlugin.IsMoonRelic, ItemsDef); } public override void PostInit() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) base.PostInit(); CraftableDef val = ScriptableObject.CreateInstance(); ((Object)val).name = "CRAFTABLE_" + ItemLangTokenName; val.pickup = (Object)(object)ItemsDef; val.itemIndex = ItemsDef.itemIndex; List list = new List(); Extensions.TryLoadAndAddIngredient(list, RoR2_Base_AutoCastEquipment.AutoCastEquipment_asset, "relic of mass - gesture of the drowned"); Extensions.TryLoadAndAddIngredient(list, RoR2_DLC3_Items_TransferDebuffOnHit.TransferDebuffOnHit_asset, "relic of mass - neutronium weight"); Extensions.TryLoadAndAddIngredient(list, RoR2_Base_LunarTrinket.LunarTrinket_asset, "relic of mass - beads of fealty"); Extensions.TryLoadAndAddIngredient(list, RoR2_DLC1_HalfSpeedDoubleHealth.HalfSpeedDoubleHealth_asset, "relic of mass - stone flux pauldron"); Extensions.TryLoadAndAddIngredient(list, RoR2_Base_Meteor.Meteor_asset, "relic of mass - glowing meteorite"); Extensions.TryLoadAndAddIngredient(list, RoR2_Base_PersonalShield.PersonalShield_asset, "relic of mass - psg"); Extensions.TryLoadAndAddIngredient(list, RoR2_Base_WardOnLevel.WardOnLevel_asset, "relic of mass - warbanner"); Extensions.TryLoadAndAddIngredient(list, RoR2_Base_FlatHealth.FlatHealth_asset, "relic of mass - meat"); Extensions.TryLoadAndAddIngredient(list, RoR2_DLC1_OutOfCombatArmor.OutOfCombatArmor_asset, "relic of mass - opal"); Extensions.TryLoadAndAddIngredient(list, RoR2_Base_ArmorPlate.ArmorPlate_asset, "relic of mass - armor plating"); Extensions.TryLoadAndAddIngredient(list, RoR2_DLC2_Items_DelayedDamage.DelayedDamage_asset, "relic of mass - warped echo"); Extensions.TryLoadAndAddIngredient(list, RoR2_Base_SlowOnHit.SlowOnHit_asset, "relic of mass - chronobauble"); Extensions.TryLoadAndAddIngredient(list, RoR2_DLC2_Items_ExtraShrineItem.ExtraShrineItem_asset, "relic of mass - chance doll"); Extensions.TryLoadAndAddIngredient(list, RoR2_Base_GainArmor.GainArmor_asset, "relic of mass - jade elephant"); Extensions.TryLoadAndAddIngredient(list, RoR2_Base_Blackhole.Blackhole_asset, "relic of mass - primordial cube"); Extensions.TryLoadAndAddIngredient(list, RoR2_DLC1_GummyClone.GummyClone_asset, "relic of mass - goobo jr"); Extensions.AddAllRecipePermutations(val, list.ToArray(), CraftingUtils.VanillaBossKeys); Content.AddCraftableDef(val); } public override void Hooks() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(ArmorBoost); } private void ArmorBoost(CharacterBody sender, StatHookEventArgs args) { int count = GetCount(sender); int buffCount = sender.GetBuffCount(beetleArmor); if (count > 0 && buffCount > 0) { int num = armorPerBuffBase + armorPerBuffStack * (count - 1); args.armorAdd += (float)(num * buffCount); } } } public class MassAnomalyBehavior : BaseItemBodyBehavior { private float beetleArmorStopwatch; private float beetleArmorInterval => MassAnomaly.durationPerBeetleArmor; [ItemDefAssociation(useOnServer = true, useOnClient = false)] private static ItemDef GetItemDef() { return ItemBase.instance.ItemsDef; } private void OnBeetleProtectionGained() { GlobalEventManager.onServerDamageDealt += OnServerDamageDealt; } private void OnBeetleProtectionCleared() { GlobalEventManager.onServerDamageDealt -= OnServerDamageDealt; } private void OnServerDamageDealt(DamageReport damageReport) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)damageReport.victimBody != (Object)(object)((BaseItemBodyBehavior)this).body || (Object)(object)damageReport.attackerBody == (Object)(object)((BaseItemBodyBehavior)this).body || damageReport.damageInfo.procCoefficient == 0f || ((Enum)damageReport.damageInfo.damageType.damageType).HasFlag((Enum)(object)(DamageType)2048)) { return; } int buffCount = ((BaseItemBodyBehavior)this).body.GetBuffCount(MassAnomaly.beetleArmor); if (buffCount > 0) { ((BaseItemBodyBehavior)this).body.RemoveBuff(MassAnomaly.beetleArmor); if (Object.op_Implicit((Object)(object)damageReport.attackerBody)) { damageReport.attackerBody.AddTimedBuff(Buffs.Cripple, MassAnomaly.retaliateCrippleDuration); } } if (buffCount <= 1) { OnBeetleProtectionCleared(); } } private void FixedUpdate() { if (!NetworkServer.active) { return; } int buffCount = ((BaseItemBodyBehavior)this).body.GetBuffCount(MassAnomaly.beetleArmor); if (buffCount >= MassAnomaly.maxBeetleArmorStacks) { beetleArmorStopwatch = beetleArmorInterval; return; } beetleArmorStopwatch -= Time.fixedDeltaTime; if (beetleArmorStopwatch <= 0f) { beetleArmorStopwatch += beetleArmorInterval; ((BaseItemBodyBehavior)this).body.AddBuff(MassAnomaly.beetleArmor); if (buffCount == 0) { OnBeetleProtectionGained(); } } } private void OnDisable() { if (!NetworkServer.active) { return; } int num = ((BaseItemBodyBehavior)this).body.GetBuffCount(MassAnomaly.beetleArmor); if (num > 0) { while (num > 0) { num--; ((BaseItemBodyBehavior)this).body.RemoveBuff(MassAnomaly.beetleArmor); } OnBeetleProtectionCleared(); } } } internal class SoulAnomaly : ItemBase { [AutoConfig("Base Movement Speed Multiplier", 0.2f)] public static float baseMoveSpeedAdd = 0.2f; [AutoConfig("Max Bonus Movement Speed Multiplier", 1.3f)] public static float maxMoveMultAdd = 1.3f; [AutoConfig("Max Bonus Attack Speed Multiplier", 1.3f)] public static float maxAttackMultAdd = 1.3f; public static float procChanceMin = 5f; public static float procChanceBase = 3f; public static float procChanceStack = 3f; public static float soulProjectileDamageCoefficient = 6f; public static ModdedProcType soulProjectileProcType; public static GameObject soulProjectile; public static BuffDef spiritBuff; public override bool forcePrerequisites => true; public override string ConfigName => "Items : Commencement : Relic of Soul"; public override string ItemName => "Relic of Soul"; public override string ItemLangTokenName => "SOULANOMALY"; public override string ItemPickupDesc => "Fire a soul projectile that triggers on-kill effects."; public override string ItemFullDescription => Language.Styling.DamageColor(procChanceMin + "%") + " chance on hit to release a screaming soul as a projectile, dealing " + Language.Styling.DamageColor(soulProjectileDamageCoefficient.AsPercent() + " BASE damage") + " and " + Language.Styling.UtilityColor("force-triggering") + " all " + Language.Styling.UtilityColor("on-kill effects") + " upon impact. Copies the source attack's damage type. Every " + Language.Styling.DamageColor(1f.AsPercent()) + " attack damage dealt increases activation chance by " + Language.Styling.DamageColor(procChanceBase + "%") + " " + Language.Styling.StackText($"+{procChanceStack}%") + "."; public override string ItemLore => ""; public override ItemTier Tier => (ItemTier)3; public override GameObject ItemModel => ItemBase.LoadDropPrefab("PickupSoulAnomaly"); public override Sprite ItemIcon => ItemBase.LoadItemIcon("texIconSoulAnomaly"); public override ItemTag[] ItemTags { get; } public override bool GetPrerequisites() { return NewMoonPlugin.DoPillarItemDrop; } public override ItemDisplayRuleDict CreateItemDisplayRules() { return null; } public override void Init() { //IL_0001: 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) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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) soulProjectileProcType = ProcTypeAPI.ReserveProcType(); spiritBuff = Content.CreateAndAddBuff("bdSpiritSpeed", Addressables.LoadAssetAsync((object)"RoR2/Base/Common/texMovespeedBuffIcon.tif").WaitForCompletion(), Color.cyan, canStack: true, isDebuff: false, (StackingDisplayMethod)0); base.Init(); ItemAPI.ApplyTagToItem(NewMoonPlugin.IsMoonRelic, ItemsDef); NewMoonPlugin.LoadAsync(RoR2_Base_LunarWisp.LunarWispTrackingBomb_prefab, (Action)CreateSoulProjectile); } private void CreateSoulProjectile(GameObject lunarWispTrackingBomb) { soulProjectile = PrefabAPI.InstantiateClone(lunarWispTrackingBomb, "SoulRelicProjectile", true); HealthComponent val = default(HealthComponent); if (soulProjectile.TryGetComponent(ref val)) { val.globalDeathEventChanceCoefficient = 0f; } ProjectileGrantOnKillOnDestroy val2 = soulProjectile.AddComponent(); val2.healthComponent = val; ProjectileDirectionalTargetFinder val3 = default(ProjectileDirectionalTargetFinder); if (soulProjectile.TryGetComponent(ref val3)) { val3.lookRange = 100f; val3.lookCone = 35f; } Content.AddProjectilePrefab(soulProjectile); } public override void Hooks() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown OnHit.GetHitBehavior += new HitHookEventHandler(FireSoulProjectileOnHit); } private void FireSoulProjectileOnHit(CharacterBody attackerBody, DamageInfo damageInfo, CharacterBody victimBody) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Invalid comparison between Unknown and I4 //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: 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_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0136: 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_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0174: 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_0183: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) if (ProcTypeAPI.HasModdedProc(damageInfo.procChainMask, soulProjectileProcType) || (!((DamageTypeCombo)(ref damageInfo.damageType)).IsDamageSourceSkillBased && (int)damageInfo.damageType.damageSource != 64)) { return; } int count = GetCount(attackerBody); if (count > 0) { float num = (damageInfo.damage /= attackerBody.damage); float procRate = NewMoonPlugin.GetProcRate(damageInfo); float num2 = Util.ConvertAmplificationPercentageIntoReductionPercentage((procChanceMin + ItemBase.GetStackValue(procChanceBase, procChanceStack, count) * num) * procRate); if (Util.CheckRoll(num2, attackerBody.master)) { Ray aimRay = attackerBody.inputBank.GetAimRay(); FireProjectileInfo val = new FireProjectileInfo { projectilePrefab = soulProjectile, crit = damageInfo.crit, damage = attackerBody.damage * soulProjectileDamageCoefficient, damageTypeOverride = damageInfo.damageType, damageColorIndex = (DamageColorIndex)3, force = 0f, owner = ((Component)attackerBody).gameObject, position = ((Ray)(ref aimRay)).origin }; Vector3 val2 = victimBody.corePosition - attackerBody.corePosition; val.rotation = Util.QuaternionSafeLookRotation(((Vector3)(ref val2)).normalized); FireProjectileInfo val3 = val; ProcChainMask procChainMask = damageInfo.procChainMask; ProcTypeAPI.AddModdedProc(ref procChainMask, soulProjectileProcType); val3.procChainMask = procChainMask; ProjectileManager.instance.FireProjectile(val3); } } } public override void PostInit() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) base.PostInit(); CraftableDef val = ScriptableObject.CreateInstance(); ((Object)val).name = "CRAFTABLE_" + ItemLangTokenName; val.pickup = (Object)(object)ItemsDef; val.itemIndex = ItemsDef.itemIndex; List list = new List(); Extensions.TryLoadAndAddIngredient(list, RoR2_Base_LunarDagger.LunarDagger_asset, "relic of soul - shaped glass"); Extensions.TryLoadAndAddIngredient(list, RoR2_Base_LunarBadLuck.LunarBadLuck_asset, "relic of soul - purity"); Extensions.TryLoadAndAddIngredient(list, RoR2_DLC1_HalfAttackSpeedHalfCooldowns.HalfAttackSpeedHalfCooldowns_asset, "relic of soul - light flux pauldron"); Extensions.TryLoadAndAddIngredient(list, RoR2_Base_CrippleWard.CrippleWard_asset, "relic of soul - effigy of grief"); Extensions.TryLoadAndAddIngredient(list, RoR2_Base_BarrierOnKill.BarrierOnKill_asset, "relic of soul - topaz brooch"); Extensions.TryLoadAndAddIngredient(list, RoR2_Base_IgniteOnKill.IgniteOnKill_asset, "relic of soul - GALSONE"); Extensions.TryLoadAndAddIngredient(list, RoR2_DLC1_MoveSpeedOnKill.MoveSpeedOnKill_asset, "relic of soul - hunters harpoon"); Extensions.TryLoadAndAddIngredient(list, RoR2_Base_WarCryOnMultiKill.WarCryOnMultiKill_asset, "relic of soul - berzerkers pauldron"); Extensions.TryLoadAndAddIngredient(list, RoR2_Base_ExplodeOnDeath.ExplodeOnDeath_asset, "relic of soul - willowisp"); Extensions.TryLoadAndAddIngredient(list, RoR2_Base_Tooth.Tooth_asset, "relic of soul - monster tooth"); Extensions.TryLoadAndAddIngredient(list, RoR2_Base_StickyBomb.StickyBomb_asset, "relic of soul - sticky bomb"); Extensions.TryLoadAndAddIngredient(list, RoR2_Base_Missile.Missile_asset, "relic of soul - atg missile"); Extensions.TryLoadAndAddIngredient(list, RoR2_DLC1_PrimarySkillShuriken.PrimarySkillShuriken_asset, "relic of soul - shuriken"); Extensions.TryLoadAndAddIngredient(list, RoR2_Base_CommandMissile.CommandMissile_asset, "relic of soul - disposable missile launcher"); Extensions.TryLoadAndAddIngredient(list, RoR2_Base_BFG.BFG_asset, "relic of soul - preon accumulator"); Extensions.TryLoadAndAddIngredient(list, RoR2_DLC1_BossHunter.BossHunter_asset, "relic of soul - tricorn"); Extensions.AddAllRecipePermutations(val, list.ToArray(), CraftingUtils.VanillaBossKeys); Content.AddCraftableDef(val); } private void SpiritSpeedBoosts(CharacterBody sender, StatHookEventArgs args) { int count = GetCount(sender); if (count > 0) { float num = (float)sender.GetBuffCount(spiritBuff) / (float)SoulAnomalyBehavior.maxBuffCount; args.attackSpeedMultAdd += num * maxAttackMultAdd * (float)count; args.moveSpeedMultAdd += num * maxMoveMultAdd * (float)count + baseMoveSpeedAdd; } } private void AddItemBehavior(orig_OnInventoryChanged orig, CharacterBody self) { orig.Invoke(self); if (NetworkServer.active && (Object)(object)self.healthComponent != (Object)null) { self.AddItemBehavior(GetCount(self)); } } public SoulAnomaly() { ItemTag[] array = new ItemTag[4]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); ItemTags = (ItemTag[])(object)array; base..ctor(); } } public class SoulAnomalyBehavior : ItemBehavior { private HealthComponent healthComponent; private BuffIndex buffIndex = SoulAnomaly.spiritBuff.buffIndex; public static int maxBuffCount = 10; private int buffCount = 0; private void Start() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) healthComponent = base.body.healthComponent; buffCount = base.body.GetBuffCount(buffIndex); } private void FixedUpdate() { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active) { float num = 1f - (healthComponent.health + healthComponent.shield) / healthComponent.fullCombinedHealth; int num2 = Mathf.CeilToInt(num * (float)maxBuffCount); if (num2 > buffCount && buffCount < maxBuffCount) { base.body.AddBuff(buffIndex); buffCount++; } else if (num2 < buffCount && buffCount > 0) { base.body.RemoveBuff(buffIndex); buffCount--; } } } } } namespace NewMoon.Artifacts { public abstract class ArtifactBase : ArtifactBase where T : ArtifactBase { public static T instance { get; private set; } public ArtifactBase() { if (instance != null) { throw new InvalidOperationException("Singleton class \"" + typeof(T).Name + "\" inheriting ItemBoilerplate/Item was instantiated twice"); } instance = this as T; } } public abstract class ArtifactBase : SharedBase { public ArtifactDef ArtifactDef; public override string ConfigName => "Artifacts : " + ArtifactName; public override AssetBundle assetBundle => NewMoonPlugin.mainAssetBundle; public abstract string ArtifactName { get; } public abstract string ArtifactDescription { get; } public abstract string ArtifactLangTokenName { get; } public abstract Sprite ArtifactSelectedIcon { get; } public abstract Sprite ArtifactDeselectedIcon { get; } public abstract void OnArtifactEnabledServer(); public abstract void OnArtifactDisabledServer(); public override void Init() { base.Init(); CreateArtifact(); } public override void Lang() { LanguageAPI.Add("ARTIFACT_" + ArtifactLangTokenName + "_NAME", "Artifact of " + ArtifactName); LanguageAPI.Add("ARTIFACT_" + ArtifactLangTokenName + "_DESCRIPTION", ArtifactDescription); } protected void CreateArtifact() { //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Expected O, but got Unknown //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Expected O, but got Unknown ArtifactDef = ScriptableObject.CreateInstance(); ArtifactDef.cachedName = "2r4r" + ArtifactName; ArtifactDef.nameToken = "ARTIFACT_" + ArtifactLangTokenName + "_NAME"; ArtifactDef.descriptionToken = "ARTIFACT_" + ArtifactLangTokenName + "_DESCRIPTION"; ArtifactDef.smallIconDeselectedSprite = ArtifactDeselectedIcon; ArtifactDef.smallIconSelectedSprite = ArtifactSelectedIcon; Content.AddArtifactDef(ArtifactDef); RunArtifactManager.onArtifactEnabledGlobal += new ArtifactStateChangeDelegate(OnArtifactEnabled); RunArtifactManager.onArtifactDisabledGlobal += new ArtifactStateChangeDelegate(OnArtifactDisabled); } private void OnArtifactEnabled(RunArtifactManager runArtifactManager, ArtifactDef artifactDef) { if (!((Object)(object)artifactDef != (Object)(object)ArtifactDef) && NetworkServer.active) { OnArtifactEnabledServer(); } } private void OnArtifactDisabled(RunArtifactManager runArtifactManager, ArtifactDef artifactDef) { if (!((Object)(object)artifactDef != (Object)(object)ArtifactDef)) { OnArtifactDisabledServer(); } } public bool IsArtifactEnabled() { return RunArtifactManager.instance.IsArtifactEnabled(ArtifactDef); } public static Sprite LoadArtifactIcon(string spriteName = "", AssetBundle bundle = null, bool fallBackOnWrench = false) { return NewMoonPlugin.TryLoadSpriteFromBundle("Assets/Textures/Icons/Artifact/" + spriteName + ".png", bundle, fallBackOnWrench); } } public class BonusPillarsArtifact : ArtifactBase { public static InteractableSpawnCard[] allPillarSpawnCards; public static float pillarMonsterCredit = 700f; public static float pillarGoldRewardCoefficient = 0.5f; public static int pillarsPerStage = 1; private bool useBasicObjective = false; private static string objectiveToken = "OBJECTIVE_BONUSPILLARS"; private static string objectiveDesc = "Charge the Pillar" + ((pillarsPerStage > 1) ? "s" : "") + " of Creation"; public override bool forcePrerequisites => false; public override string ArtifactName => "Genesis"; public override string ArtifactDescription => "Optional Pillars of Creation appear on every stage."; public override string ArtifactLangTokenName => "BONUSPILLARS"; public override Sprite ArtifactSelectedIcon => ArtifactBase.LoadArtifactIcon("texIconBonusPillars", null, fallBackOnWrench: true); public override Sprite ArtifactDeselectedIcon => ArtifactBase.LoadArtifactIcon("texIconBonusPillarsOff"); public override bool GetPrerequisites() { return NewMoonPlugin.DoPillarItemDrop; } public override void Hooks() { } public override void Lang() { base.Lang(); LanguageAPI.Add(objectiveToken, objectiveDesc); } public override void Init() { base.Init(); allPillarSpawnCards = (InteractableSpawnCard[])(object)new InteractableSpawnCard[4] { CreatePillarSpawnCard(RoR2_Base_moon2.MoonBatteryBlood_prefab), CreatePillarSpawnCard(RoR2_Base_moon2.MoonBatteryDesign_prefab), CreatePillarSpawnCard(RoR2_Base_moon2.MoonBatteryMass_prefab), CreatePillarSpawnCard(RoR2_Base_moon2.MoonBatterySoul_prefab) }; InteractableSpawnCard CreatePillarSpawnCard(string addressablePath) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: 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_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0105: 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) InteractableSpawnCard val = ScriptableObject.CreateInstance(); GameObject val2 = Addressables.LoadAssetAsync((object)addressablePath).WaitForCompletion(); string text = ((Object)val2).name + "StageOnly"; val2 = PrefabAPI.InstantiateClone(val2, text); PillarItemDropper component = val2.GetComponent(); component.shouldDropItem = true; component.shouldDropPotential = true; if (useBasicObjective) { GenericObjectiveProvider val3 = val2.AddComponent(); val3.objectiveToken = objectiveToken; } CombatDirector combatDirector = val2.GetComponent(); combatDirector.monsterCredit = pillarMonsterCredit; combatDirector.goldRewardCoefficient = pillarGoldRewardCoefficient; combatDirector.shouldSpawnOneWave = true; ((Behaviour)combatDirector).enabled = false; AsyncOperationHandle val4 = Addressables.LoadAssetAsync((object)RoR2_Base_moon.dccsMoonMonsters_asset); val4.Completed += delegate(AsyncOperationHandle ctx) { combatDirector.monsterCards = ctx.Result; }; ((Object)val).name = "isc" + text; ((SpawnCard)val).prefab = val2; ((SpawnCard)val).sendOverNetwork = true; ((SpawnCard)val).hullSize = (HullClassification)2; ((SpawnCard)val).nodeGraphType = (GraphType)0; ((SpawnCard)val).requiredFlags = (NodeFlags)2; ((SpawnCard)val).forbiddenFlags = (NodeFlags)8; ((SpawnCard)val).occupyPosition = true; return val; } } public override void OnArtifactDisabledServer() { Stage.onServerStageBegin -= BonusPillarOnStageBegin; } public override void OnArtifactEnabledServer() { Stage.onServerStageBegin += BonusPillarOnStageBegin; } private void BonusPillarOnStageBegin(Stage obj) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Invalid comparison between Unknown and I4 if ((int)obj.sceneDef.sceneType == 1) { SpawnMoonPillars(Run.instance.stageRng); } } private static void SpawnMoonPillars(Xoroshiro128Plus rng) { //IL_007a: 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_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Expected O, but got Unknown List list = new List(pillarsPerStage); int num = allPillarSpawnCards.Length; int[] array = new int[num]; WeightedSelection val = new WeightedSelection(num); for (int i = 0; i < pillarsPerStage; i++) { val.Clear(); for (int j = 0; j < num; j++) { float num2 = 1f - (float)array[j] / (float)pillarsPerStage; if (num2 > 0f) { val.AddChoice(j, num2); } } DirectorPlacementRule val2 = new DirectorPlacementRule { placementMode = (PlacementMode)((Object.op_Implicit((Object)(object)SceneInfo.instance) && Object.op_Implicit((Object)(object)SceneInfo.instance.approximateMapBoundMesh)) ? 5 : 4) }; int num3 = val.Evaluate(rng.nextNormalizedFloat); DirectorSpawnRequest val3 = new DirectorSpawnRequest((SpawnCard)(object)allPillarSpawnCards[num3], val2, rng); GameObject val4 = DirectorCore.instance.TrySpawnObject(val3); if (Object.op_Implicit((Object)(object)val4)) { list.Add(val4); array[num3]++; } } } } } namespace NewMoon.Components { internal class CopyInventoryFromOwner : MonoBehaviour { public Func inventoryItemCopyFilter = Inventory.defaultItemCopyFilterDelegate.Invoke; public bool copyInventory = true; public bool copyEquipment = true; public void Start() { CharacterMaster component = ((Component)this).gameObject.GetComponent(); MinionOwnership component2 = ((Component)this).gameObject.GetComponent(); if ((Object)(object)component2 != (Object)null && (Object)(object)component != (Object)null) { CharacterMaster ownerMaster = component2.ownerMaster; Inventory val = ((ownerMaster != null) ? ownerMaster.inventory : null); if (Object.op_Implicit((Object)(object)val)) { component.inventory.CopyEquipmentFrom(val); component.inventory.CopyItemsFrom(val); } } } } public class InteractableDropPickup : MonoBehaviour { public PurchaseInteraction purchaseInteraction; public bool destroyOnUse = true; public ExplicitPickupDropTable dropTable; private Xoroshiro128Plus rng; public Transform dropletOrigin; public bool canActivate = true; public bool canBeReplaced = true; private void Start() { if ((Object)(object)dropletOrigin == (Object)null) { dropletOrigin = ((Component)this).transform; } } public void OnInteractionBegin(Interactor activator) { //IL_002f: 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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: 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_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: 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: Unknown result type (might be due to invalid IL or missing references) //IL_00da: 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) if (!((Object)(object)dropTable == (Object)null) && canActivate) { Debug.Log((object)"AAAAAAAAAAAAAHHHHHHHHHHHHHHH"); UniquePickup none = UniquePickup.none; rng = new Xoroshiro128Plus(Run.instance.treasureRng.nextUlong); dropTable.GenerateWeightedSelection(); none = ((!canBeReplaced) ? ((PickupDropTable)dropTable).GeneratePickupPreReplacement(rng) : ((PickupDropTable)dropTable).GeneratePickup(rng)); PickupDropletController.CreatePickupDroplet(none, dropletOrigin.position + dropletOrigin.forward * 3f + Vector3.up * 3f, dropletOrigin.forward * 3f + Vector3.up * 5f, false); if (destroyOnUse) { canActivate = false; Object.Destroy((Object)(object)((Component)this).gameObject); } } } } public class PillarItemDropper : MonoBehaviour { public enum PillarType { None = -1, Blood, Design, Mass, Soul } public PillarType pillarType = PillarType.None; public bool shouldDropItem = false; public bool shouldDropPotential = false; private Xoroshiro128Plus rng; private GameObject voidPotentialPrefab => Addressables.LoadAssetAsync((object)RoR2_DLC1_OptionPickup.OptionPickup_prefab).WaitForCompletion(); private BasicPickupDropTable dtTier3 => Addressables.LoadAssetAsync((object)RoR2_Base_Common.dtTier3Item_asset).WaitForCompletion(); private BasicPickupDropTable dtBoss => Addressables.LoadAssetAsync((object)RoR2_Base_DuplicatorWild.dtDuplicatorWild_asset).WaitForCompletion(); private void Start() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown if (NetworkServer.active) { rng = new Xoroshiro128Plus(Run.instance.treasureRng.nextUlong); } } private void OnEnable() { HoldoutZoneController val = default(HoldoutZoneController); if (((Component)this).TryGetComponent(ref val) && shouldDropItem) { ((UnityEvent)(object)val.onCharged).AddListener((UnityAction)OnHoldoutCharged); } } private void OnDisable() { HoldoutZoneController val = default(HoldoutZoneController); if (((Component)this).TryGetComponent(ref val)) { ((UnityEvent)(object)val.onCharged).RemoveListener((UnityAction)OnHoldoutCharged); } } public void OnHoldoutCharged(HoldoutZoneController holdoutZone) { bool flag = true; ShelterUtilsModule.MakeMockShelter(((Component)holdoutZone.radiusIndicator).gameObject, holdoutZone.currentRadius, 10f, 1f); DropPillarItemFromHoldout(holdoutZone); } public void DropPillarItemFromHoldout(HoldoutZoneController holdoutZone) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_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_005a: 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_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_00b3: 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_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: 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_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: 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_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: 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_00fc: 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) int num = (Object.op_Implicit((Object)(object)Run.instance) ? Run.instance.participatingPlayerCount : 0); if (num == 0) { return; } Vector3 dropPosition = ((Component)holdoutZone).gameObject.transform.position + Vector3.up * NewMoonPlugin.pillarDropOffset; PickupIndex pickupIndexFromPillarType = GetPickupIndexFromPillarType(pillarType); if (pickupIndexFromPillarType != PickupIndex.none) { int num2 = NewMoonPlugin.baseRewardCount; if (NewMoonPlugin.scaleRewardsByPlayerCount) { num2 *= num; } float num3 = 360f / (float)num2; Vector3 val = Quaternion.AngleAxis((float)Random.Range(0, 360), Vector3.up) * (Vector3.up * NewMoonPlugin.pillarDropForce + Vector3.forward * 5f); Quaternion val2 = Quaternion.AngleAxis(num3, Vector3.up); int num4 = 0; while (num4 < num2) { CreatePillarPickup(dropPosition, pickupIndexFromPillarType, val); num4++; val = val2 * val; } } } private void CreatePillarPickup(Vector3 dropPosition, PickupIndex pickupIndex, Vector3 vector) { //IL_0003: 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_0039: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_008d: 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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: 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_00af: 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_00b1: 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) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) UniquePickup val = default(UniquePickup); ((UniquePickup)(ref val))..ctor(pickupIndex); if (!shouldDropPotential) { PickupDropletController.CreatePickupDroplet(val, dropPosition, vector, false); return; } UniquePickup item = ((PickupDropTable)dtTier3).GeneratePickupPreReplacement(rng); UniquePickup item2 = ((PickupDropTable)dtBoss).GeneratePickupPreReplacement(rng); CreatePickupInfo val2 = new CreatePickupInfo { pickerOptions = PickupPickerController.GenerateOptionsFromList>(new List(3) { val, item, item2 }), prefabOverride = voidPotentialPrefab, position = dropPosition, rotation = Quaternion.identity }; ((CreatePickupInfo)(ref val2)).pickupIndex = PickupCatalog.FindPickupIndex((ItemTier)3); CreatePickupInfo val3 = val2; PickupDropletController.CreatePickupDroplet(val3, val3.position, vector); } public static PickupIndex GetPickupIndexFromPillarType(PillarType pillarType) { //IL_006d: 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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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_005e: 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) ItemBase itemBase = null; switch (pillarType) { case PillarType.Mass: itemBase = ItemBase.instance; break; case PillarType.Design: itemBase = ItemBase.instance; break; case PillarType.Blood: itemBase = ItemBase.instance; break; case PillarType.Soul: itemBase = ItemBase.instance; break; } if (itemBase != null) { ItemIndex itemIndex = itemBase.ItemsDef.itemIndex; return PickupCatalog.FindPickupIndex(itemIndex); } Debug.Log((object)"No pickup index found!"); return PickupIndex.none; } } }