Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of Rofl Items v1.0.6
RoflItems.dll
Decompiled 10 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using Microsoft.CodeAnalysis; using On.RoR2; using R2API; using RiskOfOptions; using RiskOfOptions.OptionConfigs; using RiskOfOptions.Options; using RoR2; using RoR2.CharacterAI; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.ResourceManagement.AsyncOperations; using UnityEngine.ResourceManagement.ResourceLocations; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("RoflItems")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("RoflItems")] [assembly: AssemblyTitle("RoflItems")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace ExamplePlugin { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("idolfan.RoflItems", "RoflItems", "1.0.5")] public class RoflItems : BaseUnityPlugin { public const string PluginGUID = "idolfan.RoflItems"; public const string PluginAuthor = "idolfan"; public const string PluginName = "RoflItems"; public const string PluginVersion = "1.0.5"; public static string armorplateDef_name; public static string armorplateDef_nameToken; public static string armorplateDef_pickupToken; public static string armorplateDef_descriptionToken; public static string armorplateDef_loreToken; public static string sledgehammerDef_name; public static string sledgehammerDef_nameToken; public static string sledgehammerDef_pickupToken; public static string sledgehammerDef_descriptionToken; public static string sledgehammerDef_loreToken; public static string leckererLachs_name; public static string leckererLachs_nameToken; public static string leckererLachs_pickupToken; public static string leckererLachs_descriptionToken; public static string leckererLachs_loreToken; public static int testRadius = 1; public ItemDef sledgehammerDef; public ItemDef armorplateDef; public EquipmentDef leckererLachs; public static BuffDef firstHitBuff; public static AssetBundle assetBundle; public static ConfigEntry<float> armorPerStack { get; set; } public static ConfigEntry<float> bonusDamageForFirstStack { get; set; } public static ConfigEntry<float> bonusDamageForMoreStacks { get; set; } public static ConfigEntry<bool> debugEnabled { get; set; } public static ConfigEntry<float> aggroChance { get; set; } public static ConfigEntry<float> aggroInnerRadius { get; set; } public static ConfigEntry<float> aggroOuterRadius { get; set; } public static ConfigEntry<float> aggroCooldown { get; set; } public static ConfigEntry<float> aggroDuration { get; set; } public static ConfigEntry<bool> enableSalmon { get; set; } public static bool rooInstalled => Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions"); public void Awake() { //IL_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Expected O, but got Unknown //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_0354: Expected O, but got Unknown //IL_036a: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Expected O, but got Unknown assetBundle = AssetBundle.LoadFromFile(Assembly.GetExecutingAssembly().Location.Replace("RoflItems.dll", "rofl_items_assets")); armorPerStack = ((BaseUnityPlugin)this).Config.Bind<float>("Armorplate", "Armor per Stack", 6f, "The armor the item gives per Stack."); bonusDamageForFirstStack = ((BaseUnityPlugin)this).Config.Bind<float>("Sledgehammer", "First stack bonus", 0.8f, "The damage bonus given on one stack of the item."); bonusDamageForMoreStacks = ((BaseUnityPlugin)this).Config.Bind<float>("Sledgehammer", "Further stacks bonus", 0.55f, "The damage bonus given for each further stack of the item."); debugEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "Logs debug messages.", false, ""); aggroChance = ((BaseUnityPlugin)this).Config.Bind<float>("Salmon", "Chance", 0.7f, "The chance for far away enemies to also take aggro"); aggroInnerRadius = ((BaseUnityPlugin)this).Config.Bind<float>("Salmon", "Inner Radius", 25f, "The radius within which enemies are affected 100% of the time"); aggroOuterRadius = ((BaseUnityPlugin)this).Config.Bind<float>("Salmon", "Outer Radius", 50f, "The radius within which enemies might be affected, dependent on aggroChance"); aggroCooldown = ((BaseUnityPlugin)this).Config.Bind<float>("Salmon", "Cooldown", 60f, "The cooldown of the Equipment"); aggroDuration = ((BaseUnityPlugin)this).Config.Bind<float>("Salmon", "Duration", 7f, "The duration of the taunt in seconds."); enableSalmon = ((BaseUnityPlugin)this).Config.Bind<bool>("Salmon", "Enable", true, "Whether the Salmon will appear in your runs."); armorplateDef_name = "Armorplate"; armorplateDef_nameToken = "Armorplate"; armorplateDef_pickupToken = "You become the tank."; armorplateDef_descriptionToken = $"Grants {armorPerStack.Value}(+{armorPerStack.Value} per Stack) Armor."; armorplateDef_loreToken = "Es war einmal ein Panzer.\nSchaden hat er keinen bekommen."; sledgehammerDef_name = "Sledgehammer"; sledgehammerDef_nameToken = "Sledgehammer"; sledgehammerDef_pickupToken = $"Enemies who have not been hit by the {sledgehammerDef_name} in the last 10 seconds suffer {bonusDamageForFirstStack.Value * 100f}% (+{bonusDamageForMoreStacks.Value * 100f}% per Stack) more damage"; sledgehammerDef_descriptionToken = "You make the suggestion."; sledgehammerDef_loreToken = "Ich geh mal den Garten durchsuchen (-> Stärke 9 :))."; leckererLachs_name = "Salmon"; leckererLachs_nameToken = "Salmon"; leckererLachs_pickupToken = "Salmon in shark's clothing."; leckererLachs_descriptionToken = $"Attracts all enemies within {aggroInnerRadius.Value} meters.\nAttracts {aggroChance.Value * 100f}% of enemies within {aggroOuterRadius.Value} meters.\nLasts {aggroDuration.Value} seconds."; leckererLachs_loreToken = "Nimm den Lachs von meinen Sandalen runter!"; createItems(); if (rooInstalled) { initRiskOfOptions(); } CharacterBody.RecalculateStats += new hook_RecalculateStats(grantStats); firstHitBuff = ScriptableObject.CreateInstance<BuffDef>(); ((Object)firstHitBuff).name = "FirstHitMarker"; firstHitBuff.iconSprite = null; firstHitBuff.canStack = false; firstHitBuff.isDebuff = true; ContentAddition.AddBuffDef(firstHitBuff); HealthComponent.TakeDamage += new hook_TakeDamage(extraDamageOnFirstHit); if (enableSalmon.Value) { EquipmentSlot.PerformEquipmentAction += new hook_PerformEquipmentAction(EquipmentSlot_PerformEquipmentAction); } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private void initRiskOfOptions() { //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_004a: 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_0065: Expected O, but got Unknown //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown //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_008a: 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_00a5: Expected O, but got Unknown //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown //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_00ca: 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_00e5: Expected O, but got Unknown //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Expected O, but got Unknown //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Expected O, but got Unknown //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Expected O, but got Unknown //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Expected O, but got Unknown //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Expected O, but got Unknown //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Expected O, but got Unknown //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Expected O, but got Unknown //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Expected O, but got Unknown //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Expected O, but got Unknown //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Expected O, but got Unknown //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Expected O, but got Unknown //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Expected O, but got Unknown ModSettingsManager.SetModDescription("Change the stats of items added by RoflItems. Item descriptions might not update properly, however the changes will be applied immediately.", "idolfan.RoflItems", "RoflItems"); ModSettingsManager.SetModIcon(assetBundle.LoadAsset<Sprite>("salmon.png"), "idolfan.RoflItems", "RoflItems"); ModSettingsManager.AddOption((BaseOption)new StepSliderOption(armorPerStack, new StepSliderConfig { increment = 1f, min = 1f, max = 15f }), "idolfan.RoflItems", "RoflItems"); ModSettingsManager.AddOption((BaseOption)new StepSliderOption(bonusDamageForFirstStack, new StepSliderConfig { increment = 0.05f, min = 0.1f, max = 3f }), "idolfan.RoflItems", "RoflItems"); ModSettingsManager.AddOption((BaseOption)new StepSliderOption(bonusDamageForMoreStacks, new StepSliderConfig { increment = 0.05f, min = 0.1f, max = 3f }), "idolfan.RoflItems", "RoflItems"); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(debugEnabled), "idolfan.RoflItems", "RoflItems"); ModSettingsManager.AddOption((BaseOption)new StepSliderOption(aggroChance, new StepSliderConfig { increment = 0.05f, min = 0.1f, max = 1f }), "idolfan.RoflItems", "RoflItems"); ModSettingsManager.AddOption((BaseOption)new StepSliderOption(aggroInnerRadius, new StepSliderConfig { increment = 1f, min = 1f, max = 200f }), "idolfan.RoflItems", "RoflItems"); ModSettingsManager.AddOption((BaseOption)new StepSliderOption(aggroOuterRadius, new StepSliderConfig { increment = 1f, min = 1f, max = 200f }), "idolfan.RoflItems", "RoflItems"); ModSettingsManager.AddOption((BaseOption)new StepSliderOption(aggroCooldown, new StepSliderConfig { increment = 5f, min = 5f, max = 180f }), "idolfan.RoflItems", "RoflItems"); ModSettingsManager.AddOption((BaseOption)new StepSliderOption(aggroDuration, new StepSliderConfig { increment = 1f, min = 1f, max = 30f }), "idolfan.RoflItems", "RoflItems"); armorPerStack.SettingChanged += delegate { armorplateDef.descriptionToken = armorplateDef_descriptionToken; }; bonusDamageForFirstStack.SettingChanged += delegate { sledgehammerDef.descriptionToken = sledgehammerDef_descriptionToken; }; bonusDamageForMoreStacks.SettingChanged += delegate { sledgehammerDef.descriptionToken = sledgehammerDef_descriptionToken; }; aggroChance.SettingChanged += delegate { leckererLachs.descriptionToken = leckererLachs_descriptionToken; }; aggroInnerRadius.SettingChanged += delegate { leckererLachs.descriptionToken = leckererLachs_descriptionToken; }; aggroOuterRadius.SettingChanged += delegate { leckererLachs.descriptionToken = leckererLachs_descriptionToken; }; aggroCooldown.SettingChanged += delegate { leckererLachs.cooldown = aggroCooldown.Value; }; aggroDuration.SettingChanged += delegate { leckererLachs.descriptionToken = leckererLachs_descriptionToken; }; } private bool EquipmentSlot_PerformEquipmentAction(orig_PerformEquipmentAction orig, EquipmentSlot equipmentSlot, EquipmentDef equipmentDef) { if (debugEnabled.Value) { Console.WriteLine("MEGAROFL EQDEFAC " + ((Object)equipmentDef).name); } if ((Object)(object)equipmentDef == (Object)(object)leckererLachs) { OnEquipmentActivated(equipmentSlot); return true; } return orig.Invoke(equipmentSlot, equipmentDef); } private void createItems() { //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_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Expected O, but got Unknown //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Expected O, but got Unknown //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Expected O, but got Unknown //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Expected O, but got Unknown //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Expected O, but got Unknown ((MonoBehaviour)this).StartCoroutine(UpgradeStubbedShadersAsync(assetBundle)); armorplateDef = ScriptableObject.CreateInstance<ItemDef>(); ((Object)armorplateDef).name = armorplateDef_name; armorplateDef.nameToken = armorplateDef_nameToken; armorplateDef.pickupToken = armorplateDef_pickupToken; armorplateDef.descriptionToken = armorplateDef_descriptionToken; armorplateDef.loreToken = armorplateDef_loreToken; armorplateDef._itemTierDef = Addressables.LoadAssetAsync<ItemTierDef>((object)"RoR2/Base/Common/Tier1Def.asset").WaitForCompletion(); armorplateDef.pickupIconSprite = assetBundle.LoadAsset<Sprite>("armorplate.png"); armorplateDef.pickupModelPrefab = assetBundle.LoadAsset<GameObject>("armorplate.prefab"); armorplateDef.canRemove = true; armorplateDef.hidden = false; ItemDisplayRuleDict val = new ItemDisplayRuleDict((ItemDisplayRule[])null); ItemAPI.Add(new CustomItem(armorplateDef, val)); sledgehammerDef = ScriptableObject.CreateInstance<ItemDef>(); ((Object)sledgehammerDef).name = sledgehammerDef_name; sledgehammerDef.nameToken = sledgehammerDef_nameToken; sledgehammerDef.pickupToken = sledgehammerDef_pickupToken; sledgehammerDef.descriptionToken = sledgehammerDef_descriptionToken; sledgehammerDef.loreToken = sledgehammerDef_loreToken; sledgehammerDef._itemTierDef = Addressables.LoadAssetAsync<ItemTierDef>((object)"RoR2/Base/Common/Tier2Def.asset").WaitForCompletion(); sledgehammerDef.pickupIconSprite = assetBundle.LoadAsset<Sprite>("sledgehammer.png"); sledgehammerDef.pickupModelPrefab = assetBundle.LoadAsset<GameObject>("sledgehammer.prefab"); sledgehammerDef.canRemove = true; sledgehammerDef.hidden = false; ItemDisplayRuleDict val2 = new ItemDisplayRuleDict((ItemDisplayRule[])null); ItemAPI.Add(new CustomItem(sledgehammerDef, val2)); if (enableSalmon.Value) { leckererLachs = ScriptableObject.CreateInstance<EquipmentDef>(); ((Object)leckererLachs).name = leckererLachs_name; leckererLachs.nameToken = leckererLachs_nameToken; leckererLachs.pickupToken = leckererLachs_pickupToken; leckererLachs.descriptionToken = leckererLachs_descriptionToken; leckererLachs.loreToken = leckererLachs_loreToken; leckererLachs.pickupIconSprite = assetBundle.LoadAsset<Sprite>("salmon.png"); leckererLachs.pickupModelPrefab = assetBundle.LoadAsset<GameObject>("lachs.prefab"); leckererLachs.cooldown = aggroCooldown.Value; leckererLachs.canDrop = true; leckererLachs.enigmaCompatible = true; ItemDisplayRuleDict val3 = new ItemDisplayRuleDict((ItemDisplayRule[])null); bool flag = ItemAPI.Add(new CustomEquipment(leckererLachs, val3)); if (debugEnabled.Value) { Console.WriteLine("MEGAROFL Lachs " + flag); } } } private void extraDamageOnFirstHit(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo) { CharacterBody body = self.body; if (!Object.op_Implicit((Object)(object)damageInfo.attacker) || !Object.op_Implicit((Object)(object)body)) { orig.Invoke(self, damageInfo); return; } CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>(); if ((Object)(object)component == (Object)null || (Object)(object)body == (Object)null) { orig.Invoke(self, damageInfo); return; } if (debugEnabled.Value) { Debug.Log((object)"MEGAROFL attack"); } Inventory inventory = component.inventory; int itemCount = inventory.GetItemCount(sledgehammerDef); if (debugEnabled.Value) { Debug.Log((object)("MEGAROFL itemCount " + itemCount)); } if ((Object)(object)inventory == (Object)null || itemCount <= 0) { orig.Invoke(self, damageInfo); return; } if (damageInfo.damage >= 1f && !body.HasBuff(firstHitBuff)) { if (debugEnabled.Value) { Debug.Log((object)"MEGAROFL give buff"); } body.AddTimedBuff(firstHitBuff, 10f); damageInfo.damage *= calculateFirstHitMult(itemCount); } orig.Invoke(self, damageInfo); } private float calculateFirstHitMult(int itemCount) { float result = 1f + bonusDamageForFirstStack.Value + (float)(itemCount - 1) * bonusDamageForMoreStacks.Value; if (debugEnabled.Value) { Debug.Log((object)("MEGAROFL calculateFirstHitMult " + itemCount + " " + result)); } return result; } private void grantStats(orig_RecalculateStats orig, CharacterBody self) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); if (Object.op_Implicit((Object)(object)self.inventory)) { int itemCount = self.inventory.GetItemCount(armorplateDef.itemIndex); if (itemCount > 0) { self.armor += armorPerStack.Value * (float)itemCount; } } } public static void OnEquipmentActivated(EquipmentSlot equipmentSlot) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)equipmentSlot == (Object)null) && !((Object)(object)equipmentSlot.characterBody == (Object)null)) { GameObject gameObject = ((Component)equipmentSlot.characterBody).gameObject; AggroEnemiesInRadius(gameObject.transform.position, aggroInnerRadius.Value, aggroOuterRadius.Value, gameObject); } } private static void AggroEnemiesInRadius(Vector3 position, float innerRadius, float outerRadius, GameObject player) { //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_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_000d: 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_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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_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) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_011e: 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_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Expected O, but got Unknown BullseyeSearch val = new BullseyeSearch { searchOrigin = position, searchDirection = Vector3.up, maxDistanceFilter = outerRadius, teamMaskFilter = TeamMask.GetEnemyTeams((TeamIndex)1), sortMode = (SortMode)1 }; val.RefreshCandidates(); Random random = new Random(); foreach (HurtBox result in val.GetResults()) { if (!(random.NextDouble() < (double)aggroChance.Value)) { continue; } AISkillDriver component = ((Component)result.healthComponent.body.master).GetComponent<AISkillDriver>(); BaseAI component2 = ((Component)result.healthComponent.body.master).GetComponent<BaseAI>(); if (!((Object)(object)component2 == (Object)null)) { component2.currentEnemy.gameObject = player; component2.targetRefreshTimer = aggroDuration.Value; if (debugEnabled.Value) { Console.WriteLine($"MEGAROFL aggro {((Object)result).name} {player.GetComponent<HurtBox>()}"); } } } BullseyeSearch val2 = new BullseyeSearch { searchOrigin = position, searchDirection = Vector3.up, maxDistanceFilter = innerRadius, teamMaskFilter = TeamMask.GetEnemyTeams((TeamIndex)1), sortMode = (SortMode)1 }; val2.RefreshCandidates(); foreach (HurtBox result2 in val2.GetResults()) { AISkillDriver component3 = ((Component)result2.healthComponent.body.master).GetComponent<AISkillDriver>(); BaseAI component4 = ((Component)result2.healthComponent.body.master).GetComponent<BaseAI>(); if (!((Object)(object)component4 == (Object)null)) { component4.currentEnemy.gameObject = player; component4.targetRefreshTimer = aggroDuration.Value; if (debugEnabled.Value) { Console.WriteLine($"MEGAROFL aggro {((Object)result2).name} {player.GetComponent<HurtBox>()}"); } } } if (debugEnabled.Value) { Console.WriteLine($"MEGAROFL Alle Gegner innerhalb von {aggroInnerRadius} Metern fokussieren nun {((Object)player).name}"); } } public IEnumerator UpgradeStubbedShadersAsync(AssetBundle assetBundle) { Object[] _ = Array.Empty<Object>(); if ((Object)(object)assetBundle == (Object)null) { throw new ArgumentNullException("assetBundle"); } AssetBundleRequest loadMaterials = assetBundle.LoadAllAssetsAsync<Material>(); while (!((AsyncOperation)loadMaterials).isDone) { yield return null; } Object[] allMaterials = loadMaterials.allAssets; int materialCount = allMaterials.Length; if (materialCount <= 0) { yield break; } List<AsyncOperationHandle> loadResourceLocationsOperations = new List<AsyncOperationHandle>(materialCount); for (int k = materialCount - 1; k >= 0; k--) { string cachedShaderName = ((Object)((Material)allMaterials[k]).shader).name; if (cachedShaderName.StartsWith("Stubbed")) { loadResourceLocationsOperations.Add(AsyncOperationHandle<IList<IResourceLocation>>.op_Implicit(Addressables.LoadResourceLocationsAsync((object)(cachedShaderName.Substring(7) + ".shader"), typeof(Shader)))); } else { materialCount--; for (int l = k; l < materialCount; l++) { allMaterials[l] = allMaterials[l + 1]; } } } if (materialCount <= 0) { yield break; } AsyncOperationHandle<IList<AsyncOperationHandle>> loadResourceLocationsGroup = Addressables.ResourceManager.CreateGenericGroupOperation(loadResourceLocationsOperations, false); while (!loadResourceLocationsGroup.IsDone) { yield return null; } List<IResourceLocation> resourceLocations = new List<IResourceLocation>(materialCount); for (int j = materialCount - 1; j >= 0; j--) { AsyncOperationHandle val = loadResourceLocationsGroup.Result[j]; IList<IResourceLocation> result = (IList<IResourceLocation>)((AsyncOperationHandle)(ref val)).Result; if (result.Count > 0) { resourceLocations.Add(result[0]); } else { materialCount--; for (int m = materialCount - j; m < materialCount; m++) { allMaterials[m] = allMaterials[m + 1]; } } } if (materialCount > 0) { AsyncOperationHandle<IList<Shader>> loadShaders = Addressables.LoadAssetsAsync<Shader>((IList<IResourceLocation>)resourceLocations, (Action<Shader>)null, false); while (!loadShaders.IsDone) { yield return null; } int startIndex = _.Length; Array.Resize(ref _, startIndex + materialCount); for (int i = 0; i < materialCount; i++) { SwapShader((Material)allMaterials[i], loadShaders.Result[i]); _[startIndex + i] = allMaterials[i]; } } } [MethodImpl(MethodImplOptions.AggressiveInlining)] private void SwapShader(Material material, Shader shader) { int renderQueue = material.renderQueue; material.shader = shader; material.renderQueue = renderQueue; } } } namespace EntityStates.Abathur.test { internal static class Log { private static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void Debug(object data) { _logSource.LogDebug(data); } internal static void Error(object data) { _logSource.LogError(data); } internal static void Fatal(object data) { _logSource.LogFatal(data); } internal static void Info(object data) { _logSource.LogInfo(data); } internal static void Message(object data) { _logSource.LogMessage(data); } internal static void Warning(object data) { _logSource.LogWarning(data); } } }