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 CoarstalsWeaponPack v1.0.1
CoarstalsWeaponPack.dll
Decompiled a day ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.IO; using System.IO.Compression; using System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using Unity.Collections; using UnityEngine; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: AssemblyVersion("0.0.0.0")] namespace NewDualAxesMod; public static class EitrFoodsModule { public const string VanillaNeckTailGrilled = "NeckTailGrilled"; public const string VanillaMushroomYellow = "MushroomYellow"; public const string StuffedNeckPrefab = "FoodStuffedNeck"; public const string NecroSoupPrefab = "FoodNecroSoup"; public const string SadAuferPrefab = "FoodSadAufer"; public const string PlainsTartPrefab = "FoodPlainsTart"; public const string StuffedNeckPiecePrefab = "Piece_FoodStuffedNeck"; public const string NecroSoupPiecePrefab = "Piece_FoodNecroSoup"; public const string SadAuferPiecePrefab = "Piece_FoodSadAufer"; public const string PlainsTartPiecePrefab = "Piece_FoodPlainsTart"; public static ConfigEntry<float> NeckTailGrilledEitr; public static ConfigEntry<float> MushroomYellowEitr; public static ConfigEntry<float> CustomFoodVisualScale; public static ConfigEntry<float> StuffedNeckEitr; public static ConfigEntry<float> StuffedNeckHealth; public static ConfigEntry<float> StuffedNeckStamina; public static ConfigEntry<float> StuffedNeckDurationMinutes; public static ConfigEntry<float> StuffedNeckRegen; public static ConfigEntry<int> StuffedNeckCraftAmount; public static ConfigEntry<int> StuffedNeckMinCauldronLevel; public static ConfigEntry<string> StuffedNeckRecipe; public static ConfigEntry<float> NecroSoupEitr; public static ConfigEntry<float> NecroSoupHealth; public static ConfigEntry<float> NecroSoupStamina; public static ConfigEntry<float> NecroSoupDurationMinutes; public static ConfigEntry<float> NecroSoupRegen; public static ConfigEntry<int> NecroSoupCraftAmount; public static ConfigEntry<int> NecroSoupMinCauldronLevel; public static ConfigEntry<string> NecroSoupRecipe; public static ConfigEntry<float> SadAuferEitr; public static ConfigEntry<float> SadAuferHealth; public static ConfigEntry<float> SadAuferStamina; public static ConfigEntry<float> SadAuferDurationMinutes; public static ConfigEntry<float> SadAuferRegen; public static ConfigEntry<int> SadAuferCraftAmount; public static ConfigEntry<int> SadAuferMinCauldronLevel; public static ConfigEntry<string> SadAuferRecipe; public static ConfigEntry<float> PlainsTartEitr; public static ConfigEntry<float> PlainsTartHealth; public static ConfigEntry<float> PlainsTartStamina; public static ConfigEntry<float> PlainsTartDurationMinutes; public static ConfigEntry<float> PlainsTartRegen; public static ConfigEntry<int> PlainsTartCraftAmount; public static ConfigEntry<int> PlainsTartMinCauldronLevel; public static ConfigEntry<string> PlainsTartRecipe; private static bool s_registered; private static bool s_trayPiecesRegistered; private static bool s_loggedVanillaPatchOnce; internal static Mesh s_stuffedNeckMesh; internal static Material s_stuffedNeckMat; internal static Sprite s_stuffedNeckIcon; internal static Mesh s_necroSoupMesh; internal static Material s_necroSoupMat; internal static Sprite s_necroSoupIcon; internal static Mesh s_sadAuferMesh; internal static Material s_sadAuferMat; internal static Sprite s_sadAuferIcon; internal static Mesh s_plainsTartMesh; internal static Material s_plainsTartMat; internal static Sprite s_plainsTartIcon; public static void BindConfigs(ConfigFile config) { NeckTailGrilledEitr = config.Bind<float>("9. Eitr Foods - Vanilla Boosts", "NeckTailGrilledEitr", 25f, "Eitr granted by vanilla Grilled Neck Tail (NeckTailGrilled). Default HP and Stamina remain unchanged."); MushroomYellowEitr = config.Bind<float>("9. Eitr Foods - Vanilla Boosts", "MushroomYellowEitr", 25f, "Eitr granted by vanilla Yellow Mushroom (MushroomYellow). Default HP and Stamina remain unchanged."); CustomFoodVisualScale = config.Bind<float>("9. Eitr Foods - Vanilla Boosts", "CustomFoodVisualScale", 1f, "Visual 3D model scale multiplier for the 4 custom Eitr dishes (1.0 = large ~0.55m-0.62m Valheim dish size)."); StuffedNeckEitr = config.Bind<float>("10. Eitr Food - Stuffed Neck", "Eitr", 40f, "Max Eitr granted."); StuffedNeckHealth = config.Bind<float>("10. Eitr Food - Stuffed Neck", "Health", 15f, "Max Health granted (average of ingredients)."); StuffedNeckStamina = config.Bind<float>("10. Eitr Food - Stuffed Neck", "Stamina", 20f, "Max Stamina granted (average of ingredients)."); StuffedNeckDurationMinutes = config.Bind<float>("10. Eitr Food - Stuffed Neck", "DurationMinutes", 20f, "Food duration in minutes."); StuffedNeckRegen = config.Bind<float>("10. Eitr Food - Stuffed Neck", "HealthRegen", 2f, "Health regen per tick."); StuffedNeckCraftAmount = config.Bind<int>("10. Eitr Food - Stuffed Neck", "CraftAmount", 1, "Items produced per craft."); StuffedNeckMinCauldronLevel = config.Bind<int>("10. Eitr Food - Stuffed Neck", "MinCauldronLevel", 1, "Minimum Cauldron level required."); StuffedNeckRecipe = config.Bind<string>("10. Eitr Food - Stuffed Neck", "Recipe", "NeckTailGrilled:1,Mushroom:2,MushroomYellow:2", "Cauldron recipe (Prefab:Amount comma-separated)."); NecroSoupEitr = config.Bind<float>("11. Eitr Food - Necromancer Soup", "Eitr", 50f, "Max Eitr granted."); NecroSoupHealth = config.Bind<float>("11. Eitr Food - Necromancer Soup", "Health", 15f, "Max Health granted."); NecroSoupStamina = config.Bind<float>("11. Eitr Food - Necromancer Soup", "Stamina", 40f, "Max Stamina granted."); NecroSoupDurationMinutes = config.Bind<float>("11. Eitr Food - Necromancer Soup", "DurationMinutes", 20f, "Food duration in minutes."); NecroSoupRegen = config.Bind<float>("11. Eitr Food - Necromancer Soup", "HealthRegen", 3f, "Health regen per tick."); NecroSoupCraftAmount = config.Bind<int>("11. Eitr Food - Necromancer Soup", "CraftAmount", 3, "Items produced per craft."); NecroSoupMinCauldronLevel = config.Bind<int>("11. Eitr Food - Necromancer Soup", "MinCauldronLevel", 2, "Minimum Cauldron level required."); NecroSoupRecipe = config.Bind<string>("11. Eitr Food - Necromancer Soup", "Recipe", "WitheredBone:1,Thistle:1,Entrails:2,Ooze:1", "Cauldron recipe (Prefab:Amount comma-separated)."); SadAuferEitr = config.Bind<float>("12. Eitr Food - Story of the Sad Aufer", "Eitr", 30f, "Max Eitr granted."); SadAuferHealth = config.Bind<float>("12. Eitr Food - Story of the Sad Aufer", "Health", 30f, "Max Health granted."); SadAuferStamina = config.Bind<float>("12. Eitr Food - Story of the Sad Aufer", "Stamina", 30f, "Max Stamina granted."); SadAuferDurationMinutes = config.Bind<float>("12. Eitr Food - Story of the Sad Aufer", "DurationMinutes", 25f, "Food duration in minutes."); SadAuferRegen = config.Bind<float>("12. Eitr Food - Story of the Sad Aufer", "HealthRegen", 3f, "Health regen per tick."); SadAuferCraftAmount = config.Bind<int>("12. Eitr Food - Story of the Sad Aufer", "CraftAmount", 2, "Items produced per craft."); SadAuferMinCauldronLevel = config.Bind<int>("12. Eitr Food - Story of the Sad Aufer", "MinCauldronLevel", 3, "Minimum Cauldron level required."); SadAuferRecipe = config.Bind<string>("12. Eitr Food - Story of the Sad Aufer", "Recipe", "CookedWolfMeat:2,DragonTear:2", "Cauldron recipe (Prefab:Amount comma-separated)."); PlainsTartEitr = config.Bind<float>("13. Eitr Food - Plains Shaman Tart", "Eitr", 65f, "Max Eitr granted."); PlainsTartHealth = config.Bind<float>("13. Eitr Food - Plains Shaman Tart", "Health", 20f, "Max Health granted."); PlainsTartStamina = config.Bind<float>("13. Eitr Food - Plains Shaman Tart", "Stamina", 10f, "Max Stamina granted."); PlainsTartDurationMinutes = config.Bind<float>("13. Eitr Food - Plains Shaman Tart", "DurationMinutes", 30f, "Food duration in minutes."); PlainsTartRegen = config.Bind<float>("13. Eitr Food - Plains Shaman Tart", "HealthRegen", 4f, "Health regen per tick."); PlainsTartCraftAmount = config.Bind<int>("13. Eitr Food - Plains Shaman Tart", "CraftAmount", 2, "Items produced per craft."); PlainsTartMinCauldronLevel = config.Bind<int>("13. Eitr Food - Plains Shaman Tart", "MinCauldronLevel", 4, "Minimum Cauldron level required."); PlainsTartRecipe = config.Bind<string>("13. Eitr Food - Plains Shaman Tart", "Recipe", "Needle:2,Cloudberry:4,BarleyFlour:2", "Cauldron recipe (Prefab:Amount comma-separated)."); } public static void RegisterLocalizations() { CustomLocalization localization = LocalizationManager.Instance.GetLocalization(); string text = "English"; localization.AddTranslation(ref text, new Dictionary<string, string> { { "item_food_stuffedneck", "Mushroom-Stuffed Neck Tail" }, { "item_food_stuffedneck_desc", "A juicy grilled neck tail split along the ridge and stuffed with forest red mushrooms and glowing yellow cave-caps." }, { "item_food_necrosoup", "Necromancer's Brew" }, { "item_food_necrosoup_desc", "A bubbling bog-cauldron stew of withered bone, glowing thistle buds, entrails, and toxic ooze that awakens dark Eitr." }, { "item_food_sadaufer", "Story of the Sad Aufer" }, { "item_food_sadaufer_desc", "A sculpted figurine of a sorrowful sitting wolf molded from roasted wolf meat, weeping glowing blue dragon tears onto an ashwood plate." }, { "item_food_plainstart", "Plains Shaman Tart" }, { "item_food_plainstart_desc", "A crisp barley-flour tart filled with golden cloudberry jam and crowned with two crossed emerald Deathsquito stingers." } }); string text2 = "Russian"; localization.AddTranslation(ref text2, new Dictionary<string, string> { { "item_food_stuffedneck", "Никс, фаршированный грибами" }, { "item_food_stuffedneck_desc", "Сочный жареный хвост никса, надрезанный вдоль гребня и щедро нашпигованный лесными красными и светящимися жёлтыми грибами." }, { "item_food_necrosoup", "Похлёбка некроманта" }, { "item_food_necrosoup_desc", "Густое варево из засохших костей, потрохов, болотной жижи и светящегося чертополоха, пробуждающее тёмный поток эйтра." }, { "item_food_sadaufer", "История грустного ауфера" }, { "item_food_sadaufer_desc", "Трогательное блюдо на деревянной тарелке: фигурка сидящего грустного волка из запечённого мяса, плачущего ледяными слезами дракона." }, { "item_food_plainstart", "Тарт Шамана Равнин" }, { "item_food_plainstart_desc", "Хрустящая корзиночка из ячменной муки с густым морошковым джемом, украшенная двумя скрещёнными зелёными жалами комара смерти." } }); } public static void RegisterAllEitrFoods() { //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) try { ApplyVanillaEitrBoostsFromPrefabManager(); if (s_registered && ItemManager.Instance.GetItem("FoodStuffedNeck") != null) { return; } Shader shader = FindFoodSurfaceShader(); EnsureFoodAssetsLoaded(shader); string text = FindFoodDonorPrefabName(); if (string.IsNullOrEmpty(text)) { if (NewDualAxesPlugin.ModLogger != null) { NewDualAxesPlugin.ModLogger.LogError((object)"[EitrFoods] Could not find any vanilla cooked food donor prefab!"); } return; } float num = Mathf.Clamp((CustomFoodVisualScale != null) ? CustomFoodVisualScale.Value : 1f, 0.35f, 3f); RegisterCustomFood("FoodStuffedNeck", text, "$item_food_stuffedneck", "$item_food_stuffedneck_desc", s_stuffedNeckIcon, s_stuffedNeckMesh, s_stuffedNeckMat, 0.62f * num, new Color(1f, 0.88f, 0.35f, 1f), StuffedNeckEitr.Value, StuffedNeckHealth.Value, StuffedNeckStamina.Value, Mathf.Max(60f, StuffedNeckDurationMinutes.Value * 60f), StuffedNeckRegen.Value, Mathf.Max(1, StuffedNeckCraftAmount.Value), Mathf.Max(1, StuffedNeckMinCauldronLevel.Value), StuffedNeckRecipe.Value, 10, 1f); RegisterCustomFood("FoodNecroSoup", text, "$item_food_necrosoup", "$item_food_necrosoup_desc", s_necroSoupIcon, s_necroSoupMesh, s_necroSoupMat, 0.56f * num, new Color(0.32f, 0.96f, 0.68f, 1f), NecroSoupEitr.Value, NecroSoupHealth.Value, NecroSoupStamina.Value, Mathf.Max(60f, NecroSoupDurationMinutes.Value * 60f), NecroSoupRegen.Value, Mathf.Max(1, NecroSoupCraftAmount.Value), Mathf.Max(1, NecroSoupMinCauldronLevel.Value), NecroSoupRecipe.Value, 10, 1f); RegisterCustomFood("FoodSadAufer", text, "$item_food_sadaufer", "$item_food_sadaufer_desc", s_sadAuferIcon, s_sadAuferMesh, s_sadAuferMat, 0.55f * num, new Color(0.42f, 0.82f, 1f, 1f), SadAuferEitr.Value, SadAuferHealth.Value, SadAuferStamina.Value, Mathf.Max(60f, SadAuferDurationMinutes.Value * 60f), SadAuferRegen.Value, Mathf.Max(1, SadAuferCraftAmount.Value), Mathf.Max(1, SadAuferMinCauldronLevel.Value), SadAuferRecipe.Value, 10, 1f); RegisterCustomFood("FoodPlainsTart", text, "$item_food_plainstart", "$item_food_plainstart_desc", s_plainsTartIcon, s_plainsTartMesh, s_plainsTartMat, 0.55f * num, new Color(0.95f, 0.42f, 0.78f, 1f), PlainsTartEitr.Value, PlainsTartHealth.Value, PlainsTartStamina.Value, Mathf.Max(60f, PlainsTartDurationMinutes.Value * 60f), PlainsTartRegen.Value, Mathf.Max(1, PlainsTartCraftAmount.Value), Mathf.Max(1, PlainsTartMinCauldronLevel.Value), PlainsTartRecipe.Value, 10, 1f); s_registered = true; RegisterServingTrayPieces(num); if (NewDualAxesPlugin.ModLogger != null) { NewDualAxesPlugin.ModLogger.LogInfo((object)"[EitrFoods] Patched 2 vanilla foods (+25 Eitr) and registered 4 custom Eitr dishes + Serving Tray pieces!"); } } catch (Exception ex) { if (NewDualAxesPlugin.ModLogger != null) { NewDualAxesPlugin.ModLogger.LogError((object)("[EitrFoods] Failed to register Eitr foods: " + ex)); } } } private static string FindFoodDonorPrefabName() { string[] array = new string[7] { "SeekerAspic", "Salad", "CarrotSoup", "TurnipStew", "OnionSoup", "QueensJam", "WolfSkewer" }; for (int i = 0; i < array.Length; i++) { if ((Object)(object)PrefabManager.Instance.GetPrefab(array[i]) != (Object)null) { return array[i]; } } return null; } private static Shader FindFoodSurfaceShader() { string[] array = new string[6] { "CarrotSoup", "TurnipStew", "Salad", "MeatPlatter", "LoxPie", "SeekerAspic" }; for (int i = 0; i < array.Length; i++) { GameObject prefab = PrefabManager.Instance.GetPrefab(array[i]); if ((Object)(object)prefab == (Object)null) { continue; } MeshRenderer[] componentsInChildren = prefab.GetComponentsInChildren<MeshRenderer>(true); foreach (MeshRenderer val in componentsInChildren) { if ((Object)(object)val != (Object)null && (Object)(object)((Renderer)val).sharedMaterial != (Object)null && (Object)(object)((Renderer)val).sharedMaterial.shader != (Object)null) { string name = ((Object)((Renderer)val).sharedMaterial.shader).name; if (!name.ToLowerInvariant().Contains("particle") && !name.ToLowerInvariant().Contains("alpha")) { return ((Renderer)val).sharedMaterial.shader; } } } } return NewDualAxesPlugin.FindValheimStandardShader(); } private static void EnsureFoodAssetsLoaded(Shader shader) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: 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_011a: 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_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)s_stuffedNeckMesh != (Object)null)) { s_stuffedNeckMesh = NewDualAxesPlugin.LoadEmbeddedMesh("FoodStuffedNeck.bin.gz", "FoodStuffedNeck"); s_stuffedNeckIcon = NewDualAxesPlugin.LoadEmbeddedSprite("FoodStuffedNeck_Icon.png"); s_stuffedNeckMat = NewDualAxesPlugin.BuildValheimMaterial(shader, "Mat_FoodStuffedNeck", "FoodStuffedNeck_Albedo.png", "FoodStuffedNeck_Roughness.png", "FoodStuffedNeck_Normal.png", "FoodStuffedNeck_Emission.png", 0f, Color.white * 1.45f); TuneFoodMaterialProperties(s_stuffedNeckMat); s_necroSoupMesh = NewDualAxesPlugin.LoadEmbeddedMesh("FoodNecroSoup.bin.gz", "FoodNecroSoup"); s_necroSoupIcon = NewDualAxesPlugin.LoadEmbeddedSprite("FoodNecroSoup_Icon.png"); s_necroSoupMat = NewDualAxesPlugin.BuildValheimMaterial(shader, "Mat_FoodNecroSoup", "FoodNecroSoup_Albedo.png", "FoodNecroSoup_Roughness.png", "FoodNecroSoup_Normal.png", "FoodNecroSoup_Emission.png", 0.04f, Color.white * 1.75f); TuneFoodMaterialProperties(s_necroSoupMat); s_sadAuferMesh = NewDualAxesPlugin.LoadEmbeddedMesh("FoodSadAufer.bin.gz", "FoodSadAufer"); s_sadAuferIcon = NewDualAxesPlugin.LoadEmbeddedSprite("FoodSadAufer_Icon.png"); s_sadAuferMat = NewDualAxesPlugin.BuildValheimMaterial(shader, "Mat_FoodSadAufer", "FoodSadAufer_Albedo.png", "FoodSadAufer_Roughness.png", "FoodSadAufer_Normal.png", "FoodSadAufer_Emission.png", 0f, Color.white * 1.65f); TuneFoodMaterialProperties(s_sadAuferMat); s_plainsTartMesh = NewDualAxesPlugin.LoadEmbeddedMesh("FoodPlainsTart.bin.gz", "FoodPlainsTart"); s_plainsTartIcon = NewDualAxesPlugin.LoadEmbeddedSprite("FoodPlainsTart_Icon.png"); s_plainsTartMat = NewDualAxesPlugin.BuildValheimMaterial(shader, "Mat_FoodPlainsTart", "FoodPlainsTart_Albedo.png", "FoodPlainsTart_Roughness.png", "FoodPlainsTart_Normal.png", "FoodPlainsTart_Emission.png", 0.05f, Color.white * 1.55f); TuneFoodMaterialProperties(s_plainsTartMat); } } private static void TuneFoodMaterialProperties(Material mat) { if (!((Object)(object)mat == (Object)null)) { if (mat.HasProperty("_Metallic")) { mat.SetFloat("_Metallic", 0f); } if (mat.HasProperty("_Glossiness")) { mat.SetFloat("_Glossiness", 0.35f); } if (mat.HasProperty("_UseGlossMap")) { mat.SetFloat("_UseGlossMap", 0f); } mat.DisableKeyword("_METALLICGLOSSMAP"); } } private static void RegisterCustomFood(string prefabName, string donorName, string nameToken, string descToken, Sprite icon, Mesh mesh, Material mat, float targetWidthMeters, Color glowColor, float eitr, float health, float stamina, float burnTimeSeconds, float regen, int craftAmount, int minCauldronLevel, string recipeStr, int maxStackSize, float weight) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Expected O, but got Unknown //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Expected O, but got Unknown //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) GameObject val = PrefabManager.Instance.CreateClonedPrefab(prefabName, donorName); if ((Object)(object)val == (Object)null) { return; } val.transform.localScale = Vector3.one; if (!val.activeSelf) { val.SetActive(true); } ApplyCustomFoodVisuals(val, prefabName, mesh, mat, targetWidthMeters, glowColor); ItemDrop component = val.GetComponent<ItemDrop>(); if ((Object)(object)component != (Object)null && component.m_itemData != null && component.m_itemData.m_shared != null) { component.m_pieceEnableObj = null; component.m_pieceDisabledObj = null; component.m_itemData.m_dropPrefab = val; SharedData shared = component.m_itemData.m_shared; shared.m_name = nameToken; shared.m_description = descToken; shared.m_dlc = ""; shared.m_itemType = (ItemType)2; shared.m_attachOverride = (ItemType)0; shared.m_maxQuality = 1; shared.m_maxStackSize = maxStackSize; shared.m_autoStack = true; shared.m_weight = weight; shared.m_teleportable = true; shared.m_isDrink = false; shared.m_consumeStatusEffect = null; shared.m_food = health; shared.m_foodStamina = stamina; shared.m_foodEitr = eitr; shared.m_foodBurnTime = burnTimeSeconds; shared.m_foodRegen = regen; if (shared.m_foodEatAnimTime <= 0f) { shared.m_foodEatAnimTime = 1f; } if ((Object)(object)icon != (Object)null) { shared.m_icons = (Sprite[])(object)new Sprite[1] { icon }; } } ConfigureNativeServingTraySupportOnFoodPrefab(val, component, nameToken, descToken, icon); ItemConfig val2 = new ItemConfig(); val2.Name = nameToken; val2.Description = descToken; val2.Amount = craftAmount; val2.CraftingStation = CraftingStations.Cauldron; val2.MinStationLevel = minCauldronLevel; if ((Object)(object)icon != (Object)null) { val2.Icons = (Sprite[])(object)new Sprite[1] { icon }; } NewDualAxesPlugin.ParseAndAddRequirements(val2, recipeStr); ItemManager.Instance.AddItem(new CustomItem(val, false, val2)); } private static void ApplyCustomFoodVisuals(GameObject prefab, string prefabName, Mesh mesh, Material mat, float targetWidthMeters, Color glowColor) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Expected O, but got Unknown //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Expected O, but got Unknown //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Expected O, but got Unknown //IL_04bc: Unknown result type (might be due to invalid IL or missing references) //IL_0439: Unknown result type (might be due to invalid IL or missing references) //IL_0440: Expected O, but got Unknown //IL_0456: Unknown result type (might be due to invalid IL or missing references) //IL_0467: Unknown result type (might be due to invalid IL or missing references) //IL_0478: Unknown result type (might be due to invalid IL or missing references) //IL_03a2: Unknown result type (might be due to invalid IL or missing references) //IL_03b3: Unknown result type (might be due to invalid IL or missing references) //IL_03c4: Unknown result type (might be due to invalid IL or missing references) //IL_03cb: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)prefab == (Object)null || (Object)(object)mesh == (Object)null || (Object)(object)mat == (Object)null) { return; } Bounds bounds = mesh.bounds; float num = Mathf.Max(0.05f, Mathf.Max(((Bounds)(ref bounds)).size.x, ((Bounds)(ref bounds)).size.z)); float num2 = targetWidthMeters / num; Vector3 offset = default(Vector3); ((Vector3)(ref offset))..ctor((0f - ((Bounds)(ref bounds)).center.x) * num2, (0f - ((Bounds)(ref bounds)).min.y) * num2, (0f - ((Bounds)(ref bounds)).center.z) * num2); Mesh val = NewDualAxesPlugin.BakeTransformedMesh(mesh, offset, Quaternion.identity, num2); ((Object)val).name = prefabName + "_DishMesh"; Transform val2 = prefab.transform.Find("attach"); ParticleSystem[] componentsInChildren = prefab.GetComponentsInChildren<ParticleSystem>(true); for (int i = 0; i < componentsInChildren.Length; i++) { if ((Object)(object)componentsInChildren[i] != (Object)null) { componentsInChildren[i].Stop(true, (ParticleSystemStopBehavior)0); ((Component)componentsInChildren[i]).gameObject.SetActive(false); } } Light[] componentsInChildren2 = prefab.GetComponentsInChildren<Light>(true); for (int j = 0; j < componentsInChildren2.Length; j++) { if ((Object)(object)componentsInChildren2[j] != (Object)null) { ((Behaviour)componentsInChildren2[j]).enabled = false; } } SkinnedMeshRenderer[] componentsInChildren3 = prefab.GetComponentsInChildren<SkinnedMeshRenderer>(true); for (int k = 0; k < componentsInChildren3.Length; k++) { if ((Object)(object)componentsInChildren3[k] != (Object)null) { ((Renderer)componentsInChildren3[k]).enabled = false; } } MeshFilter[] componentsInChildren4 = prefab.GetComponentsInChildren<MeshFilter>(true); foreach (MeshFilter val3 in componentsInChildren4) { if (!((Object)(object)val3 == (Object)null) && (!((Object)(object)val2 != (Object)null) || !((Component)val3).transform.IsChildOf(val2))) { MeshRenderer component = ((Component)val3).GetComponent<MeshRenderer>(); if ((Object)(object)component != (Object)null) { ((Renderer)component).enabled = false; } val3.sharedMesh = null; } } GameObject val4 = new GameObject("EitrDishVisual"); val4.transform.SetParent(prefab.transform, false); val4.transform.localPosition = Vector3.zero; val4.transform.localRotation = Quaternion.identity; val4.transform.localScale = Vector3.one; MeshFilter val5 = val4.AddComponent<MeshFilter>(); val5.sharedMesh = val; MeshRenderer val6 = val4.AddComponent<MeshRenderer>(); ((Renderer)val6).sharedMaterials = (Material[])(object)new Material[1] { mat }; ((Renderer)val6).enabled = true; GameObject val7 = new GameObject("EitrFoodGlow"); val7.transform.SetParent(prefab.transform, false); val7.transform.localPosition = new Vector3(0f, 0.28f, 0f); Light val8 = val7.AddComponent<Light>(); val8.type = (LightType)2; val8.color = glowColor; val8.range = 1.25f; val8.intensity = 0.35f; val8.shadows = (LightShadows)0; if ((Object)(object)val2 == (Object)null) { GameObject val9 = new GameObject("attach"); val9.transform.SetParent(prefab.transform, false); val2 = val9.transform; } val2.localPosition = Vector3.zero; val2.localRotation = Quaternion.identity; val2.localScale = Vector3.one; ((Component)val2).gameObject.SetActive(false); MeshFilter[] componentsInChildren5 = ((Component)val2).GetComponentsInChildren<MeshFilter>(true); bool flag = false; foreach (MeshFilter val10 in componentsInChildren5) { if ((Object)(object)val10 == (Object)null) { continue; } MeshRenderer component2 = ((Component)val10).GetComponent<MeshRenderer>(); if ((Object)(object)component2 == (Object)null) { continue; } if (!flag) { float num3 = NewDualAxesPlugin.GetRelativeScaleMagnitude(((Component)val10).transform, val2); if (num3 < 1E-05f) { num3 = 1f; } ((Component)val10).transform.localPosition = Vector3.zero; ((Component)val10).transform.localRotation = Quaternion.identity; ((Component)val10).transform.localScale = Vector3.one / num3; val10.sharedMesh = val; ((Renderer)component2).sharedMaterials = (Material[])(object)new Material[1] { mat }; ((Renderer)component2).enabled = true; MagicStavesModule.EnsureTransformChainActiveUpTo(((Component)val10).transform, val2); flag = true; } else { ((Renderer)component2).enabled = false; val10.sharedMesh = null; } } if (!flag) { GameObject val11 = new GameObject("model"); val11.transform.SetParent(val2, false); val11.transform.localPosition = Vector3.zero; val11.transform.localRotation = Quaternion.identity; val11.transform.localScale = Vector3.one; MeshFilter val12 = val11.AddComponent<MeshFilter>(); val12.sharedMesh = val; MeshRenderer val13 = val11.AddComponent<MeshRenderer>(); ((Renderer)val13).sharedMaterials = (Material[])(object)new Material[1] { mat }; } NewDualAxesPlugin.FitWorldDropColliders(prefab); FitAllBoxCollidersToDishBounds(prefab, val.bounds, val2); DisableInPlacementGhost[] componentsInChildren6 = prefab.GetComponentsInChildren<DisableInPlacementGhost>(true); for (int n = 0; n < componentsInChildren6.Length; n++) { if ((Object)(object)componentsInChildren6[n] != (Object)null) { if (componentsInChildren6[n].m_objects != null) { componentsInChildren6[n].m_objects.Clear(); } if (componentsInChildren6[n].m_components != null) { componentsInChildren6[n].m_components.Clear(); } } } } private static void FitAllBoxCollidersToDishBounds(GameObject root, Bounds dishBounds, Transform skipSubtree) { //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0171: 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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)root == (Object)null) { return; } BoxCollider[] componentsInChildren = root.GetComponentsInChildren<BoxCollider>(true); bool flag = false; foreach (BoxCollider val in componentsInChildren) { if (!((Object)(object)val == (Object)null) && (!((Object)(object)skipSubtree != (Object)null) || !((Component)val).transform.IsChildOf(skipSubtree))) { flag = true; float num = NewDualAxesPlugin.GetRelativeScaleMagnitude(((Component)val).transform, root.transform); if (num < 1E-05f) { num = 1f; } if ((Object)(object)((Component)val).transform != (Object)(object)root.transform) { ((Component)val).transform.localPosition = Vector3.zero; ((Component)val).transform.localRotation = Quaternion.identity; } val.center = ((Bounds)(ref dishBounds)).center / num; val.size = new Vector3(Mathf.Max(0.24f, ((Bounds)(ref dishBounds)).size.x) / num, Mathf.Max(0.12f, ((Bounds)(ref dishBounds)).size.y) / num, Mathf.Max(0.24f, ((Bounds)(ref dishBounds)).size.z) / num); } } if (!flag) { BoxCollider val2 = root.AddComponent<BoxCollider>(); val2.center = ((Bounds)(ref dishBounds)).center; val2.size = new Vector3(Mathf.Max(0.24f, ((Bounds)(ref dishBounds)).size.x), Mathf.Max(0.12f, ((Bounds)(ref dishBounds)).size.y), Mathf.Max(0.24f, ((Bounds)(ref dishBounds)).size.z)); } } private static void ConfigureNativeServingTraySupportOnFoodPrefab(GameObject foodPrefab, ItemDrop id, string nameToken, string descToken, Sprite icon) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Expected O, but got Unknown if (!((Object)(object)foodPrefab == (Object)null) && !((Object)(object)id == (Object)null)) { Piece val = foodPrefab.GetComponent<Piece>(); if ((Object)(object)val == (Object)null) { val = foodPrefab.AddComponent<Piece>(); } val.m_name = nameToken; val.m_description = descToken; val.m_dlc = ""; val.m_category = (PieceCategory)7; val.m_usage = (UsageTagFlags)4096; val.m_craftingStation = null; val.m_canBeRemoved = true; val.m_groundPiece = false; val.m_groundOnly = false; val.m_cultivatedGroundOnly = false; val.m_waterPiece = false; val.m_noInWater = true; val.m_notOnWood = false; val.m_notOnTiltingSurface = false; val.m_inCeilingOnly = false; val.m_notOnFloor = false; val.m_allowedInDungeons = true; val.m_onlyInTeleportArea = false; val.m_clipEverything = true; if ((Object)(object)icon != (Object)null) { val.m_icon = icon; } Requirement val2 = new Requirement(); val2.m_resItem = id; val2.m_amount = 1; val2.m_amountPerLevel = 0; val2.m_recover = true; val.m_resources = (Requirement[])(object)new Requirement[1] { val2 }; WearNTear val3 = foodPrefab.GetComponent<WearNTear>(); if ((Object)(object)val3 == (Object)null) { val3 = foodPrefab.AddComponent<WearNTear>(); val3.m_health = 10f; val3.m_noRoofWear = false; val3.m_noSupportWear = false; val3.m_supports = false; } ((Behaviour)val3).enabled = false; id.m_pieceEnableObj = null; id.m_pieceDisabledObj = null; } } public static void RegisterServingTrayPieces(float scaleMult) { //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) try { if (!s_trayPiecesRegistered || !((Object)(object)PrefabManager.Instance.GetPrefab("Piece_FoodStuffedNeck") != (Object)null)) { string text = FindLegacyFeastDonorPieceName(); if (!string.IsNullOrEmpty(text)) { RegisterLegacySavedWorldPiece("Piece_FoodStuffedNeck", text, "FoodStuffedNeck", "$item_food_stuffedneck", "$item_food_stuffedneck_desc", s_stuffedNeckIcon, s_stuffedNeckMesh, s_stuffedNeckMat, 0.62f * scaleMult, new Color(1f, 0.88f, 0.35f, 1f)); RegisterLegacySavedWorldPiece("Piece_FoodNecroSoup", text, "FoodNecroSoup", "$item_food_necrosoup", "$item_food_necrosoup_desc", s_necroSoupIcon, s_necroSoupMesh, s_necroSoupMat, 0.56f * scaleMult, new Color(0.32f, 0.96f, 0.68f, 1f)); RegisterLegacySavedWorldPiece("Piece_FoodSadAufer", text, "FoodSadAufer", "$item_food_sadaufer", "$item_food_sadaufer_desc", s_sadAuferIcon, s_sadAuferMesh, s_sadAuferMat, 0.55f * scaleMult, new Color(0.42f, 0.82f, 1f, 1f)); RegisterLegacySavedWorldPiece("Piece_FoodPlainsTart", text, "FoodPlainsTart", "$item_food_plainstart", "$item_food_plainstart_desc", s_plainsTartIcon, s_plainsTartMesh, s_plainsTartMat, 0.55f * scaleMult, new Color(0.95f, 0.42f, 0.78f, 1f)); s_trayPiecesRegistered = true; } } } catch (Exception ex) { if (NewDualAxesPlugin.ModLogger != null) { NewDualAxesPlugin.ModLogger.LogError((object)("[EitrFoods] RegisterServingTrayPieces error: " + ex)); } } } private static string FindLegacyFeastDonorPieceName() { string[] array = new string[5] { "piece_feastmeadows", "piece_feastblackforest", "piece_feastswamps", "piece_feastmountains", "piece_feastplains" }; for (int i = 0; i < array.Length; i++) { if ((Object)(object)PrefabManager.Instance.GetPrefab(array[i]) != (Object)null) { return array[i]; } } return null; } private static void RegisterLegacySavedWorldPiece(string piecePrefabName, string donorPieceName, string foodItemPrefabName, string nameToken, string descToken, Sprite icon, Mesh mesh, Material mat, float targetWidthMeters, Color glowColor) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0109: 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_013a: 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_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Expected O, but got Unknown //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Expected O, but got Unknown //IL_0331: Unknown result type (might be due to invalid IL or missing references) //IL_034e: Unknown result type (might be due to invalid IL or missing references) //IL_0417: Unknown result type (might be due to invalid IL or missing references) //IL_0423: Unknown result type (might be due to invalid IL or missing references) //IL_0455: Unknown result type (might be due to invalid IL or missing references) //IL_045c: Expected O, but got Unknown GameObject val = PrefabManager.Instance.CreateClonedPrefab(piecePrefabName, donorPieceName); if ((Object)(object)val == (Object)null) { return; } val.transform.localScale = Vector3.one; if (!val.activeSelf) { val.SetActive(true); } ItemDrop[] componentsInChildren = val.GetComponentsInChildren<ItemDrop>(true); for (int i = 0; i < componentsInChildren.Length; i++) { if ((Object)(object)componentsInChildren[i] != (Object)null) { Object.DestroyImmediate((Object)(object)componentsInChildren[i]); } } Rigidbody[] componentsInChildren2 = val.GetComponentsInChildren<Rigidbody>(true); for (int j = 0; j < componentsInChildren2.Length; j++) { if ((Object)(object)componentsInChildren2[j] != (Object)null) { Object.DestroyImmediate((Object)(object)componentsInChildren2[j]); } } DisableInPlacementGhost[] componentsInChildren3 = val.GetComponentsInChildren<DisableInPlacementGhost>(true); for (int k = 0; k < componentsInChildren3.Length; k++) { if ((Object)(object)componentsInChildren3[k] != (Object)null) { if (componentsInChildren3[k].m_objects != null) { componentsInChildren3[k].m_objects.Clear(); } if (componentsInChildren3[k].m_components != null) { componentsInChildren3[k].m_components.Clear(); } } } Bounds bounds = mesh.bounds; float num = Mathf.Max(0.05f, Mathf.Max(((Bounds)(ref bounds)).size.x, ((Bounds)(ref bounds)).size.z)); float num2 = targetWidthMeters / num; Vector3 offset = default(Vector3); ((Vector3)(ref offset))..ctor((0f - ((Bounds)(ref bounds)).center.x) * num2, (0f - ((Bounds)(ref bounds)).min.y) * num2, (0f - ((Bounds)(ref bounds)).center.z) * num2); Mesh val2 = NewDualAxesPlugin.BakeTransformedMesh(mesh, offset, Quaternion.identity, num2); ((Object)val2).name = piecePrefabName + "_TrayMesh"; ParticleSystem[] componentsInChildren4 = val.GetComponentsInChildren<ParticleSystem>(true); for (int l = 0; l < componentsInChildren4.Length; l++) { if ((Object)(object)componentsInChildren4[l] != (Object)null) { componentsInChildren4[l].Stop(true, (ParticleSystemStopBehavior)0); ((Component)componentsInChildren4[l]).gameObject.SetActive(false); } } Light[] componentsInChildren5 = val.GetComponentsInChildren<Light>(true); for (int m = 0; m < componentsInChildren5.Length; m++) { if ((Object)(object)componentsInChildren5[m] != (Object)null) { ((Behaviour)componentsInChildren5[m]).enabled = false; } } MeshRenderer[] componentsInChildren6 = val.GetComponentsInChildren<MeshRenderer>(true); for (int n = 0; n < componentsInChildren6.Length; n++) { if ((Object)(object)componentsInChildren6[n] != (Object)null) { ((Renderer)componentsInChildren6[n]).enabled = false; } } MeshFilter[] componentsInChildren7 = val.GetComponentsInChildren<MeshFilter>(true); for (int num3 = 0; num3 < componentsInChildren7.Length; num3++) { if ((Object)(object)componentsInChildren7[num3] != (Object)null) { componentsInChildren7[num3].sharedMesh = null; } } GameObject val3 = new GameObject("model"); val3.transform.SetParent(val.transform, false); val3.transform.localPosition = Vector3.zero; val3.transform.localRotation = Quaternion.identity; val3.transform.localScale = Vector3.one; MeshFilter val4 = val3.AddComponent<MeshFilter>(); val4.sharedMesh = val2; MeshRenderer val5 = val3.AddComponent<MeshRenderer>(); ((Renderer)val5).sharedMaterials = (Material[])(object)new Material[1] { mat }; ((Renderer)val5).enabled = true; FitAllBoxCollidersToDishBounds(val, val2.bounds, null); GameObject val6 = new GameObject("EitrTrayGlow"); val6.transform.SetParent(val.transform, false); val6.transform.localPosition = new Vector3(0f, 0.28f, 0f); Light val7 = val6.AddComponent<Light>(); val7.type = (LightType)2; val7.color = glowColor; val7.range = 1.25f; val7.intensity = 0.35f; val7.shadows = (LightShadows)0; GameObject prefab = PrefabManager.Instance.GetPrefab(foodItemPrefabName); ItemDrop val8 = (((Object)(object)prefab != (Object)null) ? prefab.GetComponent<ItemDrop>() : null); Feast val9 = val.GetComponent<Feast>(); if ((Object)(object)val9 == (Object)null) { val9 = val.AddComponent<Feast>(); } val9.m_eatStacks = 1; if ((Object)(object)val8 != (Object)null) { val9.m_foodItem = val8; } if (val9.m_feastParts != null) { val9.m_feastParts.Clear(); } Piece component = val.GetComponent<Piece>(); if ((Object)(object)component != (Object)null) { component.m_name = nameToken; component.m_description = descToken; component.m_dlc = ""; component.m_category = (PieceCategory)7; component.m_usage = (UsageTagFlags)4096; component.m_craftingStation = null; component.m_canBeRemoved = true; if ((Object)(object)icon != (Object)null) { component.m_icon = icon; } if ((Object)(object)val8 != (Object)null) { Requirement val10 = new Requirement(); val10.m_resItem = val8; val10.m_amount = 1; val10.m_recover = true; component.m_resources = (Requirement[])(object)new Requirement[1] { val10 }; } } PrefabManager.Instance.AddPrefab(val); } public static void EnsureServingTrayPiecesLinked(ObjectDB odb) { //IL_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: Expected O, but got Unknown if ((Object)(object)odb == (Object)null) { return; } string[] array = new string[4] { "FoodStuffedNeck", "FoodNecroSoup", "FoodSadAufer", "FoodPlainsTart" }; string[] array2 = new string[4] { "Piece_FoodStuffedNeck", "Piece_FoodNecroSoup", "Piece_FoodSadAufer", "Piece_FoodPlainsTart" }; PieceTable val = null; GameObject val2 = odb.GetItemPrefab("Feaster"); if ((Object)(object)val2 == (Object)null && PrefabManager.Instance != null) { val2 = PrefabManager.Instance.GetPrefab("Feaster"); } if ((Object)(object)val2 != (Object)null) { ItemDrop component = val2.GetComponent<ItemDrop>(); if ((Object)(object)component != (Object)null && component.m_itemData != null && component.m_itemData.m_shared != null) { val = component.m_itemData.m_shared.m_buildPieces; } } if ((Object)(object)val != (Object)null && val.m_pieces != null) { for (int num = val.m_pieces.Count - 1; num >= 0; num--) { GameObject val3 = val.m_pieces[num]; if (!((Object)(object)val3 == (Object)null)) { for (int i = 0; i < array2.Length; i++) { if (((Object)val3).name == array2[i]) { val.m_pieces.RemoveAt(num); break; } } } } } for (int j = 0; j < array.Length; j++) { GameObject val4 = odb.GetItemPrefab(array[j]); if ((Object)(object)val4 == (Object)null && PrefabManager.Instance != null) { val4 = PrefabManager.Instance.GetPrefab(array[j]); } if ((Object)(object)val4 == (Object)null) { continue; } ItemDrop component2 = val4.GetComponent<ItemDrop>(); if ((Object)(object)component2 != (Object)null && component2.m_itemData != null && component2.m_itemData.m_shared != null) { Sprite icon = ((component2.m_itemData.m_shared.m_icons != null && component2.m_itemData.m_shared.m_icons.Length > 0) ? component2.m_itemData.m_shared.m_icons[0] : null); ConfigureNativeServingTraySupportOnFoodPrefab(val4, component2, component2.m_itemData.m_shared.m_name, component2.m_itemData.m_shared.m_description, icon); } if ((Object)(object)val != (Object)null && val.m_pieces != null && !val.m_pieces.Contains(val4)) { val.m_pieces.Add(val4); } GameObject val5 = null; if ((Object)(object)ZNetScene.instance != (Object)null) { val5 = ZNetScene.instance.GetPrefab(array2[j]); } if ((Object)(object)val5 == (Object)null && PrefabManager.Instance != null) { val5 = PrefabManager.Instance.GetPrefab(array2[j]); } if ((Object)(object)val5 != (Object)null && (Object)(object)component2 != (Object)null) { Feast component3 = val5.GetComponent<Feast>(); if ((Object)(object)component3 != (Object)null) { component3.m_foodItem = component2; component3.m_eatStacks = 1; } Piece component4 = val5.GetComponent<Piece>(); if ((Object)(object)component4 != (Object)null) { Requirement val6 = new Requirement(); val6.m_resItem = component2; val6.m_amount = 1; val6.m_recover = true; component4.m_resources = (Requirement[])(object)new Requirement[1] { val6 }; } } } } public static void ApplyVanillaEitrBoostsFromPrefabManager() { if (PrefabManager.Instance != null) { PatchVanillaFoodPrefab(PrefabManager.Instance.GetPrefab("NeckTailGrilled"), (NeckTailGrilledEitr != null) ? NeckTailGrilledEitr.Value : 25f); PatchVanillaFoodPrefab(PrefabManager.Instance.GetPrefab("MushroomYellow"), (MushroomYellowEitr != null) ? MushroomYellowEitr.Value : 25f); } } public static void EnsureFoodsReadyInObjectDB(ObjectDB odb) { if (!((Object)(object)odb == (Object)null) && odb.m_items != null) { float num = ((NeckTailGrilledEitr != null) ? NeckTailGrilledEitr.Value : 25f); float num2 = ((MushroomYellowEitr != null) ? MushroomYellowEitr.Value : 25f); bool flag = PatchVanillaFoodPrefab(odb.GetItemPrefab("NeckTailGrilled"), num); bool flag2 = PatchVanillaFoodPrefab(odb.GetItemPrefab("MushroomYellow"), num2); EnsureServingTrayPiecesLinked(odb); if ((flag || flag2) && !s_loggedVanillaPatchOnce && NewDualAxesPlugin.ModLogger != null) { s_loggedVanillaPatchOnce = true; NewDualAxesPlugin.ModLogger.LogInfo((object)$"[EitrFoods] Applied vanilla Eitr boosts in ObjectDB: NeckTailGrilled Eitr={num}, MushroomYellow Eitr={num2}"); } } } private static bool PatchVanillaFoodPrefab(GameObject prefab, float eitrAmount) { if ((Object)(object)prefab == (Object)null) { return false; } ItemDrop component = prefab.GetComponent<ItemDrop>(); if ((Object)(object)component == (Object)null || component.m_itemData == null || component.m_itemData.m_shared == null) { return false; } component.m_itemData.m_shared.m_foodEitr = eitrAmount; return true; } public static void SyncInventoryVanillaFoodEitr(Inventory inv) { if (inv == null) { return; } List<ItemData> allItems = inv.GetAllItems(); if (allItems == null) { return; } float foodEitr = ((NeckTailGrilledEitr != null) ? NeckTailGrilledEitr.Value : 25f); float foodEitr2 = ((MushroomYellowEitr != null) ? MushroomYellowEitr.Value : 25f); for (int i = 0; i < allItems.Count; i++) { ItemData val = allItems[i]; if (val != null && val.m_shared != null) { string name = val.m_shared.m_name; if (name == "$item_necktailgrilled") { val.m_shared.m_foodEitr = foodEitr; } else if (name == "$item_mushroomyellow") { val.m_shared.m_foodEitr = foodEitr2; } } } } } public static class MagicStavesModule { public const string PartCrystalPrefab = "PartWindCrystal"; public const string PartHandlePrefab = "PartCarvedHandle"; public const string PartBindingPrefab = "PartRunicBinding"; public const string MeadowsStaffPrefab = "StaffMeadows"; public const string BlackForestStaffPrefab = "StaffBlackForest"; public const string SwampStaffPrefab = "StaffSwamp"; public const string MountainStaffPrefab = "StaffMountain"; public const string PlainsStaffPrefab = "StaffPlains"; public const float PlainsTotemZoneRadius = 12f; public const float MeadowsWindFlightRange = 21f; public static ConfigEntry<float> MeadowsChestDropChance; public static ConfigEntry<float> MeadowsSlashDamage; public static ConfigEntry<float> MeadowsSlashPerLevel; public static ConfigEntry<float> MeadowsKnockbackForce; public static ConfigEntry<float> MeadowsEitrCost; public static ConfigEntry<string> MeadowsUpgradeRecipe; public static ConfigEntry<float> BlackForestEitrCost; public static ConfigEntry<float> BlackForestHealthPercent; public static ConfigEntry<float> BlackForestBaseCharmSeconds; public static ConfigEntry<float> BlackForestExtraCharmPerLevel; public static ConfigEntry<string> BlackForestRecipe; public static ConfigEntry<float> SwampEitrCost; public static ConfigEntry<float> SwampCloudDuration; public static ConfigEntry<float> SwampCloudRadius; public static ConfigEntry<float> SwampTickDamage; public static ConfigEntry<float> SwampTickDamagePerLevel; public static ConfigEntry<string> SwampStaffRecipe; public static ConfigEntry<float> MountainDrawEitrPerSec; public static ConfigEntry<float> MountainDrawEitrExtraPerLevel; public static ConfigEntry<float> MountainLightningDamage; public static ConfigEntry<float> MountainLightningPerLevel; public static ConfigEntry<string> MountainStaffRecipe; public static ConfigEntry<float> PlainsEitrCost; public static ConfigEntry<float> PlainsHealthPercent; public static ConfigEntry<float> PlainsTotemDuration; public static ConfigEntry<float> PlainsTotemExtraDurationPerLevel; public static ConfigEntry<string> PlainsStaffRecipe; private static bool s_registered; internal static Mesh s_partCrystalMesh; internal static Material s_partCrystalMat; internal static Sprite s_partCrystalIcon; internal static Mesh s_partHandleMesh; internal static Material s_partHandleMat; internal static Sprite s_partHandleIcon; internal static Mesh s_partBindingMesh; internal static Material s_partBindingMat; internal static Sprite s_partBindingIcon; internal static Mesh s_meadowsMesh; internal static Material s_meadowsMat; internal static Sprite s_meadowsIcon; internal static Mesh s_bfMesh; internal static Material s_bfMat; internal static Sprite s_bfIcon; internal static Mesh s_swampMesh; internal static Material s_swampMat; internal static Sprite s_swampIcon; internal static Mesh s_mountainMesh; internal static Material s_mountainMat; internal static Sprite s_mountainIcon; internal static Mesh s_plainsMesh; internal static Material s_plainsMat; internal static Sprite s_plainsIcon; internal static Mesh s_plainsTotemMesh; internal static Material s_plainsTotemMat; internal static Sprite s_plainsTotemIcon; private static Material s_additiveFxMat; private static Texture2D s_softSmokePuffTex; private static Material s_softSmokeParticleMat; private static Texture2D s_rainStreakTex; private static Material s_bloodRainParticleMat; private static Texture2D s_windFangTex; private static Material s_windFangMat; private static Mesh s_crescentBladeMesh; private static Transform s_templateRoot; private static GameObject s_windBladeProjPrefab; private static GameObject s_bloodDominionProjPrefab; private static GameObject s_swampMiasmaProjPrefab; private static GameObject s_mountainDummyProjPrefab; private static GameObject s_plainsTotemProjPrefab; internal static EffectList s_vanillaFireHitEffects; internal static EffectList s_vanillaLightningHitEffects; internal static EffectList s_vanillaPoisonBombHitEffects; internal static EffectList s_vanillaBloodHitEffects; internal static readonly Dictionary<Character, float> s_miasmaAfflicted = new Dictionary<Character, float>(); internal static readonly Dictionary<long, List<BloodDominionMinion>> s_dominatedByPlayer = new Dictionary<long, List<BloodDominionMinion>>(); internal static readonly Dictionary<long, List<PlainsBloodHarvestTotemZone>> s_totemsByPlayer = new Dictionary<long, List<PlainsBloodHarvestTotemZone>>(); internal static readonly Dictionary<Character, float> s_plainsSlowedEnemies = new Dictionary<Character, float>(); internal static readonly Dictionary<Character, float> s_plainsBuffedPlayers = new Dictionary<Character, float>(); internal static StatusEffect s_plainsBuffStatusEffect; internal static int s_plainsBuffStatusHash; public static void BindConfigs(ConfigFile config) { MeadowsChestDropChance = config.Bind<float>("4. Meadows Staff (Whispering Wind)", "MeadowsChestPartChance", 0.55f, "Chance (0.0 - 1.0) for each abandoned Meadows chest to contain 1-2 Whispering Wind Staff relic parts."); MeadowsSlashDamage = config.Bind<float>("4. Meadows Staff (Whispering Wind)", "SlashDamage", 35f, "Base Wind Blade Slash damage at level 1."); MeadowsSlashPerLevel = config.Bind<float>("4. Meadows Staff (Whispering Wind)", "SlashDamagePerLevel", 7f, "Extra Slash damage per staff upgrade level."); MeadowsKnockbackForce = config.Bind<float>("4. Meadows Staff (Whispering Wind)", "KnockbackForce", 100f, "Exact Wind Blade knockback force (100)."); MeadowsEitrCost = config.Bind<float>("4. Meadows Staff (Whispering Wind)", "EitrCost", 18f, "Eitr cost per Wind Blade cast."); MeadowsUpgradeRecipe = config.Bind<string>("4. Meadows Staff (Whispering Wind)", "Recipe", "PartWindCrystal:1:0,PartCarvedHandle:1:0,PartRunicBinding:1:0,Flint:0:6,DeerHide:0:4,Resin:0:8", "Workbench recipe (Prefab:CraftAmount:UpgradePerLevel)."); BlackForestEitrCost = config.Bind<float>("5. Black Forest Staff (Blood Dominion)", "EitrCost", 60f, "Eitr cost per Blood Dominion cast."); BlackForestHealthPercent = config.Bind<float>("5. Black Forest Staff (Blood Dominion)", "HealthPercentageCost", 75f, "Current HP percentage cost per cast."); BlackForestBaseCharmSeconds = config.Bind<float>("5. Black Forest Staff (Blood Dominion)", "BaseDominionSeconds", 30f, "Mind-control duration in seconds at level 1."); BlackForestExtraCharmPerLevel = config.Bind<float>("5. Black Forest Staff (Blood Dominion)", "ExtraSecondsPerLevel", 15f, "Additional mind-control seconds per staff upgrade level (+15s/lvl => 30/45/60/75s)."); BlackForestRecipe = config.Bind<string>("5. Black Forest Staff (Blood Dominion)", "Recipe", "Bronze:10:5,SurtlingCore:4:2,AncientSeed:5:2,TrophyGreydwarfShaman:1:0", "Forge level 1 recipe."); SwampEitrCost = config.Bind<float>("6. Swamp Staff (Restless Spirit Censer)", "EitrCost", 80f, "Eitr cost per Spirit Miasma cast."); SwampCloudDuration = config.Bind<float>("6. Swamp Staff (Restless Spirit Censer)", "CloudDurationSeconds", 8f, "Duration of the resistance-stripping Spirit Miasma cloud."); SwampCloudRadius = config.Bind<float>("6. Swamp Staff (Restless Spirit Censer)", "CloudRadiusMeters", 7.2f, "Radius of the Spirit Miasma cloud in meters."); SwampTickDamage = config.Bind<float>("6. Swamp Staff (Restless Spirit Censer)", "DamagePerSecond", 28f, "Base cloud DPS scalar at level 1 (Spirit portion reduced by 50%)."); SwampTickDamagePerLevel = config.Bind<float>("6. Swamp Staff (Restless Spirit Censer)", "DamagePerSecondPerLevel", 7f, "Additional cloud DPS scalar per staff level."); SwampStaffRecipe = config.Bind<string>("6. Swamp Staff (Restless Spirit Censer)", "Recipe", "Iron:18:8,ElderBark:15:6,Guck:8:4,Chain:2:1,WitheredBone:4:2", "Forge level 2 recipe."); MountainDrawEitrPerSec = config.Bind<float>("7. Mountain Staff (Thor Tuning Railgun)", "DrawEitrDrainPerSecond", 10f, "Base continuous Eitr drain per second while charging the Lightning Railgun at level 1."); MountainDrawEitrExtraPerLevel = config.Bind<float>("7. Mountain Staff (Thor Tuning Railgun)", "DrawEitrDrainExtraPerLevel", 2f, "Additional Eitr drain per second added for each staff upgrade level (+2/s per level => 10, 12, 14, 16...)."); MountainLightningDamage = config.Bind<float>("7. Mountain Staff (Thor Tuning Railgun)", "LightningDamage", 150f, "Piercing Lightning damage at level 1 (3.0s charge)."); MountainLightningPerLevel = config.Bind<float>("7. Mountain Staff (Thor Tuning Railgun)", "LightningDamagePerLevel", 150f, "Extra Lightning damage per upgrade level (+150/lvl => 150/300/450/600; +0.5s charge time per level)."); MountainStaffRecipe = config.Bind<string>("7. Mountain Staff (Thor Tuning Railgun)", "Recipe", "Silver:20:10,Crystal:8:4,Obsidian:15:6,TrophyWolf:2:1", "Forge level 3 recipe."); PlainsEitrCost = config.Bind<float>("8. Plains Staff (Blood Harvest)", "EitrCost", 50f, "Eitr cost per Blood Totem deployment."); PlainsHealthPercent = config.Bind<float>("8. Plains Staff (Blood Harvest)", "HealthPercentageCost", 50f, "Current HP percentage cost per cast."); PlainsTotemDuration = config.Bind<float>("8. Plains Staff (Blood Harvest)", "TotemDurationSeconds", 15f, "Base lifetime of the deployed Blood Totem field in seconds at level 1."); PlainsTotemExtraDurationPerLevel = config.Bind<float>("8. Plains Staff (Blood Harvest)", "ExtraSecondsPerLevel", 5f, "Additional Blood Totem duration in seconds per upgrade level (+5s/lvl => 15/20/25/30s)."); PlainsStaffRecipe = config.Bind<string>("8. Plains Staff (Blood Harvest)", "Recipe", "BlackMetal:25:10,GoblinTotem:1:1,LinenThread:15:6,LoxPelt:4:2", "Forge level 4 recipe."); } internal static bool IsRussianLanguageSelected() { if (Localization.instance != null) { return Localization.instance.GetSelectedLanguage() == "Russian"; } return false; } public static void RegisterLocalizations() { CustomLocalization localization = LocalizationManager.Instance.GetLocalization(); string text = "English"; localization.AddTranslation(ref text, new Dictionary<string, string> { { "item_part_windcrystal", "Wind Crystal Shard" }, { "item_part_windcrystal_desc", "A sky-blue quartz shard humming with restless gusts. Found in abandoned Meadows dwellings; one of three parts of the Staff of Whispering Wind." }, { "item_part_carvedhandle", "Carved Ashwood Handle" }, { "item_part_carvedhandle_desc", "An ancient ashwood staff grip wrapped in weathered deer leather. Found in abandoned Meadows chests." }, { "item_part_runicbinding", "Runic Antler Binding" }, { "item_part_runicbinding_desc", "A braided leather binding set with Eikthyr-carved bone prongs designed to cradle a wind crystal." }, { "item_staff_meadows", "Staff of Whispering Wind" }, { "item_staff_meadows_desc", "Assembled from forgotten Meadows relics. Releases piercing crescent blades of compressed wind with powerful knockback (21m range)." }, { "item_staff_blackforest", "Staff of Blood Dominion" }, { "item_staff_blackforest_desc", "A dark shamanic staff crowned with a ruby blood-heart. Releases a blood bolt that bursts into a crimson mist cloud, bending a struck foe into a temporary ally (30/45/60/75s by level, max 4 allies)." }, { "item_staff_swamp", "Censer of Restless Spirit" }, { "item_staff_swamp_desc", "A rusted iron censer forged from crypt chains and bog roots. Hurls spirit miasma that detonates into an 8-second cloud dealing damage and stripping ALL enemy damage resistances." }, { "item_staff_mountain", "Thor's Thunder Tuning Staff" }, { "item_staff_mountain_desc", "A silver-obsidian tuning fork etched with Thor's knot. Hold to charge and release a piercing hitscan lightning railgun beam through foes, trees, and structures." }, { "item_staff_mountain_eitrhold", "Eitr drain" }, { "item_staff_mountain_chargetime", "Charge time" }, { "item_staff_plains", "Staff of Blood Harvest" }, { "item_staff_plains_desc", "A Black Metal ritual staff that deploys a Blood Ritual Totem (15/20/25/30s by level, max 1 active totem) summoning a crimson rainstorm. Inside the blood rain, enemies move 40% slower while players gain +10% move speed, +50% HP & Eitr regen, and -30% to all stamina/eitr/health action costs." }, { "se_plains_bloodfield_name", "Blood Totem Aura" }, { "se_plains_bloodfield_tooltip", "Movement speed +10%\nHealth regeneration +50%\nEitr regeneration +50%\nAll stamina, eitr & health action costs -30%\nEnemies in field slowed by 40%" }, { "msg_bf_boss_immune", "Bosses cannot be dominated!" }, { "msg_bf_dominated", "Enemy dominated" }, { "msg_mtn_fizzle", "Charge aborted! Hold until 100% charged" } }); string text2 = "Russian"; localization.AddTranslation(ref text2, new Dictionary<string, string> { { "item_part_windcrystal", "Осколок Кристалла Ветра" }, { "item_part_windcrystal_desc", "Небесно-голубой осколок кварца, в котором поёт ветер Лугов. Находится в сундуках заброшенных построек — одна из трёх частей Посоха Шепчущего Ветра." }, { "item_part_carvedhandle", "Резная Ясеневая Рукоять" }, { "item_part_carvedhandle_desc", "Древнее древко из ясеня, обмотанное выделанной оленьей кожей. Часть забытого посоха Лугов." }, { "item_part_runicbinding", "Руническая Перевязь из Рога" }, { "item_part_runicbinding_desc", "Плетёное крепление с роговыми зубцами и рунами ветра, удерживающее магический кристалл." }, { "item_staff_meadows", "Посох Шепчущего Ветра" }, { "item_staff_meadows_desc", "Собранный из древних реликвий Лугов посох магии стихий. Выпускает мощно отбрасывающие пронзающие серпы сжатого ветра на дальность 21 м." }, { "item_staff_blackforest", "Посох Кровавого Подчинения" }, { "item_staff_blackforest_desc", "Шаманский посох Чёрного Леса на магии крови. Снаряд оставляет кровавое облако захвата, подчиняя разум врага на 30/45/60/75 сек. по уровню (макс. союзников: 4)." }, { "item_staff_swamp", "Кадило Беспокойного Духа" }, { "item_staff_swamp_desc", "Болотное кадило магии стихий на ржавых цепях. Взрывает духовную миазму, оставляя на 8 секунд широкое облако дыма, наносящее урон и полностью снимающее все сопротивления и иммунитеты к урону у врагов." }, { "item_staff_mountain", "Громовой Камертон Тора" }, { "item_staff_mountain_desc", "Серебряно-обсидиановый рейлган магии стихий со знаком Тора. При полной зарядке выпускает мощный луч молнии навылет сквозь врагов, деревья и постройки." }, { "item_staff_mountain_eitrhold", "Расход эйтра" }, { "item_staff_mountain_chargetime", "Время зарядки" }, { "item_staff_plains", "Посох Кровавой Жатвы" }, { "item_staff_plains_desc", "Ритуальный посох Равнин на магии крови (15/20/25/30 сек. по уровню, лимит: 1 тотем). Призывает кровавый дождь в области тотема: замедляет врагов на 40%, ускоряет игроков на 10%, снижает все затраты бега/атак/блока и др. на 30% и повышает регенерацию здоровья и эйтра на 50%." }, { "se_plains_bloodfield_name", "Поле Кровавого Тотема" }, { "se_plains_bloodfield_tooltip", "Скорость передвижения: +10%\nВосстановление здоровья: +50%\nВосстановление эйтра: +50%\nВсе затраты выносливости, эйтра и здоровья: -30%\nВраги в поле замедлены на 40%" }, { "msg_bf_boss_immune", "Босса нельзя подчинить!" }, { "msg_bf_dominated", "Разум врага подчинён" }, { "msg_mtn_fizzle", "Заряд сорвался! Удерживайте до полной зарядки" } }); } public static void RegisterAllStavesAndParts() { //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_0375: Unknown result type (might be due to invalid IL or missing references) //IL_0430: Unknown result type (might be due to invalid IL or missing references) try { if (s_registered && ItemManager.Instance.GetItem("StaffMeadows") != null) { InjectMeadowsChestDrops(); return; } Shader shader = NewDualAxesPlugin.FindValheimStandardShader(); LoadAllStaffAssets(shader); EnsureSpellProjectileTemplates(); RegisterRelicPart("PartWindCrystal", "$item_part_windcrystal", "$item_part_windcrystal_desc", s_partCrystalMesh, s_partCrystalMat, s_partCrystalIcon, 0.26f, 0.5f); RegisterRelicPart("PartCarvedHandle", "$item_part_carvedhandle", "$item_part_carvedhandle_desc", s_partHandleMesh, s_partHandleMat, s_partHandleIcon, 0.58f, 1f); RegisterRelicPart("PartRunicBinding", "$item_part_runicbinding", "$item_part_runicbinding_desc", s_partBindingMesh, s_partBindingMat, s_partBindingIcon, 0.22f, 0.5f); string text = FindStaffDonorName(); if (string.IsNullOrEmpty(text)) { if (NewDualAxesPlugin.ModLogger != null) { NewDualAxesPlugin.ModLogger.LogError((object)"[MagicStaves] Could not find vanilla StaffFireball/StaffIceShards donor prefab!"); } return; } RegisterMagicStaff("StaffMeadows", text, "$item_staff_meadows", "$item_staff_meadows_desc", s_meadowsIcon, s_meadowsMesh, s_meadowsMat, 2.13f, new Color(0.4f, 0.92f, 1f, 1f), 1f, (SkillType)9, CraftingStations.Workbench, 1, MeadowsUpgradeRecipe.Value, MeadowsEitrCost.Value, 0f, 0f, s_windBladeProjPrefab, 25f, MeadowsSlashDamage.Value, MeadowsSlashPerLevel.Value, 0f, 0f, 0f, 0f, 0f, 0f, isBowDrawRailgun: false, 4, MeadowsKnockbackForce.Value, 0, 20f, 160f); RegisterMagicStaff("StaffBlackForest", text, "$item_staff_blackforest", "$item_staff_blackforest_desc", s_bfIcon, s_bfMesh, s_bfMat, 2.16f, new Color(1f, 0.14f, 0.18f, 1f), 1.02f, (SkillType)10, CraftingStations.Forge, 1, BlackForestRecipe.Value, BlackForestEitrCost.Value, 0f, BlackForestHealthPercent.Value, s_bloodDominionProjPrefab, 28f, 0f, 0f, 0f, 0f, 12f, 0f, 0f, 0f, isBowDrawRailgun: false, 4, 25f, 1, 28f, 180f); RegisterMagicStaff("StaffSwamp", text, "$item_staff_swamp", "$item_staff_swamp_desc", s_swampIcon, s_swampMesh, s_swampMat, 2.2f, new Color(0.22f, 1f, 0.58f, 1f), 0.9f, (SkillType)9, CraftingStations.Forge, 2, SwampStaffRecipe.Value, SwampEitrCost.Value, 0f, 0f, s_swampMiasmaProjPrefab, 20f, 0f, 0f, 0f, 0f, SwampTickDamage.Value * 0.275f, SwampTickDamagePerLevel.Value * 0.275f, SwampTickDamage.Value * 0.45f, SwampTickDamagePerLevel.Value * 0.45f, isBowDrawRailgun: false, 4, 25f, 2, 34f, 200f); string donorName = FindDundrDonorName(text); RegisterMagicStaff("StaffMountain", donorName, "$item_staff_mountain", "$item_staff_mountain_desc", s_mountainIcon, s_mountainMesh, s_mountainMat, 2.28f, new Color(0.35f, 0.8f, 1f, 1f), 1.08f, (SkillType)9, CraftingStations.Forge, 3, MountainStaffRecipe.Value, 0f, MountainDrawEitrPerSec.Value, 0f, s_mountainDummyProjPrefab, 60f, 0f, 0f, MountainLightningDamage.Value, MountainLightningPerLevel.Value, 0f, 0f, 0f, 0f, isBowDrawRailgun: true, 4, 55f, 3, 40f, 220f); RegisterMagicStaff("StaffPlains", text, "$item_staff_plains", "$item_staff_plains_desc", s_plainsIcon, s_plainsMesh, s_plainsMat, 2.26f, new Color(1f, 0.12f, 0.16f, 1f), 1.05f, (SkillType)10, CraftingStations.Forge, 4, PlainsStaffRecipe.Value, PlainsEitrCost.Value, 0f, PlainsHealthPercent.Value, s_plainsTotemProjPrefab, 24f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, isBowDrawRailgun: false, 4, 25f, 4, 48f, 240f); InjectMeadowsChestDrops(); s_registered = true; if (NewDualAxesPlugin.ModLogger != null) { NewDualAxesPlugin.ModLogger.LogInfo((object)"[MagicStaves] Registered 3 Meadows relic parts + 5 Magic Staves (v1.0.0)!"); } } catch (Exception ex) { if (NewDualAxesPlugin.ModLogger != null) { NewDualAxesPlugin.ModLogger.LogError((object)("[MagicStaves] Failed to register staves: " + ex)); } } } private static string FindStaffDonorName() { string[] array = new string[4] { "StaffFireball", "StaffIceShards", "StaffClusterbomb", "StaffSkeleton" }; for (int i = 0; i < array.Length; i++) { if ((Object)(object)PrefabManager.Instance.GetPrefab(array[i]) != (Object)null) { return array[i]; } } return null; } private static string FindDundrDonorName(string fallbackStaffDonor) { string[] array = new string[3] { "StaffLightning", "CrossbowArbalest", "CrossbowRipper" }; for (int i = 0; i < array.Length; i++) { if ((Object)(object)PrefabManager.Instance.GetPrefab(array[i]) != (Object)null) { return array[i]; } } return fallbackStaffDonor; } private static void LoadAllStaffAssets(Shader shader) { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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_0124: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_01da: 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_0235: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_0346: Unknown result type (might be due to invalid IL or missing references) //IL_0350: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)s_meadowsMesh != (Object)null)) { s_partCrystalMesh = NewDualAxesPlugin.LoadEmbeddedMesh("Part_WindCrystal.bin.gz", "Part_WindCrystal"); s_partCrystalIcon = NewDualAxesPlugin.LoadEmbeddedSprite("Part_WindCrystal_Icon.png"); s_partCrystalMat = NewDualAxesPlugin.BuildValheimMaterial(shader, "Mat_Part_WindCrystal", "Part_WindCrystal_Albedo.png", "Part_WindCrystal_Roughness.png", "Part_WindCrystal_Normal.png", "Part_WindCrystal_Emission.png", 0.25f, new Color(0.55f, 0.95f, 1f, 1f) * 2.2f); s_partHandleMesh = NewDualAxesPlugin.LoadEmbeddedMesh("Part_CarvedHandle.bin.gz", "Part_CarvedHandle"); s_partHandleIcon = NewDualAxesPlugin.LoadEmbeddedSprite("Part_CarvedHandle_Icon.png"); s_partHandleMat = NewDualAxesPlugin.BuildValheimMaterial(shader, "Mat_Part_CarvedHandle", "Part_CarvedHandle_Albedo.png", "Part_CarvedHandle_Roughness.png", "Part_CarvedHandle_Normal.png", "Part_CarvedHandle_Emission.png", 0.15f, Color.white); s_partBindingMesh = NewDualAxesPlugin.LoadEmbeddedMesh("Part_RunicBinding.bin.gz", "Part_RunicBinding"); s_partBindingIcon = NewDualAxesPlugin.LoadEmbeddedSprite("Part_RunicBinding_Icon.png"); s_partBindingMat = NewDualAxesPlugin.BuildValheimMaterial(shader, "Mat_Part_RunicBinding", "Part_RunicBinding_Albedo.png", "Part_RunicBinding_Roughness.png", "Part_RunicBinding_Normal.png", "Part_RunicBinding_Emission.png", 0.2f, new Color(0.45f, 0.9f, 1f, 1f) * 1.5f); s_meadowsMesh = NewDualAxesPlugin.LoadEmbeddedMesh("MeadowsStaff.bin.gz", "MeadowsStaff"); s_meadowsIcon = NewDualAxesPlugin.LoadEmbeddedSprite("MeadowsStaff_Icon.png"); s_meadowsMat = NewDualAxesPlugin.BuildValheimMaterial(shader, "Mat_MeadowsStaff", "MeadowsStaff_Albedo.png", "MeadowsStaff_Roughness.png", "MeadowsStaff_Normal.png", "MeadowsStaff_Emission.png", 0.25f, Color.white * 2f); s_bfMesh = NewDualAxesPlugin.LoadEmbeddedMesh("BlackForestStaff.bin.gz", "BlackForestStaff"); s_bfIcon = NewDualAxesPlugin.LoadEmbeddedSprite("BlackForestStaff_Icon.png"); s_bfMat = NewDualAxesPlugin.BuildValheimMaterial(shader, "Mat_BlackForestStaff", "BlackForestStaff_Albedo.png", "BlackForestStaff_Roughness.png", "BlackForestStaff_Normal.png", "BlackForestStaff_Emission.png", 0.65f, Color.white * 2.2f); s_swampMesh = NewDualAxesPlugin.LoadEmbeddedMesh("SwampStaff.bin.gz", "SwampStaff"); s_swampIcon = NewDualAxesPlugin.LoadEmbeddedSprite("SwampStaff_Icon.png"); s_swampMat = NewDualAxesPlugin.BuildValheimMaterial(shader, "Mat_SwampStaff", "SwampStaff_Albedo.png", "SwampStaff_Roughness.png", "SwampStaff_Normal.png", "SwampStaff_Emission.png", 0.68f, Color.white * 2.2f); s_mountainMesh = NewDualAxesPlugin.LoadEmbeddedMesh("MountainStaff.bin.gz", "MountainStaff"); s_mountainIcon = NewDualAxesPlugin.LoadEmbeddedSprite("MountainStaff_Icon.png"); s_mountainMat = NewDualAxesPlugin.BuildValheimMaterial(shader, "Mat_MountainStaff", "MountainStaff_Albedo.png", "MountainStaff_Roughness.png", "MountainStaff_Normal.png", "MountainStaff_Emission.png", 0.85f, Color.white * 2.4f); s_plainsMesh = NewDualAxesPlugin.LoadEmbeddedMesh("PlainsStaff.bin.gz", "PlainsStaff"); s_plainsIcon = NewDualAxesPlugin.LoadEmbeddedSprite("PlainsStaff_Icon.png"); s_plainsMat = NewDualAxesPlugin.BuildValheimMaterial(shader, "Mat_PlainsStaff", "PlainsStaff_Albedo.png", "PlainsStaff_Roughness.png", "PlainsStaff_Normal.png", "PlainsStaff_Emission.png", 0.8f, Color.white * 2.3f); s_plainsTotemMesh = NewDualAxesPlugin.LoadEmbeddedMesh("PlainsHarvestTotem.bin.gz", "PlainsHarvestTotem"); s_plainsTotemIcon = NewDualAxesPlugin.LoadEmbeddedSprite("PlainsHarvestTotem_Icon.png"); s_plainsTotemMat = NewDualAxesPlugin.BuildValheimMaterial(shader, "Mat_PlainsHarvestTotem", "PlainsHarvestTotem_Albedo.png", "PlainsHarvestTotem_Roughness.png", "PlainsHarvestTotem_Normal.png", "PlainsHarvestTotem_Emission.png", 0.75f, Color.white * 2.5f); } } internal static Material GetAdditiveFxMaterial() { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown if ((Object)(object)s_additiveFxMat != (Object)null) { return s_additiveFxMat; } Shader val = Shader.Find("Particles/Standard Unlit"); if ((Object)(object)val == (Object)null) { val = Shader.Find("Legacy Shaders/Particles/Additive"); } if ((Object)(object)val == (Object)null) { val = Shader.Find("Sprites/Default"); } if ((Object)(object)val == (Object)null) { val = NewDualAxesPlugin.FindValheimStandardShader(); } s_additiveFxMat = new Material(val); ((Object)s_additiveFxMat).name = "Mat_MagicStaves_FX"; if (s_additiveFxMat.HasProperty("_Mode")) { s_additiveFxMat.SetFloat("_Mode", 4f); } if (s_additiveFxMat.HasProperty("_SrcBlend")) { s_additiveFxMat.SetInt("_SrcBlend", 5); } if (s_additiveFxMat.HasProperty("_DstBlend")) { s_additiveFxMat.SetInt("_DstBlend", 1); } if (s_additiveFxMat.HasProperty("_ZWrite")) { s_additiveFxMat.SetInt("_ZWrite", 0); } s_additiveFxMat.renderQueue = 3000; return s_additiveFxMat; } internal static Texture2D GetSoftSmokePuffTexture() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)s_softSmokePuffTex != (Object)null) { return s_softSmokePuffTex; } s_softSmokePuffTex = new Texture2D(128, 128, (TextureFormat)4, true); ((Object)s_softSmokePuffTex).name = "Tex_MagicStaves_SoftSmokePuff"; ((Texture)s_softSmokePuffTex).wrapMode = (TextureWrapMode)1; ((Texture)s_softSmokePuffTex).filterMode = (FilterMode)1; Color[] array = (Color[])(object)new Color[16384]; float num = 1f / 127f; for (int i = 0; i < 128; i++) { float num2 = (float)i * num * 2f - 1f; for (int j = 0; j < 128; j++) { float num3 = (float)j * num * 2f - 1f; float num4 = Mathf.Sqrt(num3 * num3 + num2 * num2); if (num4 >= 1f) { ref Color reference = ref array[i * 128 + j]; reference = new Color(1f, 1f, 1f, 0f); continue; } float num5 = Mathf.PerlinNoise(num3 * 2.1f + 4.3f, num2 * 2.1f + 7.9f); float num6 = Mathf.PerlinNoise(num3 * 4.4f + 13.7f, num2 * 4.4f + 2.5f); float num7 = Mathf.PerlinNoise(num3 * 8.5f + 21.1f, num2 * 8.5f + 16.4f); float num8 = num5 * 0.55f + num6 * 0.3f + num7 * 0.15f; float num9 = (num8 - 0.5f) * 0.26f * Mathf.Clamp01(num4 * 1.35f); float num10 = Mathf.Clamp01(num4 + num9); float num11 = 1f - Mathf.SmoothStep(0f, 0.96f, num4); float num12 = 1f - num10; float num13 = num12 * num12 * (3f - 2f * num12); float num14 = Mathf.Clamp01(num13 * num11 * Mathf.Lerp(0.62f, 1.22f, num8)); float num15 = Mathf.Lerp(0.84f, 1f, num8); ref Color reference2 = ref array[i * 128 + j]; reference2 = new Color(num15, 1f, num15 * 0.96f, num14); } } s_softSmokePuffTex.SetPixels(array); s_softSmokePuffTex.Apply(true, false); return s_softSmokePuffTex; } internal static Material GetSoftSmokeParticleMaterial() { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)s_softSmokeParticleMat != (Object)null) { return s_softSmokeParticleMat; } Shader val = Shader.Find("Particles/Standard Unlit"); if ((Object)(object)val == (Object)null) { val = Shader.Find("Legacy Shaders/Particles/Alpha Blended"); } if ((Object)(object)val == (Object)null) { val = Shader.Find("Sprites/Default"); } if ((Object)(object)val == (Object)null) { val = NewDualAxesPlugin.FindValheimStandardShader(); } s_softSmokeParticleMat = new Material(val); ((Object)s_softSmokeParticleMat).name = "Mat_MagicStaves_SoftSmoke"; Texture2D softSmokePuffTexture = GetSoftSmokePuffTexture(); s_softSmokeParticleMat.mainTexture = (Texture)(object)softSmokePuffTexture; if (s_softSmokeParticleMat.HasProperty("_MainTex")) { s_softSmokeParticleMat.SetTexture("_MainTex", (Texture)(object)softSmokePuffTexture); } if (s_softSmokeParticleMat.HasProperty("_Mode")) { s_softSmokeParticleMat.SetFloat("_Mode", 2f); } if (s_softSmokeParticleMat.HasProperty("_ColorMode")) { s_softSmokeParticleMat.SetFloat("_ColorMode", 0f); } if (s_softSmokeParticleMat.HasProperty("_SrcBlend")) { s_softSmokeParticleMat.SetInt("_SrcBlend", 5); } if (s_softSmokeParticleMat.HasProperty("_DstBlend")) { s_softSmokeParticleMat.SetInt("_DstBlend", 10); } if (s_softSmokeParticleMat.HasProperty("_ZWrite")) { s_softSmokeParticleMat.SetInt("_ZWrite", 0); } if (s_softSmokeParticleMat.HasProperty("_Cull")) { s_softSmokeParticleMat.SetInt("_Cull", 0); } if (s_softSmokeParticleMat.HasProperty("_SoftParticlesEnabled")) { s_softSmokeParticleMat.SetFloat("_SoftParticlesEnabled", 1f); s_softSmokeParticleMat.EnableKeyword("_SOFTPARTICLES_ON"); } s_softSmokeParticleMat.DisableKeyword("_ALPHAPREMULTIPLY_ON"); s_softSmokeParticleMat.DisableKeyword("_ALPHATEST_ON"); s_softSmokeParticleMat.EnableKeyword("_ALPHABLEND_ON"); s_softSmokeParticleMat.color = Color.white; if (s_softSmokeParticleMat.HasProperty("_Color")) { s_softSmokeParticleMat.SetColor("_Color", Color.white); } if (s_softSmokeParticleMat.HasProperty("_TintColor")) { s_softSmokeParticleMat.SetColor("_TintColor", new Color(1f, 1f, 1f, 1f)); } s_softSmokeParticleMat.renderQueue = 3000; return s_softSmokeParticleMat; } internal static Texture2D GetRainStreakTexture() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: 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) if ((Object)(object)s_rainStreakTex != (Object)null) { return s_rainStreakTex; } s_rainStreakTex = new Texture2D(64, 64, (TextureFormat)4, true); ((Object)s_rainStreakTex).name = "Tex_MagicStaves_BloodRainStreak"; ((Texture)s_rainStreakTex).wrapMode = (TextureWrapMode)1; ((Texture)s_rainStreakTex).filterMode = (FilterMode)1; Color[] array = (Color[])(object)new Color[4096]; for (int i = 0; i < 64; i++) { float num = (float)i / 63f * 2f - 1f; for (int j = 0; j < 64; j++) { float num2 = (float)j / 63f * 2f - 1f; float num3 = Mathf.Sqrt(num2 * num2 + num * num); if (num3 >= 0.96f) { ref Color reference = ref array[i * 64 + j]; reference = new Color(1f, 1f, 1f, 0f); continue; } float num4 = 1f - Mathf.SmoothStep(0.08f, 0.94f, num3); float num5 = Mathf.Clamp01(num4 * num4); float num6 = Mathf.Lerp(0.82f, 1f, num4); ref Color reference2 = ref array[i * 64 + j]; reference2 = new Color(num6, num6, num6, num5); } } s_rainStreakTex.SetPixels(array); s_rainStreakTex.Apply(true, false); return s_rainStreakTex; } internal static Material GetBloodRainParticleMaterial() { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)s_bloodRainParticleMat != (Object)null) { return s_bloodRainParticleMat; } Shader val = Shader.Find("Particles/Standard Unlit"); if ((Object)(object)val == (Object)null) { val = Shader.Find("Legacy Shaders/Particles/Alpha Blended"); } if ((Object)(object)val == (Object)null) { val = Shader.Find("Sprites/Default"); } if ((Object)(object)val == (Object)null) { val = NewDualAxesPlugin.FindValheimStandardShader(); } s_bloodRainParticleMat = new Material(val); ((Object)s_bloodRainParticleMat).name = "Mat_MagicStaves_BloodRain"; Texture2D rainStreakTexture = GetRainStreakTexture(); s_bloodRainParticleMat.mainTexture = (Texture)(object)rainStreakTexture; if (s_bloodRainParticleMat.HasProperty("_MainTex")) { s_bloodRainParticleMat.SetTexture("_MainTex", (Texture)(object)rainStreakTexture); } if (s_bloodRainParticleMat.HasProperty("_Mode")) { s_bloodRainParticleMat.SetFloat("_Mode", 2f); } if (s_bloodRainParticleMat.HasProperty("_ColorMode")) { s_bloodRainParticleMat.SetFloat("_ColorMode", 0f); } if (s_bloodRainParticleMat.HasProperty("_SrcBlend")) { s_bloodRainParticleMat.SetInt("_SrcBlend", 5); } if (s_bloodRainParticleMat.HasProperty("_DstBlend")) { s_bloodRainParticleMat.SetInt("_DstBlend", 10); } if (s_bloodRainParticleMat.HasProperty("_ZWrite")) { s_bloodRainParticleMat.SetInt("_ZWrite", 0); } if (s_bloodRainParticleMat.HasProperty("_Cull")) { s_bloodRainParticleMat.SetInt("_Cull", 0); } s_bloodRainParticleMat.DisableKeyword("_ALPHAPREMULTIPLY_ON"); s_bloodRainParticleMat.DisableKeyword("_ALPHATEST_ON"); s_bloodRainParticleMat.EnableKeyword("_ALPHABLEND_ON"); s_bloodRainParticleMat.color = Color.white; if (s_bloodRainParticleMat.HasProperty("_Color")) { s_bloodRainParticleMat.SetColor("_Color", Color.white); } if (s_bloodRainParticleMat.HasProperty("_TintColor")) { s_bloodRainParticleMat.SetColor("_TintColor", Color.white); } s_bloodRainParticleMat.renderQueue = 3000; return s_bloodRainParticleMat; } internal static Texture2D GetWindFangGradientTexture() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)s_windFangTex != (Object)null) { return s_windFangTex; } s_windFangTex = new Texture2D(128, 64, (TextureFormat)4, true); ((Object)s_windFangTex).name = "Tex_MagicStaves_WindFangArc"; ((Texture)s_windFangTex).wrapMode = (TextureWrapMode)1; ((Texture)s_windFangTex).filterMode = (FilterMode)1; Color[] array = (Color[])(object)new Color[8192]; for (int i = 0; i < 64; i++) { float num = (float)i / 63f; float num2 = 1f - Mathf.SmoothStep(0.92f, 1f, num); float num3 = Mathf.Pow(Mathf.SmoothStep(0f, 0.86f, num), 1.35f); float num4 = num3 * num2; float num5 = Mathf.SmoothStep(0.6f, 0.9f, num) * num2; for (int j = 0; j < 128; j++) { float num6 = (float)j / 127f; float num7 = Mathf.Sin(num6 * (float)Math.PI); float num8 = Mathf.Pow(Mathf.Max(0f, num7), 0.55f); float num9 = 0.85f + 0.15f * Mathf.Sin(num6 * 28f + num * 6f); float a = Mathf.Clamp01(num4 * num8 * num9 * 1.15f); Color val = Color.Lerp(new Color(0.28f, 0.86f, 1f, 1f), new Color(0.92f, 0.99f, 1f, 1f), num5 * Mathf.Pow(Mathf.Max(0f, num7), 0.35f)); val.a = a; array[i * 128 + j] = val; } } s_windFangTex.SetPixels(array); s_windFangTex.Apply(true, false); return s_windFangTex; } internal static Material GetWindFangMaterial() { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown //IL_0174: 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_01be: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)s_windFangMat != (Object)null) { return s_windFangMat; } Shader val = Shader.Find("Particles/Standard Unlit"); if ((Object)(object)val == (Object)null) { val = Shader.Find("Legacy Shaders/Particles/Additive"); } if ((Object)(object)val == (Object)null) { val = Shader.Find("Sprites/Default"); } if ((Object)(object)val == (Object)null) { val = NewDualAxesPlugin.FindValheimStandardShader(); } s_windFangMat = new Material(val); ((Object)s_windFangMat).name = "Mat_MagicStaves_WindFang"; Texture2D windFangGradientTexture = GetWindFangGradientTexture(); s_windFangMat.mainTexture = (Texture)(object)windFangGradientTexture; if (s_windFangMat.HasProperty("_MainTex")) { s_windFangMat.SetTexture("_MainTex", (Texture)(object)windFangGradientTexture); } if (s_windFangMat.HasProperty("_Mode")) { s_windFangMat.SetFloat("_Mode", 4f); } if (s_windFangMat.HasProperty("_ColorMode")) { s_windFangMat.SetFloat("_ColorMode", 0f); } if (s_windFangMat.HasProperty("_SrcBlend")) { s_windFangMat.SetInt("_SrcBlend", 5); } if (s_windFangMat.HasProperty("_DstBlend")) { s_windFangMat.SetInt("_DstBlend", 1); } if (s_windFangMat.HasProperty("_ZWrite")) { s_windFangMat.SetInt("_ZWrite", 0); } if (s_windFangMat.HasProperty("_Cull")) { s_windFangMat.SetInt("_Cull", 0); } s_windFangMat.color = Color.white; if (s_windFangMat.HasProperty("_Color")) { s_windFangMat.SetColor("_Color", Color.white); } if (s_windFangMat.HasProperty("_TintColor")) { s_windFangMat.SetColor("_TintColor", Color.white); } s_windFangMat.renderQueue = 3000; return s_windFangMat; } internal static Mesh GetCrescentBladeMesh() { //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013f: 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) //IL_015c: 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_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Expected O, but got Unknown if ((Object)(object)s_crescentBladeMesh != (Object)null) { return s_crescentBladeMesh; } int num = 32; List<Vector3> list = new List<Vector3>(); List<Vector3> list2 = new List<Vector3>(); List<Vector2> list3 = new List<Vector2>(); List<int> list4 = new List<int>(); float num2 = 1.22f; float num3 = 1.08f; Vector3 item = default(Vector3); Vector3 item2 = default(Vector3); Vector3 item3 = default(Vector3); Vector3 item4 = default(Vector3); for (int i = 0; i <= num; i++) { float num4 = (float)i / (float)num; float num5 = Mathf.Lerp(0f - num3, num3, num4); float num6 = Mathf.Sin(num4 * (float)Math.PI); float num7 = 0.52f * Mathf.Pow(Mathf.Max(0f, num6), 0.78f); float num8 = 0.065f * Mathf.Pow(Mathf.Max(0f, num6), 0.7f); float num9 = Mathf.Sin(num5); float num10 = Mathf.Cos(num5); float num11 = -0.82f; float num12 = num2; float num13 = num2 - num7 * 0.26f; float num14 = num2 - num7; ((Vector3)(ref item))..ctor(num9 * num12, 0f, num10 * num12 + num11); ((Vector3)(ref item2))..ctor(num9 * num13, num8, num10 * num13 + num11); ((Vector3)(ref item3))..ctor(num9 * num14, 0f, num10 * num14 + num11); ((Vector3)(ref item4))..ctor(num9 * num13, 0f - num8, num10 * num13 + num11); list.Add(item); list2.Add(Vector3.up); list3.Add(new Vector2(num4, 1f)); list.Add(item2); list2.Add(Vector3.up); list3.Add(new Vector2(num4, 0.76f)); list.Add(item3); list2.Add(Vector3.up); list3.Add(new Vector2(num4, 0f)); list.Add(item4); list2.Add(Vector3.down); list3.Add(new Vector2(num4, 0.76f)); } for (int j = 0; j < num; j++) { int num15 = j * 4; int num16 = (j + 1) * 4; list4.Add(num15); list4.Add(num16); list4.Add(num16 + 1); list4.Add(num15); list4.Add(num16 + 1); list4.Add(num15 + 1); list4.Add(num15 + 1); list4.Add(num16 + 1); list4.Add(num16 + 2); list4.Add(num15 + 1); list4.Add(num16 + 2); list4.Add(num15 + 2); list4.Add(num15); list4.Add(num16 + 3); list4.Add(num16); list4.Add(num15); list4.Add(num15 + 3); list4.Add(num16 + 3); list4.Add(num15 + 3); list4.Add(num15 + 2); list4.Add(num16 + 2); list4.Add(num15 + 3); list4.Add(num16 + 2); list4.Add(num16 + 3); } s_crescentBladeMesh = new Mesh(); ((Object)s_crescentBladeMesh).name = "WindFangHorizontalArcMesh"; s_crescentBladeMesh.vertices = list.ToArray(); s_crescentBladeMesh.normals = list2.ToArray(); s_crescentBladeMesh.uv = list3.ToArray(); s_crescentBladeMesh.triangles = list4.ToArray(); s_crescentBladeMesh.RecalculateBounds(); return s_crescentBladeMesh; } private static void EnsureSpellProjectileTemplates() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Expected O, but got Unknown //IL_039d: Unknown result type (might be due to invalid IL or missing references) //IL_03a7: Expected O, but got Unknown //IL_03d9: Unknown result type (might be due to invalid IL or missing references) //IL_03e3: Expected O, but got Unknown //IL_0415: Unknown result type (might be due to invalid IL or missing references) //IL_041f: Expected O, but got Unknown //IL_0451: Unknown result type (might be due to invalid IL or missing references) //IL_045b: Expected O, but got Unknown //IL_0592: Unknown result type (might be due to invalid IL or missing references) //IL_059c: Expected O, but got Unknown if ((Object)(object)s_templateRoot == (Object)null) { GameObject val = new GameObject("MagicStaves_ProjectileTemplates"); Object.DontDestroyOnLoad((Object)(object)val); val.SetActive(false); s_templateRoot = val.transform; } GameObject prefab = PrefabManager.Instance.GetPrefab("StaffFireball"); if ((Object)(object)prefab != (Object)null) { ItemDrop component = prefab.GetComponent<ItemDrop>(); if ((Object)(object)component != (Object)null && component.m_itemData != null && component.m_itemData.m_shared != null && component.m_itemData.m_shared.m_attack != null && (Object)(object)component.m_itemData.m_shared.m_attack.m_attackProjectile != (Object)null) { Projectile component2 = component.m_itemData.m_shared.m_attack.m_attackProjectile.GetComponent<Projectile>(); if ((Object)(object)component2 != (Object)null) { s_vanillaFireHitEffects = component2.m_hitEffects; } } } GameObject prefab2 = PrefabManager.Instance.GetPrefab("AtgeirHimminAfl"); if ((Object)(object)prefab2 != (Object)null) { ItemDrop component3 = prefab2.GetComponent<ItemDrop>(); if ((Object)(object)component3 != (Object)null && component3.m_itemData != null && component3.m_itemData.m_shared != null) { s_vanillaLightningHitEffects = component3.m_itemData.m_shared.m_hitEffect; } } GameObject prefab3 = PrefabManager.Instance.GetPrefab("BombOoze"); if ((Object)(object)prefab3 != (Object)null) { ItemDrop component4 = prefab3.GetComponent<ItemDrop>(); if ((Object)(object)component4 != (Object)null && component4.m_itemData != null && component4.m_itemData.m_shared != null && component4.m_itemData.m_shared.m_attack != null && (Object)(object)component4.m_itemData.m_shared.m_attack.m_attackProjectile != (Object)null) { Projectile component5 = component4.m_itemData.m_shared.m_attack.m_attackProjectile.GetComponent<Projectile>(); if ((Object)(object)component5 != (Object)null) { s_vanillaPoisonBombHitEffects = component5.m_hitEffects; } } } if (s_vanillaBloodHitEffects == null) { string[] array = new string[3] { "StaffShield", "StaffSkeleton", "StaffRedTroll" }; for (int i = 0; i < array.Length; i++) { GameObject prefab4 = PrefabManager.Instance.GetPrefab(array[i]); if ((Object)(object)prefab4 == (Object)null) { continue; } ItemDrop component6 = prefab4.GetComponent<ItemDrop>(); if ((Object)(object)component6 != (Object)null && component6.m_itemData != null && component6.m_itemData.m_shared != null) { if (component6.m_itemData.m_shared.m_startEffect != null && component6.m_itemData.m_shared.m_startEffect.HasEffects()) { s_vanillaBloodHitEffects = component6.m_itemData.m_shared.m_startEffect; break; } if (component6.m_itemData.m_shared.m_triggerEffect != null && component6.m_itemData.m_shared.m_triggerEffect.HasEffects()) { s_vanillaBloodHitEffects = component6.m_itemData.m_shared.m_triggerEffect; break; } } } if (s_vanillaBloodHitEffects == null) { GameObject prefab5 = PrefabManager.Instance.GetPrefab("Deer"); if ((Object)(object)prefab5 != (Object)null) { Character component7 = prefab5.GetComponent<Character>(); if ((Object)(object)component7 != (Object)null && component7.m_hitEffects != null && component7.m_hitEffects.HasEffects()) { s_vanillaBloodHitEffects = component7.m_hitEffects; } } } } if ((Object)(object)s_windBladeProjPrefab == (Object)null) { s_windBladeProjPrefab = new GameObject("Proj_MeadowsWindBlade"); s_windBladeProjPrefab.transform.SetParent(s_templateRoot, false); s_windBladeProjPrefab.AddComponent<WindBladeProjectile>(); } if ((Object)(object)s_bloodDominionProjPrefab == (Object)null) { s_bloodDominionProjPrefab = new GameObject("Proj_BlackForestDominion"); s_bloodDominionProjPrefab.transform.SetParent(s_templateRoot, false); s_bloodDominionProjPrefab.AddComponent<BloodDominionProjectile>(); } if ((Object)(object)s_swampMiasmaProjPrefab == (Object)null) { s_swampMiasmaProjPrefab = new GameObject("Proj_SwampMiasma"); s_swampMiasmaProjPrefab.transform.SetParent(s_templateRoot, false); s_swampMiasmaProjPrefab.AddComponent<SwampMiasmaProjectile>(); } if ((Object)(object)s_mountainDummyProjPrefab == (Object)null) { s_mountainDummyProjPrefab = new GameObject("Proj_MountainRailgunTrigger"); s_mountainDummyProjPrefab.transform.SetParent(s_templateRoot, false); s_mountainDummyProjPrefab.AddComponent<MountainRailgunTriggerProjectile>(); } if ((Object)(object)s_plainsTotemProjPrefab == (Object)null) { s_plainsTotemProjPrefab = new GameObject("Proj_PlainsHarvestTotem"); s_plainsTotemProjPrefab.transform.SetParent(s_templateRoot, false); s_plainsTotemProjPrefab.AddComponent<PlainsTotemDeployProjectile>(); } if ((Object)(object)s_plainsBuffStatusEffect == (Object)null) { SE_Stats val2 = ScriptableObject.CreateInstance<SE_Stats>(); ((Object)val2).name = "SE_PlainsBloodFieldBuff"; ((StatusEffect)val2).m_name = "$se_plains_bloodfield_name"; ((StatusEffect)val2).m_tooltip = "$se_plains_bloodfield_tooltip"; ((StatusEffect)val2).m_icon = (((Object)(object)s_plainsTotemIcon != (Object)null) ? s_plainsTotemIcon : s_plainsIcon); ((StatusEffect)val2).m_ttl = 0.65f; val2.m_speedModifier = 0.1f; val2.m_swimSpeedModifier = 0.1f; val2.m_healthRegenMultiplier = 1.5f; val2.m_eitrRegenMultiplier = 1.5f; val2.m_runStaminaDrai