using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Splatform; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("AngryRuneStones")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("AngryRuneStones")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("738a6982-9f9e-40a8-9e9a-b49a7f3aeb83")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")] [assembly: AssemblyVersion("1.0.0.0")] public class CustomRaid { public enum Phase { Spawning, Fighting, Boss, Completed, Failed } public string RaidName; public string StonePrefix; public string EndMessage; public string MinionMessage; public string BossMessageSingle; public string ExitMessage; public bool HasBoss; public string BossPrefab; public int DifficultyLevel; public string DifficultyName; public MinionConfig[] MinionConfigs; public Vector3 RaidCenter; public float RaidRadius = 64f; public Phase CurrentPhase = Phase.Spawning; public GameObject RuneStone; private List _spawnedCreatures = new List(); private List _spawnedBosses = new List(); public int EnemyMultiplier = 1; private float[] _spawnTimers; private int[] _targetCounts; private int[] _spawnedCounts; private int _totalToSpawn; private int _totalSpawned; private bool _spawnStopped; private float _counterUpdateTimer; public int MinionMinLevel = 1; public int MinionMaxLevel = 5; public float[] LevelChances = new float[4] { 10f, 6f, 4f, 2f }; public float BossSpawnChance = 100f; public int TotalToSpawn => _totalToSpawn; public bool IsActive => CurrentPhase != Phase.Completed && CurrentPhase != Phase.Failed; public void Start() { //IL_00ab: Unknown result type (might be due to invalid IL or missing references) CurrentPhase = Phase.Spawning; int num = MinionConfigs.Length; _spawnTimers = new float[num]; _targetCounts = new int[num]; _spawnedCounts = new int[num]; _totalToSpawn = 0; for (int i = 0; i < num; i++) { _spawnTimers[i] = 0f; _targetCounts[i] = MinionConfigs[i].GetRandomCount() * DifficultyLevel * EnemyMultiplier; _spawnedCounts[i] = 0; _totalToSpawn += _targetCounts[i]; } _totalSpawned = 0; _spawnStopped = false; CustomRaidZoneDisplay.ShowZone(RaidCenter, RaidRadius); CustomRaidMessages.ShowStartMessage("[" + DifficultyName + "] Прислужники приближаются!"); } public void Update(float dt) { if (!IsActive) { return; } if (!IsPlayerInZone()) { Fail(); return; } switch (CurrentPhase) { case Phase.Spawning: UpdateSpawning(dt); break; case Phase.Fighting: UpdateFighting(); break; case Phase.Boss: UpdateBoss(); break; } } private void UpdateSpawning(float dt) { for (int i = 0; i < MinionConfigs.Length; i++) { if (_spawnedCounts[i] < _targetCounts[i]) { _spawnTimers[i] += dt; if (_spawnTimers[i] >= MinionConfigs[i].SpawnInterval) { _spawnTimers[i] = 0f; SpawnWave(i); } } } bool flag = true; for (int j = 0; j < MinionConfigs.Length; j++) { if (_spawnedCounts[j] < _targetCounts[j]) { flag = false; break; } } if (!_spawnStopped && flag && _totalToSpawn > 0) { _spawnStopped = true; CurrentPhase = Phase.Fighting; } UpdateCounter(); } private void UpdateFighting() { int num = CountAlive(_spawnedCreatures); UpdateCounter(); if (num != 0) { return; } if (HasBoss) { CurrentPhase = Phase.Boss; SpawnBosses(); if (_spawnedBosses.Count > 0) { CustomRaidMessages.HideCounter(); string text = "The Big evil has arrived!"; CustomRaidMessages.ShowBossMessage(text); } else { Complete(); } } else { Complete(); } } private void UpdateBoss() { if (CountAlive(_spawnedBosses) == 0 && _spawnedBosses.Count == 0) { Complete(); } } private void UpdateCounter() { _counterUpdateTimer += Time.deltaTime; if (!(_counterUpdateTimer < 0.1f)) { _counterUpdateTimer = 0f; int num = CountAlive(_spawnedCreatures); int num2 = _totalSpawned - num; if (num2 < 0) { num2 = 0; } if (num2 > _totalToSpawn) { num2 = _totalToSpawn; } CustomRaidMessages.ShowCounter(num2, _totalToSpawn); } } private void SpawnWave(int typeIndex) { MinionConfig minionConfig = MinionConfigs[typeIndex]; GameObject prefab = ZNetScene.instance.GetPrefab(minionConfig.PrefabName); if ((Object)(object)prefab == (Object)null) { return; } int num = _targetCounts[typeIndex] - _spawnedCounts[typeIndex]; int num2 = Mathf.Min(Random.Range(minionConfig.GroupSizeMin, minionConfig.GroupSizeMax + 1), num); for (int i = 0; i < num2; i++) { GameObject val = SpawnCreature(prefab); if ((Object)(object)val != (Object)null) { EnableHunt(val); _spawnedCreatures.Add(val); _spawnedCounts[typeIndex]++; _totalSpawned++; } } } private void SpawnBosses() { if (Random.Range(0f, 100f) > BossSpawnChance || string.IsNullOrEmpty(BossPrefab)) { return; } GameObject prefab = ZNetScene.instance.GetPrefab(BossPrefab); if (!((Object)(object)prefab == (Object)null)) { GameObject val = SpawnCreature(prefab); if ((Object)(object)val != (Object)null) { EnableHunt(val); _spawnedBosses.Add(val); } } } private bool IsValidSpawnPoint(Vector3 pos) { //IL_0006: 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) float num = default(float); if (!ZoneSystem.instance.GetSolidHeight(pos, ref num, 1000)) { return false; } if (num < ZoneSystem.instance.m_waterLevel + 0.5f) { return false; } pos.y = num; return !ZoneSystem.instance.IsBlocked(pos); } private GameObject SpawnCreature(GameObject prefab) { //IL_0009: 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_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) //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_0035: 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_0040: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: 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_0115: 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_007d: 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) float num = default(float); for (int i = 0; i < 15; i++) { Vector2 val = Random.insideUnitCircle * RaidRadius * 0.5f; Vector3 val2 = RaidCenter + new Vector3(val.x, 0f, val.y); if (!IsValidSpawnPoint(val2)) { continue; } ZoneSystem.instance.GetSolidHeight(val2, ref num, 1000); val2.y = num + 0.5f; GameObject val3 = Object.Instantiate(prefab, val2, Quaternion.identity); if (MinionMaxLevel > 1) { Character component = val3.GetComponent(); if ((Object)(object)component != (Object)null) { int num2 = RollLevel(); if (num2 > 1) { component.SetLevel(num2); } } } return val3; } Vector3 raidCenter = RaidCenter; float num3 = default(float); ZoneSystem.instance.GetSolidHeight(raidCenter, ref num3, 1000); raidCenter.y = num3 + 1f; return Object.Instantiate(prefab, raidCenter, Quaternion.identity); } private int RollLevel() { int num = 1; float num2 = Random.Range(0f, 100f); float num3 = 0f; for (int i = 0; i < LevelChances.Length; i++) { num3 += LevelChances[i]; if (num2 < num3) { num = i + 2; break; } } return Mathf.Clamp(num, MinionMinLevel, MinionMaxLevel); } private void EnableHunt(GameObject go) { ZNetView component = go.GetComponent(); if ((Object)(object)component != (Object)null && component.IsValid()) { component.ClaimOwnership(); component.GetZDO().Set(ZDOVars.s_huntPlayer, true); } BaseAI component2 = go.GetComponent(); if ((Object)(object)component2 != (Object)null) { component2.SetHuntPlayer(true); } } private int CountAlive(List list) { for (int num = list.Count - 1; num >= 0; num--) { if ((Object)(object)list[num] == (Object)null) { list.RemoveAt(num); } else { Character component = list[num].GetComponent(); if ((Object)(object)component == (Object)null || component.IsDead()) { list.RemoveAt(num); } } } return list.Count; } private bool IsPlayerInZone() { //IL_001e: 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) if ((Object)(object)Player.m_localPlayer == (Object)null) { return false; } return Vector3.Distance(((Component)Player.m_localPlayer).transform.position, RaidCenter) < RaidRadius; } public void Fail() { CurrentPhase = Phase.Failed; DestroyAll(); CustomRaidZoneDisplay.HideZone(); CustomRaidMessages.ShowEndMessage(ExitMessage); } public void Complete() { //IL_0036: 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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) CurrentPhase = Phase.Completed; CustomRaidZoneDisplay.HideZone(); CustomRaidMessages.ShowEndMessage(EndMessage); if ((Object)(object)RuneStone != (Object)null) { Vector3 position = RuneStone.transform.position; Quaternion rotation = RuneStone.transform.rotation; GameObject prefab = ZNetScene.instance.GetPrefab("fx_flametalnode_destruction"); if ((Object)(object)prefab != (Object)null) { Object.Instantiate(prefab, position, rotation); } DestroyLocationProxy(RuneStone.transform); ZNetScene.instance.Destroy(RuneStone); CustomRaidLoot.CreateLootChest(position, rotation, this); } } private void DestroyLocationProxy(Transform t) { while ((Object)(object)t != (Object)null) { LocationProxy component = ((Component)t).GetComponent(); if ((Object)(object)component != (Object)null) { ZNetView component2 = ((Component)t).GetComponent(); if ((Object)(object)component2 != (Object)null && component2.IsValid()) { component2.ClaimOwnership(); ZDOMan.instance.DestroyZDO(component2.GetZDO()); } break; } t = t.parent; } } public void DestroyAll() { foreach (GameObject spawnedCreature in _spawnedCreatures) { if ((Object)(object)spawnedCreature != (Object)null) { ZNetScene.instance.Destroy(spawnedCreature); } } foreach (GameObject spawnedBoss in _spawnedBosses) { if ((Object)(object)spawnedBoss != (Object)null) { ZNetScene.instance.Destroy(spawnedBoss); } } _spawnedCreatures.Clear(); _spawnedBosses.Clear(); } } public static class CustomRaidFactory { public static CustomRaid CreateRaid(string stonePrefix, int difficulty) { if (stonePrefix.StartsWith("RuneStone_Meadows")) { return CreateMeadowsRaid(difficulty); } if (stonePrefix.StartsWith("RuneStone_BlackForest")) { return CreateBlackForestRaid(difficulty); } if (stonePrefix.StartsWith("RuneStone_Boars")) { return CreateBoarsRaid(difficulty); } if (stonePrefix.StartsWith("RuneStone_Greydwarfs")) { return CreateGreydwarfsRaid(difficulty); } if (stonePrefix.StartsWith("RuneStone_Swamps")) { return CreateSwampsRaid(difficulty); } if (stonePrefix.StartsWith("RuneStone_Draugr")) { return CreateDraugrRaid(difficulty); } if (stonePrefix.StartsWith("RuneStone_Mountains")) { return CreateMountainsRaid(difficulty); } if (stonePrefix.StartsWith("RuneStone_Plains")) { return CreatePlainsRaid(difficulty); } if (stonePrefix.StartsWith("RuneStone_Mistlands")) { return CreateMistLandsRaid(difficulty); } if (stonePrefix.StartsWith("RuneStone_Ashlands")) { return CreateAshlandsRaid(difficulty); } return null; } private static CustomRaid CreateMeadowsRaid(int difficulty) { CustomRaid customRaid = new CustomRaid(); customRaid.RaidName = "RuneStoneRaidMeadows"; customRaid.StonePrefix = "RuneStone_Meadows"; customRaid.EndMessage = "The ancient evil has been defeated! The stone crumbled to dust."; customRaid.MinionMessage = "Goal kills"; customRaid.ExitMessage = "You have left the trial area! The stone remained untouched."; customRaid.HasBoss = true; customRaid.BossPrefab = "Eikthyr"; customRaid.DifficultyLevel = difficulty; customRaid.BossSpawnChance = 100f; customRaid.DifficultyName = GetDifficultyName(difficulty); customRaid.MinionMinLevel = 1; customRaid.MinionMaxLevel = 3; customRaid.MinionConfigs = new MinionConfig[3] { new MinionConfig("Boar", 5, 6, 3f, 2, 3), new MinionConfig("Greyling", 10, 15, 1f, 2, 5), new MinionConfig("Neck", 3, 5, 5f, 1, 3) }; return customRaid; } private static CustomRaid CreateBlackForestRaid(int difficulty) { CustomRaid customRaid = new CustomRaid(); customRaid.RaidName = "RuneStoneRaidBlackForest"; customRaid.StonePrefix = "RuneStone_BlackForest"; customRaid.EndMessage = "The ancient evil has been defeated! The stone crumbled to dust."; customRaid.MinionMessage = "Goal kills"; customRaid.ExitMessage = "You have left the trial area! The stone remained untouched."; customRaid.HasBoss = true; customRaid.BossPrefab = "gd_king"; customRaid.DifficultyLevel = difficulty; customRaid.BossSpawnChance = 70f; customRaid.DifficultyName = GetDifficultyName(difficulty); customRaid.MinionMinLevel = 1; customRaid.MinionMaxLevel = 3; customRaid.MinionConfigs = new MinionConfig[4] { new MinionConfig("Greydwarf", 8, 12, 5f, 3, 5), new MinionConfig("Greydwarf_Elite", 2, 5, 10f, 1, 2), new MinionConfig("Troll", 1, 2, 20f, 1, 1), new MinionConfig("Greydwarf_Shaman", 1, 3, 15f, 1, 2) }; return customRaid; } private static CustomRaid CreateBoarsRaid(int difficulty) { CustomRaid customRaid = new CustomRaid(); customRaid.RaidName = "RuneStoneRaidBoars"; customRaid.StonePrefix = "RuneStone_Boars"; customRaid.EndMessage = "The ancient evil has been defeated! The stone crumbled to dust."; customRaid.MinionMessage = "Goal kills"; customRaid.BossMessageSingle = ""; customRaid.ExitMessage = "You have left the trial area! The stone remained untouched."; customRaid.HasBoss = false; customRaid.BossPrefab = ""; customRaid.DifficultyLevel = difficulty; customRaid.DifficultyName = GetDifficultyName(difficulty); customRaid.MinionMinLevel = 1; customRaid.MinionMaxLevel = 2; customRaid.MinionConfigs = new MinionConfig[1] { new MinionConfig("Boar", 15, 20, 2f, 2, 3) }; return customRaid; } private static CustomRaid CreateGreydwarfsRaid(int difficulty) { CustomRaid customRaid = new CustomRaid(); customRaid.RaidName = "RuneStoneGreydwarfs"; customRaid.StonePrefix = "RuneStone_Greydwarfs"; customRaid.EndMessage = "The ancient evil has been defeated! The stone crumbled to dust."; customRaid.MinionMessage = "Goal kills"; customRaid.BossMessageSingle = ""; customRaid.ExitMessage = "You have left the trial area! The stone remained untouched."; customRaid.HasBoss = false; customRaid.BossPrefab = ""; customRaid.DifficultyLevel = difficulty; customRaid.DifficultyName = GetDifficultyName(difficulty); customRaid.MinionMinLevel = 1; customRaid.MinionMaxLevel = 2; customRaid.MinionConfigs = new MinionConfig[2] { new MinionConfig("Greyling", 12, 20, 3f, 1, 3), new MinionConfig("Greydwarf_Shaman", 1, 3, 6f, 1, 2) }; return customRaid; } private static CustomRaid CreateSwampsRaid(int difficulty) { CustomRaid customRaid = new CustomRaid(); customRaid.RaidName = "RuneStoneSwamps"; customRaid.StonePrefix = "RuneStone_Swamps"; customRaid.EndMessage = "The ancient evil has been defeated! The stone crumbled to dust."; customRaid.MinionMessage = "Goal kills"; customRaid.ExitMessage = "You have left the trial area! The stone remained untouched."; customRaid.HasBoss = true; customRaid.BossPrefab = "Bonemass"; customRaid.DifficultyLevel = difficulty; customRaid.BossSpawnChance = 60f; customRaid.DifficultyName = GetDifficultyName(difficulty); customRaid.MinionMinLevel = 1; customRaid.MinionMaxLevel = 3; customRaid.MinionConfigs = new MinionConfig[6] { new MinionConfig("Skeleton", 3, 6, 3f, 1, 2), new MinionConfig("Draugr", 6, 10, 5f, 1, 2), new MinionConfig("Draugr_Ranged", 3, 5, 5f, 1, 2), new MinionConfig("Surtling", 3, 6, 15f, 1, 2), new MinionConfig("Wraith", 1, 1, 20f, 1, 1), new MinionConfig("Blob", 1, 3, 12f, 1, 1) }; return customRaid; } private static CustomRaid CreateDraugrRaid(int difficulty) { CustomRaid customRaid = new CustomRaid(); customRaid.RaidName = "RuneStoneDraugr"; customRaid.StonePrefix = "RuneStone_Draugr"; customRaid.EndMessage = "The ancient evil has been defeated! The stone crumbled to dust."; customRaid.MinionMessage = "Goal kills"; customRaid.BossMessageSingle = ""; customRaid.ExitMessage = "You have left the trial area! The stone remained untouched."; customRaid.HasBoss = false; customRaid.BossPrefab = ""; customRaid.DifficultyLevel = difficulty; customRaid.DifficultyName = GetDifficultyName(difficulty); customRaid.MinionMinLevel = 1; customRaid.MinionMaxLevel = 3; customRaid.MinionConfigs = new MinionConfig[4] { new MinionConfig("Draugr", 12, 20, 3f, 1, 2), new MinionConfig("Draugr_Ranged", 2, 4, 6f, 1), new MinionConfig("Draugr_Elite", 3, 5, 10f, 1, 2), new MinionConfig("Abomination", 1, 1, 30f, 1, 1) }; return customRaid; } private static CustomRaid CreateMountainsRaid(int difficulty) { CustomRaid customRaid = new CustomRaid(); customRaid.RaidName = "RuneStoneMountains"; customRaid.StonePrefix = "RuneStone_Mountains"; customRaid.EndMessage = "The ancient evil has been defeated! The stone crumbled to dust."; customRaid.MinionMessage = "Goal kills"; customRaid.ExitMessage = "You have left the trial area! The stone remained untouched."; customRaid.HasBoss = true; customRaid.BossPrefab = "Dragon"; customRaid.BossSpawnChance = 50f; customRaid.DifficultyLevel = difficulty; customRaid.DifficultyName = GetDifficultyName(difficulty); customRaid.MinionMinLevel = 1; customRaid.MinionMaxLevel = 4; customRaid.MinionConfigs = new MinionConfig[5] { new MinionConfig("Wolf", 5, 8, 3f, 1, 3), new MinionConfig("Hatchling", 3, 4, 15f, 1, 2), new MinionConfig("StoneGolem", 1, 1, 30f, 1, 1), new MinionConfig("Fenring_Cultist", 1, 2, 15f, 1, 2), new MinionConfig("Fenring", 1, 1, 30f, 1, 1) }; return customRaid; } private static CustomRaid CreatePlainsRaid(int difficulty) { CustomRaid customRaid = new CustomRaid(); customRaid.RaidName = "RuneStonePlains"; customRaid.StonePrefix = "RuneStone_Plains"; customRaid.EndMessage = "The ancient evil has been defeated! The stone crumbled to dust."; customRaid.MinionMessage = "Goal kills"; customRaid.ExitMessage = "You have left the trial area! The stone remained untouched."; customRaid.HasBoss = true; customRaid.BossPrefab = "GoblinKing"; customRaid.BossSpawnChance = 50f; customRaid.DifficultyLevel = difficulty; customRaid.DifficultyName = GetDifficultyName(difficulty); customRaid.MinionMinLevel = 1; customRaid.MinionMaxLevel = 5; customRaid.MinionConfigs = new MinionConfig[4] { new MinionConfig("Goblin", 10, 20, 5f, 1, 3), new MinionConfig("GoblinArcher", 2, 4, 12f, 1, 2), new MinionConfig("GoblinBrute", 1, 2, 20f, 1, 1), new MinionConfig("GoblinShaman", 2, 6, 15f, 1, 1) }; return customRaid; } private static CustomRaid CreateMistLandsRaid(int difficulty) { CustomRaid customRaid = new CustomRaid(); customRaid.RaidName = "RuneStoneMistlands"; customRaid.StonePrefix = "RuneStone_Mistlands"; customRaid.EndMessage = "The ancient evil has been defeated! The stone crumbled to dust."; customRaid.MinionMessage = "Goal kills"; customRaid.ExitMessage = "You have left the trial area! The stone remained untouched."; customRaid.HasBoss = true; customRaid.BossPrefab = "SeekerQueen"; customRaid.BossSpawnChance = 50f; customRaid.DifficultyLevel = difficulty; customRaid.DifficultyName = GetDifficultyName(difficulty); customRaid.MinionMinLevel = 1; customRaid.MinionMaxLevel = 5; customRaid.MinionConfigs = new MinionConfig[4] { new MinionConfig("Seeker", 12, 25, 5f, 1, 3), new MinionConfig("SeekerBrute", 1, 3, 15f, 1, 1), new MinionConfig("Tick", 1, 5, 20f, 1, 5), new MinionConfig("Gjall", 1, 1, 30f, 1, 1) }; return customRaid; } private static CustomRaid CreateAshlandsRaid(int difficulty) { CustomRaid customRaid = new CustomRaid(); customRaid.RaidName = "RuneStoneAshlands"; customRaid.StonePrefix = "RuneStone_Ashlands"; customRaid.EndMessage = "The ancient evil has been defeated! The stone crumbled to dust."; customRaid.MinionMessage = "Goal kills"; customRaid.ExitMessage = "You have left the trial area! The stone remained untouched."; customRaid.HasBoss = true; customRaid.BossPrefab = "Fader"; customRaid.BossSpawnChance = 50f; customRaid.DifficultyLevel = difficulty; customRaid.DifficultyName = GetDifficultyName(difficulty); customRaid.MinionMinLevel = 1; customRaid.MinionMaxLevel = 5; customRaid.MinionConfigs = new MinionConfig[7] { new MinionConfig("Charred_Melee", 6, 12, 5f, 1, 3), new MinionConfig("Charred_Archer", 2, 4, 10f, 1, 2), new MinionConfig("Charred_Mage", 1, 2, 20f, 1, 2), new MinionConfig("Morgen", 1, 1, 40f, 1, 1), new MinionConfig("FallenValkyrie", 1, 1, 30f, 1, 1), new MinionConfig("Asksvin", 1, 3, 20f, 1, 2), new MinionConfig("Charred_Twitcher", 1, 3, 25f, 1, 3) }; return customRaid; } public static int RollDifficulty() { float num = Random.Range(0f, 100f); if (num < 50f) { return 1; } if (num < 80f) { return 2; } return 3; } public static string GetDifficultyName(int level) { return level switch { 1 => "Easy", 2 => "Medium", 3 => "Hard", _ => "???", }; } } public static class CustomRaidLoot { private static readonly string[] Meadows_Item1 = new string[5] { "QueenBee", "Feathers", "Dandelion", "Resin", "Flint" }; private static readonly int[] Meadows_Item1Min = new int[5] { 1, 5, 3, 12, 3 }; private static readonly int[] Meadows_Item1Max = new int[5] { 2, 12, 8, 20, 12 }; private static readonly string[] Meadows_Item2 = new string[5] { "fish1", "DeerHide", "ArrowFire", "LeatherScraps", "MeadHealthMedium" }; private static readonly int[] Meadows_Item2Min = new int[5] { 1, 8, 20, 8, 1 }; private static readonly int[] Meadows_Item2Max = new int[5] { 5, 20, 30, 20, 2 }; private static readonly string[] Meadows_Item3 = new string[5] { "Ruby", "Amber", "AmberPearl", "SurtlingCore", "MeadHasty" }; private static readonly int[] Meadows_Item3Min = new int[5] { 3, 3, 3, 2, 1 }; private static readonly int[] Meadows_Item3Max = new int[5] { 5, 7, 6, 4, 2 }; private const int Meadows_CoinsPerMinion = 30; private const int Meadows_CoinsPerBoss = 100; private static readonly string[] BF_Item1 = new string[5] { "GreydwarfEye", "TrollHide", "Thunderstone", "Copper", "Tin" }; private static readonly int[] BF_Item1Min = new int[5] { 10, 4, 2, 20, 20 }; private static readonly int[] BF_Item1Max = new int[5] { 13, 8, 3, 30, 30 }; private static readonly string[] BF_Item2 = new string[5] { "Bronze", "Thistle", "MeadStaminaMedium", "MeadSwimmer", "MeadPoisonResist" }; private static readonly int[] BF_Item2Min = new int[5] { 10, 8, 2, 2, 2 }; private static readonly int[] BF_Item2Max = new int[5] { 20, 15, 3, 3, 3 }; private static readonly string[] BF_Item3 = new string[5] { "Ruby", "Amber", "AmberPearl", "SurtlingCore", "MeadLightfoot" }; private static readonly int[] BF_Item3Min = new int[5] { 3, 3, 3, 2, 1 }; private static readonly int[] BF_Item3Max = new int[5] { 5, 7, 6, 4, 2 }; private const int BF_CoinsPerMinion = 40; private const int BF_CoinsPerBoss = 200; private static readonly string[] BR_Item1 = new string[5] { "CookedMeat", "MeadHealthMinor", "MeadStaminaMinor", "BoarJerky", "Honey" }; private static readonly int[] BR_Item1Min = new int[5] { 5, 1, 1, 5, 10 }; private static readonly int[] BR_Item1Max = new int[5] { 10, 2, 2, 10, 30 }; private static readonly string[] BR_Item2 = new string[5] { "BombOoze", "BombBlob_Poison", "NeckTail", "CookedLoxMeat", "CookedWolfMeat" }; private static readonly int[] BR_Item2Min = new int[5] { 5, 3, 5, 1, 1 }; private static readonly int[] BR_Item2Max = new int[5] { 10, 6, 15, 2, 2 }; private static readonly string[] BR_Item3 = new string[5] { "Ruby", "Amber", "AmberPearl", "SurtlingCore", "MeadLightfoot" }; private static readonly int[] BR_Item3Min = new int[5] { 3, 3, 3, 2, 1 }; private static readonly int[] BR_Item3Max = new int[5] { 5, 7, 6, 4, 2 }; private const int BR_CoinsPerMinion = 20; private const int BR_CoinsPerBoss = 0; private static readonly string[] GDF_Item1 = new string[5] { "QueensJam", "MeadTasty", "MeadStaminaMinor", "BoarJerky", "Honey" }; private static readonly int[] GDF_Item1Min = new int[5] { 5, 1, 1, 5, 10 }; private static readonly int[] GDF_Item1Max = new int[5] { 10, 2, 2, 10, 30 }; private static readonly string[] GDF_Item2 = new string[5] { "BombOoze", "BombBlob_Poison", "Resin", "CookedLoxMeat", "CookedWolfMeat" }; private static readonly int[] GDF_Item2Min = new int[5] { 5, 3, 30, 1, 1 }; private static readonly int[] GDF_Item2Max = new int[5] { 10, 6, 40, 2, 2 }; private static readonly string[] GDF_Item3 = new string[5] { "Ruby", "Amber", "AmberPearl", "SurtlingCore", "MeadLightfoot" }; private static readonly int[] GDF_Item3Min = new int[5] { 3, 3, 3, 2, 1 }; private static readonly int[] GDF_Item3Max = new int[5] { 5, 7, 6, 4, 2 }; private const int GDF_CoinsPerMinion = 25; private const int GDF_CoinsPerBoss = 0; private static readonly string[] SW_Item1 = new string[5] { "IronScrap", "Iron", "Chain", "Iron", "IronScrap" }; private static readonly int[] SW_Item1Min = new int[5] { 40, 20, 5, 10, 20 }; private static readonly int[] SW_Item1Max = new int[5] { 70, 30, 10, 20, 40 }; private static readonly string[] SW_Item2 = new string[5] { "TurnipSeeds", "MeadBzerker", "MeadHealthMajor", "PiquantPie", "MeadPoisonResist" }; private static readonly int[] SW_Item2Min = new int[5] { 8, 2, 3, 2, 5 }; private static readonly int[] SW_Item2Max = new int[5] { 15, 4, 4, 4, 12 }; private static readonly string[] SW_Item3 = new string[5] { "Ruby", "Amber", "AmberPearl", "SurtlingCore", "MeadFrostResist" }; private static readonly int[] SW_Item3Min = new int[5] { 5, 5, 5, 3, 3 }; private static readonly int[] SW_Item3Max = new int[5] { 10, 15, 15, 6, 5 }; private const int SW_CoinsPerMinion = 50; private const int SW_CoinsPerBoss = 300; private static readonly string[] DG_Item1 = new string[5] { "IronScrap", "Iron", "Chain", "Iron", "IronScrap" }; private static readonly int[] DG_Item1Min = new int[5] { 40, 20, 5, 10, 20 }; private static readonly int[] DG_Item1Max = new int[5] { 70, 30, 10, 20, 40 }; private static readonly string[] DG_Item2 = new string[5] { "TurnipSeeds", "MeadBzerker", "MeadHealthMajor", "PiquantPie", "MeadPoisonResist" }; private static readonly int[] DG_Item2Min = new int[5] { 8, 2, 3, 2, 5 }; private static readonly int[] DG_Item2Max = new int[5] { 15, 4, 4, 4, 12 }; private static readonly string[] DG_Item3 = new string[5] { "Ruby", "Amber", "AmberPearl", "SurtlingCore", "MeadFrostResist" }; private static readonly int[] DG_Item3Min = new int[5] { 5, 5, 5, 3, 3 }; private static readonly int[] DG_Item3Max = new int[5] { 10, 15, 15, 6, 5 }; private const int DG_CoinsPerMinion = 55; private const int DG_CoinsPerBoss = 0; private static readonly string[] DR_Item1 = new string[5] { "Silver", "Crystal", "SilverOre", "Silver", "SilverOre" }; private static readonly int[] DR_Item1Min = new int[5] { 40, 50, 50, 30, 30 }; private static readonly int[] DR_Item1Max = new int[5] { 70, 100, 120, 50, 40 }; private static readonly string[] DR_Item2 = new string[5] { "WolfClaw", "DragonEgg", "DragonTear", "OnionSeeds", "JuteRed" }; private static readonly int[] DR_Item2Min = new int[5] { 5, 1, 10, 30, 10 }; private static readonly int[] DR_Item2Max = new int[5] { 10, 1, 20, 40, 20 }; private static readonly string[] DR_Item3 = new string[5] { "Ruby", "Amber", "AmberPearl", "SurtlingCore", "MeatPlatter" }; private static readonly int[] DR_Item3Min = new int[5] { 8, 10, 10, 3, 10 }; private static readonly int[] DR_Item3Max = new int[5] { 10, 15, 15, 6, 12 }; private const int DR_CoinsPerMinion = 60; private const int DR_CoinsPerBoss = 400; private static readonly string[] PL_Item1 = new string[5] { "BlackMetal", "BlackMetal", "YagluthDrop", "Tar", "Barley" }; private static readonly int[] PL_Item1Min = new int[5] { 30, 50, 10, 50, 50 }; private static readonly int[] PL_Item1Max = new int[5] { 40, 60, 20, 100, 70 }; private static readonly string[] PL_Item2 = new string[5] { "ChickenEgg", "fish6", "Needle", "LinenThread", "GoblinTotem" }; private static readonly int[] PL_Item2Min = new int[5] { 3, 10, 15, 30, 10 }; private static readonly int[] PL_Item2Max = new int[5] { 6, 15, 25, 40, 20 }; private static readonly string[] PL_Item3 = new string[5] { "Ruby", "Amber", "AmberPearl", "SurtlingCore", "SilverNecklace" }; private static readonly int[] PL_Item3Min = new int[5] { 15, 15, 15, 3, 10 }; private static readonly int[] PL_Item3Max = new int[5] { 20, 20, 20, 6, 15 }; private const int PL_CoinsPerMinion = 65; private const int PL_CoinsPerBoss = 500; private static readonly string[] ML_Item1 = new string[5] { "YggdrasilWood", "SoftTissue", "BlackMarble", "SeekerAspic", "MeadEitrMinor" }; private static readonly int[] ML_Item1Min = new int[5] { 20, 10, 20, 5, 5 }; private static readonly int[] ML_Item1Max = new int[5] { 30, 20, 30, 7, 10 }; private static readonly string[] ML_Item2 = new string[5] { "BlackCore", "Sap", "QueenDrop", "Mandible", "Bilebag" }; private static readonly int[] ML_Item2Min = new int[5] { 3, 10, 2, 5, 5 }; private static readonly int[] ML_Item2Max = new int[5] { 5, 15, 4, 6, 6 }; private static readonly string[] ML_Item3 = new string[5] { "Ruby", "Amber", "AmberPearl", "SurtlingCore", "Eitr" }; private static readonly int[] ML_Item3Min = new int[5] { 15, 15, 15, 5, 5 }; private static readonly int[] ML_Item3Max = new int[5] { 20, 20, 20, 6, 15 }; private const int ML_CoinsPerMinion = 70; private const int ML_CoinsPerBoss = 600; private static readonly string[] AL_Item1 = new string[5] { "FlametalNew", "FlametalNew", "AskHide", "AskBladder", "BonemawSerpentTooth" }; private static readonly int[] AL_Item1Min = new int[5] { 20, 10, 10, 10, 10 }; private static readonly int[] AL_Item1Max = new int[5] { 30, 30, 20, 20, 20 }; private static readonly string[] AL_Item2 = new string[5] { "GemstoneGreen", "GemstoneBlue", "GemstoneGreen", "ProustitePowder", "FaderDrop" }; private static readonly int[] AL_Item2Min = new int[5] { 5, 5, 5, 10, 3 }; private static readonly int[] AL_Item2Max = new int[5] { 15, 15, 15, 20, 6 }; private static readonly string[] AL_Item3 = new string[5] { "Ruby", "Amber", "AmberPearl", "SurtlingCore", "Bell" }; private static readonly int[] AL_Item3Min = new int[5] { 15, 15, 15, 5, 1 }; private static readonly int[] AL_Item3Max = new int[5] { 20, 20, 20, 6, 1 }; private const int AL_CoinsPerMinion = 70; private const int AL_CoinsPerBoss = 600; public static void CreateLootChest(Vector3 pos, Quaternion rot, CustomRaid raid) { //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) GameObject prefab = ZNetScene.instance.GetPrefab("piece_chest_wood"); if ((Object)(object)prefab == (Object)null) { return; } GameObject val = Object.Instantiate(prefab, pos, rot); Container component = val.GetComponent(); if ((Object)(object)component == (Object)null) { return; } Inventory inventory = component.GetInventory(); if (inventory == null) { return; } string[] prefabs = Meadows_Item1; string[] prefabs2 = Meadows_Item2; string[] prefabs3 = Meadows_Item3; int[] minStack = Meadows_Item1Min; int[] maxStack = Meadows_Item1Max; int[] minStack2 = Meadows_Item2Min; int[] maxStack2 = Meadows_Item2Max; int[] minStack3 = Meadows_Item3Min; int[] maxStack3 = Meadows_Item3Max; int num = 30; int num2 = 100; if (raid.RaidName == "RuneStoneRaidBlackForest") { num = 40; num2 = 200; prefabs = BF_Item1; prefabs2 = BF_Item2; prefabs3 = BF_Item3; minStack = BF_Item1Min; maxStack = BF_Item1Max; minStack2 = BF_Item2Min; maxStack2 = BF_Item2Max; minStack3 = BF_Item3Min; maxStack3 = BF_Item3Max; } else if (raid.RaidName == "RuneStoneRaidBoars") { num = 20; num2 = 0; prefabs = BR_Item1; prefabs2 = BR_Item2; prefabs3 = BR_Item3; minStack = BR_Item1Min; maxStack = BR_Item1Max; minStack2 = BR_Item2Min; maxStack2 = BR_Item2Max; minStack3 = BR_Item3Min; maxStack3 = BR_Item3Max; } else if (raid.RaidName == "RuneStoneGreydwarfs") { num = 25; num2 = 0; prefabs = GDF_Item1; prefabs2 = GDF_Item2; prefabs3 = GDF_Item3; minStack = GDF_Item1Min; maxStack = GDF_Item1Max; minStack2 = GDF_Item2Min; maxStack2 = GDF_Item2Max; minStack3 = GDF_Item3Min; maxStack3 = GDF_Item3Max; } else if (raid.RaidName == "RuneStoneSwamps") { num = 50; num2 = 300; prefabs = SW_Item1; prefabs2 = SW_Item2; prefabs3 = SW_Item3; minStack = SW_Item1Min; maxStack = SW_Item1Max; minStack2 = SW_Item2Min; maxStack2 = SW_Item2Max; minStack3 = SW_Item3Min; maxStack3 = SW_Item3Max; } else if (raid.RaidName == "RuneStoneDraugr") { num = 55; num2 = 0; prefabs = DG_Item1; prefabs2 = DG_Item2; prefabs3 = DG_Item3; minStack = DG_Item1Min; maxStack = DG_Item1Max; minStack2 = DG_Item2Min; maxStack2 = DG_Item2Max; minStack3 = DG_Item3Min; maxStack3 = DG_Item3Max; } else if (raid.RaidName == "RuneStoneMountains") { num = 60; num2 = 400; prefabs = DR_Item1; prefabs2 = DR_Item2; prefabs3 = DR_Item3; minStack = DR_Item1Min; maxStack = DR_Item1Max; minStack2 = DR_Item2Min; maxStack2 = DR_Item2Max; minStack3 = DR_Item3Min; maxStack3 = DR_Item3Max; } else if (raid.RaidName == "RuneStonePlains") { num = 65; num2 = 500; prefabs = PL_Item1; prefabs2 = PL_Item2; prefabs3 = PL_Item3; minStack = PL_Item1Min; maxStack = PL_Item1Max; minStack2 = PL_Item2Min; maxStack2 = PL_Item2Max; minStack3 = PL_Item3Min; maxStack3 = PL_Item3Max; } else if (raid.RaidName == "RuneStoneMistlands") { num = 70; num2 = 600; prefabs = ML_Item1; prefabs2 = ML_Item2; prefabs3 = ML_Item3; minStack = ML_Item1Min; maxStack = ML_Item1Max; minStack2 = ML_Item2Min; maxStack2 = ML_Item2Max; minStack3 = ML_Item3Min; maxStack3 = ML_Item3Max; } else if (raid.RaidName == "RuneStoneAshlands") { num = 70; num2 = 600; prefabs = AL_Item1; prefabs2 = AL_Item2; prefabs3 = AL_Item3; minStack = AL_Item1Min; maxStack = AL_Item1Max; minStack2 = AL_Item2Min; maxStack2 = AL_Item2Max; minStack3 = AL_Item3Min; maxStack3 = AL_Item3Max; } int num3 = raid.TotalToSpawn * num + raid.DifficultyLevel * num2; if (num3 > 0) { GameObject itemPrefab = ObjectDB.instance.GetItemPrefab("Coins"); if ((Object)(object)itemPrefab != (Object)null) { ItemDrop component2 = itemPrefab.GetComponent(); if ((Object)(object)component2 != (Object)null) { ItemData val2 = component2.m_itemData.Clone(); val2.m_stack = num3; val2.m_dropPrefab = itemPrefab; inventory.AddItem(val2); } } } AddRandomItem(inventory, prefabs, minStack, maxStack, raid.DifficultyLevel); AddRandomItem(inventory, prefabs2, minStack2, maxStack2, raid.DifficultyLevel); AddRandomItem(inventory, prefabs3, minStack3, maxStack3, raid.DifficultyLevel); ZNetView component3 = val.GetComponent(); if ((Object)(object)component3 != (Object)null && component3.IsValid()) { component3.GetZDO().Set(ZDOVars.s_addedDefaultItems, true); } } private static void AddRandomItem(Inventory inv, string[] prefabs, int[] minStack, int[] maxStack, int difficulty) { int num = Random.Range(0, prefabs.Length); string text = prefabs[num]; if (text == "none") { return; } GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(text); if ((Object)(object)itemPrefab == (Object)null) { return; } ItemDrop component = itemPrefab.GetComponent(); if ((Object)(object)component == (Object)null) { return; } int num2 = Random.Range(minStack[num], maxStack[num] + 1) * difficulty; if (num2 > 0) { int maxStackSize = component.m_itemData.m_shared.m_maxStackSize; while (num2 > 0) { int num3 = Mathf.Min(num2, maxStackSize); num2 -= num3; ItemData val = component.m_itemData.Clone(); val.m_stack = num3; val.m_dropPrefab = itemPrefab; inv.AddItem(val); } } } } public class CustomRaidManager : MonoBehaviour { private List _activeRaids = new List(); public static CustomRaidManager Instance { get; private set; } private void Awake() { Instance = this; } private void Update() { float deltaTime = Time.deltaTime; for (int num = _activeRaids.Count - 1; num >= 0; num--) { CustomRaid customRaid = _activeRaids[num]; customRaid.Update(deltaTime); if (!customRaid.IsActive) { _activeRaids.RemoveAt(num); } } } public bool HasActiveRaidOnStone(GameObject stone) { foreach (CustomRaid activeRaid in _activeRaids) { if ((Object)(object)activeRaid.RuneStone == (Object)(object)stone) { return true; } } return false; } public bool HasActiveRaid(string raidName) { foreach (CustomRaid activeRaid in _activeRaids) { if (activeRaid.RaidName == raidName) { return true; } } return false; } public bool HasActiveRaid() { return _activeRaids.Count > 0; } public void RegisterRaid(CustomRaid raid) { raid.Start(); _activeRaids.Add(raid); } public void StartCoroutine(IEnumerator routine) { ((MonoBehaviour)this).StartCoroutine(routine); } } public static class CustomRaidMessages { private static GameObject _counterObject; private static Text _counterText; public static void ShowStartMessage(string text) { if ((Object)(object)MessageHud.instance != (Object)null) { MessageHud.instance.ShowMessage((MessageType)2, text, 0, (Sprite)null, false); } } public static void ShowCounter(int killed, int total) { if ((Object)(object)_counterObject == (Object)null) { CreateCounterUI(); } if ((Object)(object)_counterText != (Object)null) { _counterText.text = $"Goal kills: {killed}/{total}"; _counterObject.SetActive(true); } } private static void CreateCounterUI() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown //IL_00ae: 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_00e7: 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_011e: 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_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) Hud instance = Hud.instance; Transform val = ((instance != null) ? ((Component)instance).transform : null); if (!((Object)(object)val == (Object)null)) { Canvas componentInParent = ((Component)val).GetComponentInParent(); if (!((Object)(object)componentInParent == (Object)null)) { _counterObject = new GameObject("CustomRaidCounter"); _counterObject.transform.SetParent(((Component)componentInParent).transform, false); _counterText = _counterObject.AddComponent(); _counterText.font = Resources.GetBuiltinResource("LegacyRuntime.ttf"); _counterText.fontSize = 28; ((Graphic)_counterText).color = new Color(1f, 0.85f, 0.3f, 1f); _counterText.alignment = (TextAnchor)1; Outline val2 = _counterObject.AddComponent(); ((Shadow)val2).effectColor = Color.black; ((Shadow)val2).effectDistance = new Vector2(1f, -1f); RectTransform component = _counterObject.GetComponent(); component.anchorMin = new Vector2(0.5f, 0.9f); component.anchorMax = new Vector2(0.5f, 0.9f); component.pivot = new Vector2(0.5f, 0.5f); component.sizeDelta = new Vector2(500f, 50f); component.anchoredPosition = Vector2.zero; } } } public static void HideCounter() { if ((Object)(object)_counterObject != (Object)null) { Object.Destroy((Object)(object)_counterObject); _counterObject = null; _counterText = null; } } public static void ShowBossMessage(string text) { ShowStartMessage(text); } public static void ShowEndMessage(string text) { HideCounter(); if ((Object)(object)MessageHud.instance != (Object)null) { MessageHud.instance.ShowMessage((MessageType)2, text, 0, (Sprite)null, false); } } } [BepInPlugin("lizzardfyll.runestonetrials", "Runestone Trials", "1.1.1")] public class CustomRaidPlugin : BaseUnityPlugin { public static ConfigEntry ShowStoneMarkers; public static ConfigEntry EnemyMultiplier; private void Awake() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Expected O, but got Unknown ShowStoneMarkers = ((BaseUnityPlugin)this).Config.Bind("General", "ShowStoneMarkers", true, "Show runestone markers on the minimap when nearby"); EnemyMultiplier = ((BaseUnityPlugin)this).Config.Bind("General", "EnemyMultiplier", 1, new ConfigDescription("If you don't have enough enemies, you can multiply their total number. (1-3)", (AcceptableValueBase)(object)new AcceptableValueRange(1, 3), Array.Empty())); GameObject val = new GameObject("CustomRaidManager"); val.AddComponent(); val.AddComponent(); Object.DontDestroyOnLoad((Object)(object)val); Harmony val2 = new Harmony("lizzardfyll.runestonetrials"); val2.PatchAll(); } } [HarmonyPatch(typeof(RuneStone), "Interact")] public static class CustomRaidStonePatch { private static void Postfix(RuneStone __instance, Humanoid character, bool hold, bool alt) { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) if (hold) { return; } Player val = (Player)(object)((character is Player) ? character : null); if (!((Object)(object)val == (Object)null) && !((Object)(object)CustomRaidManager.Instance == (Object)null) && !CustomRaidManager.Instance.HasActiveRaidOnStone(((Component)__instance).gameObject)) { int difficulty = CustomRaidFactory.RollDifficulty(); CustomRaid customRaid = CustomRaidFactory.CreateRaid(((Object)__instance).name, difficulty); if (customRaid != null) { customRaid.RaidCenter = ((Component)val).transform.position; customRaid.RuneStone = ((Component)__instance).gameObject; customRaid.EnemyMultiplier = CustomRaidPlugin.EnemyMultiplier.Value; CustomRaidManager.Instance.RegisterRaid(customRaid); } } } } public static class CustomRaidZoneDisplay { private static PinData _areaPin; private static PinData _eventPin; public static void ShowZone(Vector3 center, float radius) { //IL_000c: 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_0020: 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_0055: 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) HideZone(); _areaPin = Minimap.instance.AddPin(center, (PinType)13, "", false, false, 0L, default(PlatformUserID)); _areaPin.m_worldSize = radius * 2f * 0.9f; _eventPin = Minimap.instance.AddPin(center, (PinType)11, "", false, false, 0L, default(PlatformUserID)); _eventPin.m_animate = true; _eventPin.m_doubleSize = true; } public static void HideZone() { if (_areaPin != null) { Minimap.instance.RemovePin(_areaPin); _areaPin = null; } if (_eventPin != null) { Minimap.instance.RemovePin(_eventPin); _eventPin = null; } } } public class MinionConfig { public string PrefabName; public int MinCount; public int MaxCount; public float SpawnInterval; public int GroupSizeMin; public int GroupSizeMax; public MinionConfig(string prefabName, int minCount, int maxCount, float spawnInterval = 4f, int groupSizeMin = 2, int groupSizeMax = 4) { PrefabName = prefabName; MinCount = minCount; MaxCount = maxCount; SpawnInterval = spawnInterval; GroupSizeMin = groupSizeMin; GroupSizeMax = groupSizeMax; } public int GetRandomCount() { return Random.Range(MinCount, MaxCount + 1); } } public static class RunestoneMarkers { private static HashSet _markedPositions = new HashSet(); public static void FindAndMarkStones(Vector3 playerPos) { //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_0026: 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_0036: 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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) RuneStone[] array = Object.FindObjectsByType((FindObjectsSortMode)0); RuneStone[] array2 = array; foreach (RuneStone val in array2) { Vector3 position = ((Component)val).transform.position; if (!_markedPositions.Contains(position)) { float num = Vector3.Distance(playerPos, position); if (num < 160f) { Minimap.instance.AddPin(position, (PinType)3, "RuneStone", true, false, 0L, default(PlatformUserID)); _markedPositions.Add(position); } } } CheckDestroyedStones(array); } private static void CheckDestroyedStones(RuneStone[] activeStones) { //IL_001c: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0076: 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_00b4: Unknown result type (might be due to invalid IL or missing references) HashSet hashSet = new HashSet(); foreach (RuneStone val in activeStones) { hashSet.Add(((Component)val).transform.position); } List list = new List(); foreach (Vector3 markedPosition in _markedPositions) { if (!hashSet.Contains(markedPosition)) { Minimap.instance.RemovePin(markedPosition, 1f); list.Add(markedPosition); } } foreach (Vector3 item in list) { _markedPositions.Remove(item); } } public static void RemoveAllMarkers() { _markedPositions.Clear(); } } public class RunestoneMarkerUpdater : MonoBehaviour { private float _timer; private void Update() { //IL_0072: Unknown result type (might be due to invalid IL or missing references) if (CustomRaidPlugin.ShowStoneMarkers.Value && !((Object)(object)Minimap.instance == (Object)null) && !((Object)(object)Player.m_localPlayer == (Object)null)) { _timer += Time.deltaTime; if (_timer >= 4f) { _timer = 0f; RunestoneMarkers.FindAndMarkStones(((Component)Player.m_localPlayer).transform.position); } } } private void OnDestroy() { RunestoneMarkers.RemoveAllMarkers(); } }