Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of ProtectionRunes v0.2.2
plugins/ProtectionRunes.dll
Decompiled 6 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using Jotunn; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("ProtectionRunes")] [assembly: AssemblyDescription("Protect your bases from enemies with the Runes of the Forsaken")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("proflupin")] [assembly: AssemblyProduct("ProtectionRunes")] [assembly: AssemblyCopyright("Copyright © proflupin 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("7e61f470-fb41-4c6b-a654-4e199ea7d009")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = "")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [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 ProtectionRunes { [BepInPlugin("proflupin.protectionrunes", "ProtectionRunes", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class ProtectionRunes : BaseUnityPlugin { public const string PluginGUID = "proflupin.protectionrunes"; public const string PluginName = "ProtectionRunes"; public const string PluginVersion = "1.0.0"; private ConfigEntry<bool> useCubeShape; private ConfigEntry<float> eikthyrRadius; private ConfigEntry<float> elderRadius; private ConfigEntry<float> bonemassRadius; private ConfigEntry<float> moderRadius; private ConfigEntry<float> yagluthRadius; private ConfigEntry<float> queenRadius; private ConfigEntry<float> faderRadius; private ConfigEntry<string> meadowsEnemies; private ConfigEntry<string> blackForestEnemies; private ConfigEntry<string> swampEnemies; private ConfigEntry<string> mountainEnemies; private ConfigEntry<string> plainsEnemies; private ConfigEntry<string> mistlandsEnemies; private ConfigEntry<string> ashlandsEnemies; private ConfigEntry<string> eikthyrRecipeStr; private ConfigEntry<int> eikthyrMinStation; private ConfigEntry<string> elderRecipeStr; private ConfigEntry<int> elderMinStation; private ConfigEntry<string> bonemassRecipeStr; private ConfigEntry<int> bonemassMinStation; private ConfigEntry<string> moderRecipeStr; private ConfigEntry<int> moderMinStation; private ConfigEntry<string> yagluthRecipeStr; private ConfigEntry<int> yagluthMinStation; private ConfigEntry<string> queenRecipeStr; private ConfigEntry<int> queenMinStation; private ConfigEntry<string> faderRecipeStr; private ConfigEntry<int> faderMinStation; private static readonly int PieceLayerMask = LayerMask.GetMask(new string[1] { "piece" }); private const string EikthyrRunePrefab = "EikthyrRune"; private const string ElderRunePrefab = "ElderRune"; private const string BonemassRunePrefab = "BonemassRune"; private const string ModerRunePrefab = "ModerRune"; private const string YagluthRunePrefab = "YagluthRune"; private const string QueenRunePrefab = "QueenRune"; private const string FaderRunePrefab = "FaderRune"; private void Awake() { //IL_0431: Unknown result type (might be due to invalid IL or missing references) //IL_043b: Expected O, but got Unknown //IL_045b: Unknown result type (might be due to invalid IL or missing references) //IL_0465: Expected O, but got Unknown //IL_0489: Unknown result type (might be due to invalid IL or missing references) //IL_0493: Expected O, but got Unknown //IL_04b7: Unknown result type (might be due to invalid IL or missing references) //IL_04c1: Expected O, but got Unknown //IL_04e5: Unknown result type (might be due to invalid IL or missing references) //IL_04ef: Expected O, but got Unknown //IL_0513: Unknown result type (might be due to invalid IL or missing references) //IL_051d: Expected O, but got Unknown //IL_0541: Unknown result type (might be due to invalid IL or missing references) //IL_054b: Expected O, but got Unknown useCubeShape = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "UseCubeShape", false, "Use cube-shaped protection area instead of sphere."); eikthyrRadius = ((BaseUnityPlugin)this).Config.Bind<float>("Radii", "EikthyrRadius", 50f, "Protection radius for Eikthyr Rune (Meadows)."); elderRadius = ((BaseUnityPlugin)this).Config.Bind<float>("Radii", "ElderRadius", 50f, "Protection radius for Elder Rune (Black Forest)."); bonemassRadius = ((BaseUnityPlugin)this).Config.Bind<float>("Radii", "BonemassRadius", 50f, "Protection radius for Bonemass Rune (Swamp)."); moderRadius = ((BaseUnityPlugin)this).Config.Bind<float>("Radii", "ModerRadius", 50f, "Protection radius for Moder Rune (Mountain)."); yagluthRadius = ((BaseUnityPlugin)this).Config.Bind<float>("Radii", "YagluthRadius", 50f, "Protection radius for Yagluth Rune (Plains)."); queenRadius = ((BaseUnityPlugin)this).Config.Bind<float>("Radii", "QueenRadius", 50f, "Protection radius for Queen Rune (Mistlands)."); faderRadius = ((BaseUnityPlugin)this).Config.Bind<float>("Radii", "FaderRadius", 50f, "Protection radius for Fader Rune (Ashlands)."); meadowsEnemies = ((BaseUnityPlugin)this).Config.Bind<string>("Enemies", "Meadows", "Greyling,Neck,Boar,Deer", "Comma-separated enemy name substrings to block in Meadows."); blackForestEnemies = ((BaseUnityPlugin)this).Config.Bind<string>("Enemies", "BlackForest", "Troll,Skeleton,Ghost,Greydwarf,Greydwarf_Elite,Greydwarf_Shaman", "Comma-separated enemy name substrings to block in Black Forest."); swampEnemies = ((BaseUnityPlugin)this).Config.Bind<string>("Enemies", "Swamp", "Draugr,Draugr_Elite,Wraith,Surtling,Leech", "Comma-separated enemy name substrings to block in Swamp."); mountainEnemies = ((BaseUnityPlugin)this).Config.Bind<string>("Enemies", "Mountain", "Wolf,Hatchling,Fenring,SGolem", "Comma-separated enemy name substrings to block in Mountain."); plainsEnemies = ((BaseUnityPlugin)this).Config.Bind<string>("Enemies", "Plains", "Goblin,GoblinBrute,GoblinShaman,Lox,Deathsquito", "Comma-separated enemy name substrings to block in Plains."); mistlandsEnemies = ((BaseUnityPlugin)this).Config.Bind<string>("Enemies", "Mistlands", "Seeker,Dvergr,Tick,SeekerBrute,SeekerBrood,Gjall", "Comma-separated enemy name substrings to block in Mistlands."); ashlandsEnemies = ((BaseUnityPlugin)this).Config.Bind<string>("Enemies", "Ashlands", "Asksvin,Volture,BonemawSerpent,BlobLava,FallenValkyrie,Charred_Mage,Charred_Archer,Charred_Twitcher,Morgen,Charred_Melee", "Comma-separated enemy name substrings to block in Ashlands."); eikthyrRecipeStr = ((BaseUnityPlugin)this).Config.Bind<string>("Recipes", "Eikthyr", "Stone:20,TrophyEikthyr:1", "Comma-separated item:amount for Eikthyr Rune recipe."); eikthyrMinStation = ((BaseUnityPlugin)this).Config.Bind<int>("Recipes", "EikthyrMinStation", 1, "Minimum station level for Eikthyr Rune."); elderRecipeStr = ((BaseUnityPlugin)this).Config.Bind<string>("Recipes", "Elder", "Stone:20,TrophyTheElder:1", "Comma-separated item:amount for Elder Rune recipe."); elderMinStation = ((BaseUnityPlugin)this).Config.Bind<int>("Recipes", "ElderMinStation", 1, "Minimum station level for Elder Rune."); bonemassRecipeStr = ((BaseUnityPlugin)this).Config.Bind<string>("Recipes", "Bonemass", "Stone:20,TrophyBonemass:1", "Comma-separated item:amount for Bonemass Rune recipe."); bonemassMinStation = ((BaseUnityPlugin)this).Config.Bind<int>("Recipes", "BonemassMinStation", 1, "Minimum station level for Bonemass Rune."); moderRecipeStr = ((BaseUnityPlugin)this).Config.Bind<string>("Recipes", "Moder", "Stone:20,TrophyDragonQueen:1", "Comma-separated item:amount for Moder Rune recipe."); moderMinStation = ((BaseUnityPlugin)this).Config.Bind<int>("Recipes", "ModerMinStation", 1, "Minimum station level for Moder Rune."); yagluthRecipeStr = ((BaseUnityPlugin)this).Config.Bind<string>("Recipes", "Yagluth", "Stone:20,TrophyGoblinKing:1", "Comma-separated item:amount for Yagluth Rune recipe."); yagluthMinStation = ((BaseUnityPlugin)this).Config.Bind<int>("Recipes", "YagluthMinStation", 1, "Minimum station level for Yagluth Rune."); queenRecipeStr = ((BaseUnityPlugin)this).Config.Bind<string>("Recipes", "Queen", "Stone:20,TrophySeekerQueen:1", "Comma-separated item:amount for Queen Rune recipe."); queenMinStation = ((BaseUnityPlugin)this).Config.Bind<int>("Recipes", "QueenMinStation", 1, "Minimum station level for Queen Rune."); faderRecipeStr = ((BaseUnityPlugin)this).Config.Bind<string>("Recipes", "Fader", "Stone:20,TrophyFader:1", "Comma-separated item:amount for Fader Rune recipe."); faderMinStation = ((BaseUnityPlugin)this).Config.Bind<int>("Recipes", "FaderMinStation", 1, "Minimum station level for Fader Rune."); PieceConfig val = EikthyrRuneConfig(); GameObject prefab = PrefabManager.Instance.GetPrefab("EikthyrRune"); PieceManager.Instance.AddPiece(new CustomPiece(prefab, true, val)); PieceConfig val2 = ElderRuneConfig(); GameObject prefab2 = PrefabManager.Instance.GetPrefab("ElderRune"); PieceManager.Instance.AddPiece(new CustomPiece(prefab2, true, val2)); PieceConfig val3 = BonemassRuneConfig(); GameObject prefab3 = PrefabManager.Instance.GetPrefab("BonemassRune"); PieceManager.Instance.AddPiece(new CustomPiece(prefab3, true, val3)); PieceConfig val4 = ModerRuneConfig(); GameObject prefab4 = PrefabManager.Instance.GetPrefab("ModerRune"); PieceManager.Instance.AddPiece(new CustomPiece(prefab4, true, val4)); PieceConfig val5 = YagluthRuneConfig(); GameObject prefab5 = PrefabManager.Instance.GetPrefab("YagluthRune"); PieceManager.Instance.AddPiece(new CustomPiece(prefab5, true, val5)); PieceConfig val6 = QueenRuneConfig(); GameObject prefab6 = PrefabManager.Instance.GetPrefab("QueenRune"); PieceManager.Instance.AddPiece(new CustomPiece(prefab6, true, val6)); PieceConfig val7 = FaderRuneConfig(); GameObject prefab7 = PrefabManager.Instance.GetPrefab("FaderRune"); PieceManager.Instance.AddPiece(new CustomPiece(prefab7, true, val7)); ((MonoBehaviour)this).StartCoroutine(SpawnProtectionCoroutine()); Logger.LogInfo((object)"ProtectionRunes loaded successfully."); } private PieceConfig EikthyrRuneConfig() { //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_0012: 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_002a: 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_0049: Expected O, but got Unknown //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown //IL_00a0: 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) PieceConfig val = new PieceConfig { Name = "Eikthyr Rune", Description = "Blocks Meadows enemy spawns in a radius.", PieceTable = PieceTables.Hammer, Icon = GUIManager.Instance.GetSprite("TrophyEikthyr"), Enabled = true }; RecipeConfig val2 = EikthyrRuneRecipeConfig(); val.Requirements = val2.Requirements; ItemManager.Instance.AddRecipe(new CustomRecipe(val2)); GameObject val3 = PrefabManager.Instance.CreateClonedPrefab("EikthyrRune", "gaurd_stone"); Piece component = val3.GetComponent<Piece>(); component.m_description = "Place to shield against Meadows foes."; BiomeProtector biomeProtector = val3.AddComponent<BiomeProtector>(); biomeProtector.biome = (Biome)1; biomeProtector.radius = eikthyrRadius.Value; SetRuneInnerColor(val3, new Color(0.1f, 0.3f, 0.1f)); return val; } private RecipeConfig EikthyrRuneRecipeConfig() { //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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown return new RecipeConfig { Requirements = ParseRecipeString(eikthyrRecipeStr.Value), MinStationLevel = eikthyrMinStation.Value }; } private PieceConfig ElderRuneConfig() { //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_0012: 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_002a: 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_0049: Expected O, but got Unknown //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown //IL_00a0: 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) PieceConfig val = new PieceConfig { Name = "Elder Rune", Description = "Blocks Black Forest enemy spawns in a radius.", PieceTable = PieceTables.Hammer, Icon = GUIManager.Instance.GetSprite("TrophyTheElder"), Enabled = true }; RecipeConfig val2 = ElderRuneRecipeConfig(); val.Requirements = val2.Requirements; ItemManager.Instance.AddRecipe(new CustomRecipe(val2)); GameObject val3 = PrefabManager.Instance.CreateClonedPrefab("ElderRune", "gaurd_stone"); Piece component = val3.GetComponent<Piece>(); component.m_description = "Place to shield against Black Forest foes."; BiomeProtector biomeProtector = val3.AddComponent<BiomeProtector>(); biomeProtector.biome = (Biome)8; biomeProtector.radius = elderRadius.Value; SetRuneInnerColor(val3, new Color(0.35f, 0.22f, 0.1f)); return val; } private RecipeConfig ElderRuneRecipeConfig() { //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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown return new RecipeConfig { Requirements = ParseRecipeString(elderRecipeStr.Value), MinStationLevel = elderMinStation.Value }; } private PieceConfig BonemassRuneConfig() { //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_0012: 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_002a: 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_0049: Expected O, but got Unknown //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown //IL_00a0: 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) PieceConfig val = new PieceConfig { Name = "Bonemass Rune", Description = "Blocks Swamp enemy spawns in a radius.", PieceTable = PieceTables.Hammer, Icon = GUIManager.Instance.GetSprite("TrophyBonemass"), Enabled = true }; RecipeConfig val2 = BonemassRuneRecipeConfig(); val.Requirements = val2.Requirements; ItemManager.Instance.AddRecipe(new CustomRecipe(val2)); GameObject val3 = PrefabManager.Instance.CreateClonedPrefab("BonemassRune", "gaurd_stone"); Piece component = val3.GetComponent<Piece>(); component.m_description = "Place to shield against Swamp foes."; BiomeProtector biomeProtector = val3.AddComponent<BiomeProtector>(); biomeProtector.biome = (Biome)2; biomeProtector.radius = bonemassRadius.Value; SetRuneInnerColor(val3, new Color(0.5f, 0.7f, 0.3f)); return val; } private RecipeConfig BonemassRuneRecipeConfig() { //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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown return new RecipeConfig { Requirements = ParseRecipeString(bonemassRecipeStr.Value), MinStationLevel = bonemassMinStation.Value }; } private PieceConfig ModerRuneConfig() { //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_0012: 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_002a: 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_0049: Expected O, but got Unknown //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown //IL_00a0: 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) PieceConfig val = new PieceConfig { Name = "Moder Rune", Description = "Blocks Mountain enemy spawns in a radius.", PieceTable = PieceTables.Hammer, Icon = GUIManager.Instance.GetSprite("TrophyDragonQueen"), Enabled = true }; RecipeConfig val2 = ModerRuneRecipeConfig(); val.Requirements = val2.Requirements; ItemManager.Instance.AddRecipe(new CustomRecipe(val2)); GameObject val3 = PrefabManager.Instance.CreateClonedPrefab("ModerRune", "gaurd_stone"); Piece component = val3.GetComponent<Piece>(); component.m_description = "Place to shield against Mountain foes."; BiomeProtector biomeProtector = val3.AddComponent<BiomeProtector>(); biomeProtector.biome = (Biome)4; biomeProtector.radius = moderRadius.Value; SetRuneInnerColor(val3, new Color(0.5f, 0.6f, 0.7f)); return val; } private RecipeConfig ModerRuneRecipeConfig() { //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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown return new RecipeConfig { Requirements = ParseRecipeString(moderRecipeStr.Value), MinStationLevel = moderMinStation.Value }; } private PieceConfig YagluthRuneConfig() { //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_0012: 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_002a: 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_0049: Expected O, but got Unknown //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown //IL_00a1: 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) PieceConfig val = new PieceConfig { Name = "Yagluth Rune", Description = "Blocks Plains enemy spawns in a radius.", PieceTable = PieceTables.Hammer, Icon = GUIManager.Instance.GetSprite("TrophyGoblinKing"), Enabled = true }; RecipeConfig val2 = YagluthRuneRecipeConfig(); val.Requirements = val2.Requirements; ItemManager.Instance.AddRecipe(new CustomRecipe(val2)); GameObject val3 = PrefabManager.Instance.CreateClonedPrefab("YagluthRune", "gaurd_stone"); Piece component = val3.GetComponent<Piece>(); component.m_description = "Place to shield against Plains foes."; BiomeProtector biomeProtector = val3.AddComponent<BiomeProtector>(); biomeProtector.biome = (Biome)16; biomeProtector.radius = yagluthRadius.Value; SetRuneInnerColor(val3, new Color(0.95f, 0.85f, 0.2f)); return val; } private RecipeConfig YagluthRuneRecipeConfig() { //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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown return new RecipeConfig { Requirements = ParseRecipeString(yagluthRecipeStr.Value), MinStationLevel = yagluthMinStation.Value }; } private PieceConfig QueenRuneConfig() { //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_0012: 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_002a: 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_0049: Expected O, but got Unknown //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown //IL_00a4: 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) PieceConfig val = new PieceConfig { Name = "Queen Rune", Description = "Blocks Mistlands enemy spawns in a radius.", PieceTable = PieceTables.Hammer, Icon = GUIManager.Instance.GetSprite("TrophySeekerQueen"), Enabled = true }; RecipeConfig val2 = QueenRuneRecipeConfig(); val.Requirements = val2.Requirements; ItemManager.Instance.AddRecipe(new CustomRecipe(val2)); GameObject val3 = PrefabManager.Instance.CreateClonedPrefab("QueenRune", "gaurd_stone"); Piece component = val3.GetComponent<Piece>(); component.m_description = "Place to shield against Mistlands foes."; BiomeProtector biomeProtector = val3.AddComponent<BiomeProtector>(); biomeProtector.biome = (Biome)512; biomeProtector.radius = queenRadius.Value; SetRuneInnerColor(val3, new Color(0.6f, 0.2f, 0.7f)); return val; } private RecipeConfig QueenRuneRecipeConfig() { //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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown return new RecipeConfig { Requirements = ParseRecipeString(queenRecipeStr.Value), MinStationLevel = queenMinStation.Value }; } private PieceConfig FaderRuneConfig() { //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_0012: 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_002a: 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_0049: Expected O, but got Unknown //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown //IL_00a1: 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) PieceConfig val = new PieceConfig { Name = "Fader Rune", Description = "Blocks Ashlands enemy spawns in a radius.", PieceTable = PieceTables.Hammer, Icon = GUIManager.Instance.GetSprite("TrophyFader"), Enabled = true }; RecipeConfig val2 = FaderRuneRecipeConfig(); val.Requirements = val2.Requirements; ItemManager.Instance.AddRecipe(new CustomRecipe(val2)); GameObject val3 = PrefabManager.Instance.CreateClonedPrefab("FaderRune", "gaurd_stone"); Piece component = val3.GetComponent<Piece>(); component.m_description = "Place to shield against Ashlands foes."; BiomeProtector biomeProtector = val3.AddComponent<BiomeProtector>(); biomeProtector.biome = (Biome)32; biomeProtector.radius = faderRadius.Value; SetRuneInnerColor(val3, new Color(0.95f, 0.5f, 0.1f)); return val; } private void SetRuneInnerColor(GameObject prefab, Color color) { //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_021d: 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_0222: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) MeshRenderer[] componentsInChildren = prefab.GetComponentsInChildren<MeshRenderer>(true); MeshRenderer[] array = componentsInChildren; foreach (MeshRenderer val in array) { string text = ((Object)val).name.ToLower(); bool flag = text.Contains("guard") || text.Contains("gaurd") || text.Contains("ward") || text.Contains("stone"); if (!flag) { Material[] sharedMaterials = ((Renderer)val).sharedMaterials; foreach (Material val2 in sharedMaterials) { if ((Object)(object)val2 != (Object)null && ((Object)val2).name != null) { string text2 = ((Object)val2).name.ToLower(); if (text2.Contains("guard") || text2.Contains("gaurd") || text2.Contains("ward") || text2.Contains("stone")) { flag = true; break; } } } } if (!flag) { continue; } Material[] materials = ((Renderer)val).materials; foreach (Material val3 in materials) { if ((Object)(object)val3 == (Object)null) { continue; } try { val3.color = color; } catch { } string[] array2 = new string[5] { "_Color", "_BaseColor", "_TintColor", "_EmissionColor", "_EmColor" }; string[] array3 = array2; foreach (string text3 in array3) { if (val3.HasProperty(text3)) { try { val3.SetColor(text3, color); } catch { } } } } } ParticleSystem[] componentsInChildren2 = prefab.GetComponentsInChildren<ParticleSystem>(true); ParticleSystem[] array4 = componentsInChildren2; foreach (ParticleSystem val4 in array4) { try { MainModule main = val4.main; ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(color); } catch { } } } private RecipeConfig FaderRuneRecipeConfig() { //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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown return new RecipeConfig { Requirements = ParseRecipeString(faderRecipeStr.Value), MinStationLevel = faderMinStation.Value }; } private RequirementConfig[] ParseRecipeString(string recipeStr) { //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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown List<RequirementConfig> list = new List<RequirementConfig>(); string[] array = recipeStr.Split(new char[1] { ',' }); string[] array2 = array; foreach (string text in array2) { string[] array3 = text.Trim().Split(new char[1] { ':' }); if (array3.Length == 2 && int.TryParse(array3[1].Trim(), out var result)) { list.Add(new RequirementConfig { Item = array3[0].Trim(), Amount = result }); } } return list.ToArray(); } private IEnumerator SpawnProtectionCoroutine() { while (true) { yield return (object)new WaitForSeconds(1f); BlockSpawnsInProtectedAreas(); } } private void BlockSpawnsInProtectedAreas() { //IL_005f: 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_0034: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: 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_00d7: Unknown result type (might be due to invalid IL or missing references) BiomeProtector[] array = Object.FindObjectsByType<BiomeProtector>((FindObjectsSortMode)0); BiomeProtector[] array2 = array; foreach (BiomeProtector biomeProtector in array2) { Collider[] array3 = ((!useCubeShape.Value) ? Physics.OverlapSphere(((Component)biomeProtector).transform.position, biomeProtector.radius, PieceLayerMask) : Physics.OverlapBox(((Component)biomeProtector).transform.position, Vector3.one * biomeProtector.radius, Quaternion.identity, PieceLayerMask)); Collider[] array4 = array3; foreach (Collider val in array4) { Character component = ((Component)val).GetComponent<Character>(); if ((Object)(object)component != (Object)null && IsBiomeEnemy(component, biomeProtector.biome)) { component.SetHealth(0f); Logger.LogInfo((object)$"Blocked {biomeProtector.biome} spawn at {((Component)biomeProtector).transform.position}"); } } } } private bool IsBiomeEnemy(Character character, Biome biome) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) string name = ((Object)character).name.ToLower(); string enemiesConfig = GetEnemiesConfig(biome); List<string> source = (from s in enemiesConfig.Split(new char[1] { ',' }) select s.Trim().ToLower()).ToList(); return source.Any((string e) => name.Contains(e)); } private string GetEnemiesConfig(Biome biome) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Invalid comparison between Unknown and I4 //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) //IL_0021: Expected I4, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Invalid comparison between Unknown and I4 //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Invalid comparison between Unknown and I4 //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Invalid comparison between Unknown and I4 if ((int)biome <= 8) { switch (biome - 1) { default: if ((int)biome != 8) { break; } return blackForestEnemies.Value; case 0: return meadowsEnemies.Value; case 1: return swampEnemies.Value; case 3: return mountainEnemies.Value; case 2: break; } } else { if ((int)biome == 16) { return plainsEnemies.Value; } if ((int)biome == 32) { return ashlandsEnemies.Value; } if ((int)biome == 512) { return mistlandsEnemies.Value; } } return ""; } } public class BiomeProtector : MonoBehaviour { public Biome biome; private float _radius; private const string ZDO_BIOME_KEY = "pr_biome"; private const string ZDO_RADIUS_KEY = "pr_radius"; private ZNetView _zv; public float radius { get { return _radius; } set { _radius = value; if ((Object)(object)_zv != (Object)null && _zv.IsValid()) { ZDO zDO = _zv.GetZDO(); if (zDO != null) { zDO.Set("pr_radius", _radius); } } } } private void Awake() { //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected I4, but got Unknown //IL_0072: Unknown result type (might be due to invalid IL or missing references) _zv = ((Component)this).GetComponent<ZNetView>(); if (!((Object)(object)_zv != (Object)null) || !_zv.IsValid()) { return; } ZDO zDO = _zv.GetZDO(); if (zDO != null) { if (zDO.GetInt("pr_biome", int.MinValue) != int.MinValue) { biome = (Biome)zDO.GetInt("pr_biome", 0); radius = zDO.GetFloat("pr_radius", radius); } else { zDO.Set("pr_biome", (int)biome); zDO.Set("pr_radius", radius); } } } private void OnDestroy() { } } }