using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using DeathWizshAPI.Helpers;
using DeathWizshAPI.Helpers.Models;
using DeathWizshAPI.Helpers.Types;
using DeathWizshAPI.ModularMagic.Models;
using HarmonyLib;
using Jotunn;
using Jotunn.Configs;
using Jotunn.Entities;
using Jotunn.Managers;
using Jotunn.Utils;
using Microsoft.CodeAnalysis;
using SplashMeads.Configs;
using SplashMeads.Helpers;
using SplashMeads.Models;
using SplashMeads.Types;
using TMPro;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("SplashMeads")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SplashMeads")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e3243d22-4307-4008-ba36-9f326008cde5")]
[assembly: AssemblyFileVersion("1.0.4")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.4.0")]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
}
namespace SplashMeads
{
[BepInPlugin("DeathWizsh.SplashMeads", "SplashMeads", "1.0.4")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
internal class SplashMeads : BaseUnityPlugin
{
public const string PluginGUID = "DeathWizsh.SplashMeads";
public const string PluginName = "SplashMeads";
public const string PluginVersion = "1.0.4";
public static SplashMeads Instance;
private static readonly Harmony harmony = new Harmony("DeathWizsh.SplashMeads");
private AssetBundle assetBundle;
public CustomPrefabs prefabs = new CustomPrefabs();
public CustomStatusEffects effects = new CustomStatusEffects();
public static readonly int barleyWineHash = 1458612846;
public static readonly int frostResistHash = -1768438774;
public static readonly int poisonResistHash = -568360536;
public static readonly int ratatoskHash = 1965486703;
public static readonly int vananidirHash = -1907265002;
public static readonly int antiStingHash = -1157133715;
public static readonly int majorHealthHash = 1251702474;
public static readonly int mediumHealthHash = -67041294;
public static readonly int minorHealthHash = -590058386;
public static int barleyWineSplashHash;
public static int frostResistSplashHash;
public static int poisonResistSplashHash;
public static int ratatoskSplashHash;
public static int vananidirSplashHash;
public static int antiStingSplashHash;
public static int majorHealthSplashHash;
public static int mediumHealthSplashHash;
public static int minorHealthSplashHash;
public static CustomLocalization Localization = LocalizationManager.Instance.GetLocalization();
private void Awake()
{
Instance = this;
InitAssetBundle();
PluginConfig.Init();
InitStatusEffects();
harmony.PatchAll(Assembly.GetExecutingAssembly());
PrefabManager.OnVanillaPrefabsAvailable += AddStuff;
}
private void AddStuff()
{
ItemHelper.Create(prefabs.BarlyWineSplash, PluginConfig.mead1);
ItemHelper.Create(prefabs.FrostResistSplash, PluginConfig.mead2);
ItemHelper.Create(prefabs.PoisonResistSplash, PluginConfig.mead3);
ItemHelper.Create(prefabs.RatatoskSplash, PluginConfig.mead4);
ItemHelper.Create(prefabs.VananidirSplash, PluginConfig.mead5);
ItemHelper.Create(prefabs.AntiStingSplash, PluginConfig.mead6);
ItemHelper.Create(prefabs.MajorHealthSplash, PluginConfig.mead7);
ItemHelper.Create(prefabs.MediumHealthSplash, PluginConfig.mead8);
ItemHelper.Create(prefabs.MinorHealthSplash, PluginConfig.mead9);
PrefabManager.OnVanillaPrefabsAvailable -= AddStuff;
}
private void InitStatusEffects()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Expected O, but got Unknown
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Expected O, but got Unknown
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Expected O, but got Unknown
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Expected O, but got Unknown
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Expected O, but got Unknown
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Expected O, but got Unknown
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Expected O, but got Unknown
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Expected O, but got Unknown
ItemManager.Instance.AddStatusEffect(new CustomStatusEffect(effects.BarlyWineSplash, true));
ItemManager.Instance.AddStatusEffect(new CustomStatusEffect(effects.FrostResistSplash, true));
ItemManager.Instance.AddStatusEffect(new CustomStatusEffect(effects.PoisonResistSplash, true));
ItemManager.Instance.AddStatusEffect(new CustomStatusEffect(effects.RatatoskSplash, true));
ItemManager.Instance.AddStatusEffect(new CustomStatusEffect(effects.VananidirSplash, true));
ItemManager.Instance.AddStatusEffect(new CustomStatusEffect(effects.AntiStingSplash, true));
ItemManager.Instance.AddStatusEffect(new CustomStatusEffect(effects.MajorHealthSplash, true));
ItemManager.Instance.AddStatusEffect(new CustomStatusEffect(effects.MediumHealthSplash, true));
ItemManager.Instance.AddStatusEffect(new CustomStatusEffect(effects.MinorHealthSplash, true));
barleyWineSplashHash = StringExtensionMethods.GetStableHashCode(((Object)effects.BarlyWineSplash).name);
frostResistSplashHash = StringExtensionMethods.GetStableHashCode(((Object)effects.FrostResistSplash).name);
poisonResistSplashHash = StringExtensionMethods.GetStableHashCode(((Object)effects.PoisonResistSplash).name);
ratatoskSplashHash = StringExtensionMethods.GetStableHashCode(((Object)effects.RatatoskSplash).name);
vananidirSplashHash = StringExtensionMethods.GetStableHashCode(((Object)effects.VananidirSplash).name);
antiStingSplashHash = StringExtensionMethods.GetStableHashCode(((Object)effects.AntiStingSplash).name);
majorHealthSplashHash = StringExtensionMethods.GetStableHashCode(((Object)effects.MajorHealthSplash).name);
mediumHealthSplashHash = StringExtensionMethods.GetStableHashCode(((Object)effects.MediumHealthSplash).name);
minorHealthSplashHash = StringExtensionMethods.GetStableHashCode(((Object)effects.MinorHealthSplash).name);
}
private void InitAssetBundle()
{
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: Expected O, but got Unknown
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Expected O, but got Unknown
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Expected O, but got Unknown
//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
//IL_01c4: Expected O, but got Unknown
//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
//IL_01e0: Expected O, but got Unknown
//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
//IL_01fc: Expected O, but got Unknown
//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
//IL_02bf: Expected O, but got Unknown
//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
//IL_02db: Expected O, but got Unknown
//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
//IL_02f7: Expected O, but got Unknown
//IL_03b0: Unknown result type (might be due to invalid IL or missing references)
//IL_03ba: Expected O, but got Unknown
//IL_03cc: Unknown result type (might be due to invalid IL or missing references)
//IL_03d6: Expected O, but got Unknown
//IL_03e8: Unknown result type (might be due to invalid IL or missing references)
//IL_03f2: Expected O, but got Unknown
//IL_04ab: Unknown result type (might be due to invalid IL or missing references)
//IL_04b5: Expected O, but got Unknown
//IL_04c7: Unknown result type (might be due to invalid IL or missing references)
//IL_04d1: Expected O, but got Unknown
//IL_04e3: Unknown result type (might be due to invalid IL or missing references)
//IL_04ed: Expected O, but got Unknown
//IL_05a6: Unknown result type (might be due to invalid IL or missing references)
//IL_05b0: Expected O, but got Unknown
//IL_05c2: Unknown result type (might be due to invalid IL or missing references)
//IL_05cc: Expected O, but got Unknown
//IL_05de: Unknown result type (might be due to invalid IL or missing references)
//IL_05e8: Expected O, but got Unknown
//IL_06a1: Unknown result type (might be due to invalid IL or missing references)
//IL_06ab: Expected O, but got Unknown
//IL_06bd: Unknown result type (might be due to invalid IL or missing references)
//IL_06c7: Expected O, but got Unknown
//IL_06d9: Unknown result type (might be due to invalid IL or missing references)
//IL_06e3: Expected O, but got Unknown
//IL_079c: Unknown result type (might be due to invalid IL or missing references)
//IL_07a6: Expected O, but got Unknown
//IL_07b8: Unknown result type (might be due to invalid IL or missing references)
//IL_07c2: Expected O, but got Unknown
//IL_07d4: Unknown result type (might be due to invalid IL or missing references)
//IL_07de: Expected O, but got Unknown
//IL_0897: Unknown result type (might be due to invalid IL or missing references)
//IL_08a1: Expected O, but got Unknown
//IL_08b3: Unknown result type (might be due to invalid IL or missing references)
//IL_08bd: Expected O, but got Unknown
//IL_08cf: Unknown result type (might be due to invalid IL or missing references)
//IL_08d9: Expected O, but got Unknown
assetBundle = AssetUtils.LoadAssetBundleFromResources("splashmeads_dw");
GameObject val = assetBundle.LoadAsset<GameObject>("EnemyHud_SM");
prefabs.BarlyWineSplash = assetBundle.LoadAsset<GameObject>("SM_SplashBarleyWine");
prefabs.BarlyWineSplashProjectile = assetBundle.LoadAsset<GameObject>("barlywine_projectile_SM");
prefabs.BarlyWineSplashExplosion = assetBundle.LoadAsset<GameObject>("barlywine_explosion_SM");
prefabs.BarlyWineSplashFX = assetBundle.LoadAsset<GameObject>("fx_Potion_fireresist_SM");
prefabs.BarlyWineSplashHudIcon = ((Component)val.transform.Find("HudRoot/HudBase/SplashBarleyWine")).gameObject;
PrefabManager.Instance.AddPrefab(new CustomPrefab(prefabs.BarlyWineSplashProjectile, true));
PrefabManager.Instance.AddPrefab(new CustomPrefab(prefabs.BarlyWineSplashExplosion, true));
PrefabManager.Instance.AddPrefab(new CustomPrefab(prefabs.BarlyWineSplashFX, true));
effects.BarlyWineSplash = assetBundle.LoadAsset<StatusEffect>("Potion_barleywine_splash_SM");
prefabs.FrostResistSplash = assetBundle.LoadAsset<GameObject>("SM_SplashFrostResist");
prefabs.FrostResistSplashProjectile = assetBundle.LoadAsset<GameObject>("frostresist_projectile_SM");
prefabs.FrostResistSplashExplosion = assetBundle.LoadAsset<GameObject>("frostresist_explosion_SM");
prefabs.FrostResistSplashFX = assetBundle.LoadAsset<GameObject>("fx_Potion_frostresist_SM");
prefabs.FrostResistSplashHudIcon = ((Component)val.transform.Find("HudRoot/HudBase/SplashFrostResist")).gameObject;
PrefabManager.Instance.AddPrefab(new CustomPrefab(prefabs.FrostResistSplashProjectile, true));
PrefabManager.Instance.AddPrefab(new CustomPrefab(prefabs.FrostResistSplashExplosion, true));
PrefabManager.Instance.AddPrefab(new CustomPrefab(prefabs.FrostResistSplashFX, true));
effects.FrostResistSplash = assetBundle.LoadAsset<StatusEffect>("Potion_frostresist_splash_SM");
prefabs.PoisonResistSplash = assetBundle.LoadAsset<GameObject>("SM_SplashPoisonResist");
prefabs.PoisonResistSplashProjectile = assetBundle.LoadAsset<GameObject>("poisonresist_projectile_SM");
prefabs.PoisonResistSplashExplosion = assetBundle.LoadAsset<GameObject>("poisonresist_explosion_SM");
prefabs.PoisonResistSplashFX = assetBundle.LoadAsset<GameObject>("fx_Potion_poisonresist_SM");
prefabs.PoisonResistSplashHudIcon = ((Component)val.transform.Find("HudRoot/HudBase/SplashPoisonResist")).gameObject;
PrefabManager.Instance.AddPrefab(new CustomPrefab(prefabs.PoisonResistSplashProjectile, true));
PrefabManager.Instance.AddPrefab(new CustomPrefab(prefabs.PoisonResistSplashExplosion, true));
PrefabManager.Instance.AddPrefab(new CustomPrefab(prefabs.PoisonResistSplashFX, true));
effects.PoisonResistSplash = assetBundle.LoadAsset<StatusEffect>("Potion_poisonresist_splash_SM");
prefabs.RatatoskSplash = assetBundle.LoadAsset<GameObject>("SM_SplashRatatosk");
prefabs.RatatoskSplashProjectile = assetBundle.LoadAsset<GameObject>("ratatosk_projectile_SM");
prefabs.RatatoskSplashExplosion = assetBundle.LoadAsset<GameObject>("ratatosk_explosion_SM");
prefabs.RatatoskSplashFX = assetBundle.LoadAsset<GameObject>("fx_Potion_ratatosk_SM");
prefabs.RatatoskSplashHudIcon = ((Component)val.transform.Find("HudRoot/HudBase/SplashRatatosk")).gameObject;
PrefabManager.Instance.AddPrefab(new CustomPrefab(prefabs.RatatoskSplashProjectile, true));
PrefabManager.Instance.AddPrefab(new CustomPrefab(prefabs.RatatoskSplashExplosion, true));
PrefabManager.Instance.AddPrefab(new CustomPrefab(prefabs.RatatoskSplashFX, true));
effects.RatatoskSplash = assetBundle.LoadAsset<StatusEffect>("Potion_hasty_splash_SM");
prefabs.VananidirSplash = assetBundle.LoadAsset<GameObject>("SM_SplashVananidir");
prefabs.VananidirSplashProjectile = assetBundle.LoadAsset<GameObject>("vananidir_projectile_SM");
prefabs.VananidirSplashExplosion = assetBundle.LoadAsset<GameObject>("vananidir_explosion_SM");
prefabs.VananidirSplashFX = assetBundle.LoadAsset<GameObject>("fx_Potion_vananidir_SM");
prefabs.VananidirSplashHudIcon = ((Component)val.transform.Find("HudRoot/HudBase/SplashVananidir")).gameObject;
PrefabManager.Instance.AddPrefab(new CustomPrefab(prefabs.VananidirSplashProjectile, true));
PrefabManager.Instance.AddPrefab(new CustomPrefab(prefabs.VananidirSplashExplosion, true));
PrefabManager.Instance.AddPrefab(new CustomPrefab(prefabs.VananidirSplashFX, true));
effects.VananidirSplash = assetBundle.LoadAsset<StatusEffect>("Potion_swimmer_splash_SM");
prefabs.AntiStingSplash = assetBundle.LoadAsset<GameObject>("SM_SplashAntiSting");
prefabs.AntiStingSplashProjectile = assetBundle.LoadAsset<GameObject>("antisting_projectile_SM");
prefabs.AntiStingSplashExplosion = assetBundle.LoadAsset<GameObject>("antisting_explosion_SM");
prefabs.AntiStingSplashFX = assetBundle.LoadAsset<GameObject>("fx_Potion_antisting_SM");
prefabs.AntiStingSplashHudIcon = ((Component)val.transform.Find("HudRoot/HudBase/SplashAntiSting")).gameObject;
PrefabManager.Instance.AddPrefab(new CustomPrefab(prefabs.AntiStingSplashProjectile, true));
PrefabManager.Instance.AddPrefab(new CustomPrefab(prefabs.AntiStingSplashExplosion, true));
PrefabManager.Instance.AddPrefab(new CustomPrefab(prefabs.AntiStingSplashFX, true));
effects.AntiStingSplash = assetBundle.LoadAsset<StatusEffect>("Potion_antisting_SM");
prefabs.MajorHealthSplash = assetBundle.LoadAsset<GameObject>("SM_SplashMajorHealth");
prefabs.MajorHealthSplashProjectile = assetBundle.LoadAsset<GameObject>("majorhealth_projectile_SM");
prefabs.MajorHealthSplashExplosion = assetBundle.LoadAsset<GameObject>("majorhealth_explosion_SM");
prefabs.MajorHealthSplashFX = assetBundle.LoadAsset<GameObject>("fx_Potion_majorhealth_SM");
prefabs.MajorHealthSplashHudIcon = ((Component)val.transform.Find("HudRoot/HudBase/SplashMajorHealth")).gameObject;
PrefabManager.Instance.AddPrefab(new CustomPrefab(prefabs.MajorHealthSplashProjectile, true));
PrefabManager.Instance.AddPrefab(new CustomPrefab(prefabs.MajorHealthSplashExplosion, true));
PrefabManager.Instance.AddPrefab(new CustomPrefab(prefabs.MajorHealthSplashFX, true));
effects.MajorHealthSplash = assetBundle.LoadAsset<StatusEffect>("Potion_health_major_SM");
prefabs.MediumHealthSplash = assetBundle.LoadAsset<GameObject>("SM_SplashMediumHealth");
prefabs.MediumHealthSplashProjectile = assetBundle.LoadAsset<GameObject>("mediumhealth_projectile_SM");
prefabs.MediumHealthSplashExplosion = assetBundle.LoadAsset<GameObject>("mediumhealth_explosion_SM");
prefabs.MediumHealthSplashFX = assetBundle.LoadAsset<GameObject>("fx_Potion_mediumhealth_SM");
prefabs.MediumHealthSplashHudIcon = ((Component)val.transform.Find("HudRoot/HudBase/SplashMediumHealth")).gameObject;
PrefabManager.Instance.AddPrefab(new CustomPrefab(prefabs.MediumHealthSplashProjectile, true));
PrefabManager.Instance.AddPrefab(new CustomPrefab(prefabs.MediumHealthSplashExplosion, true));
PrefabManager.Instance.AddPrefab(new CustomPrefab(prefabs.MediumHealthSplashFX, true));
effects.MediumHealthSplash = assetBundle.LoadAsset<StatusEffect>("Potion_health_medium_SM");
prefabs.MinorHealthSplash = assetBundle.LoadAsset<GameObject>("SM_SplashMinorHealth");
prefabs.MinorHealthSplashProjectile = assetBundle.LoadAsset<GameObject>("minorhealth_projectile_SM");
prefabs.MinorHealthSplashExplosion = assetBundle.LoadAsset<GameObject>("minorhealth_explosion_SM");
prefabs.MinorHealthSplashFX = assetBundle.LoadAsset<GameObject>("fx_Potion_minorhealth_SM");
prefabs.MinorHealthSplashHudIcon = ((Component)val.transform.Find("HudRoot/HudBase/SplashMinorHealth")).gameObject;
PrefabManager.Instance.AddPrefab(new CustomPrefab(prefabs.MinorHealthSplashProjectile, true));
PrefabManager.Instance.AddPrefab(new CustomPrefab(prefabs.MinorHealthSplashExplosion, true));
PrefabManager.Instance.AddPrefab(new CustomPrefab(prefabs.MinorHealthSplashFX, true));
effects.MinorHealthSplash = assetBundle.LoadAsset<StatusEffect>("Potion_health_minor_SM");
}
}
}
namespace SplashMeads.Types
{
internal class CraftingStationType
{
public static string None => "None";
public static string Disabled => "Disabled";
public static string Workbench => "Workbench";
public static string Forge => "Forge";
public static string Cauldron => "Cauldron";
public static string Stonecutter => "Stonecutter";
public static string ArtisanTable => "ArtisanTable";
public static string BlackForge => "BlackForge";
public static string GaldrTable => "GaldrTable";
}
internal class HudAlignmentType
{
public static string TopLeft => "TopLeft";
public static string Top => "Top";
public static string TopRight => "TopRight";
public static string Left => "Left";
public static string Center => "Center";
public static string Right => "Right";
public static string BottomLeft => "BottomLeft";
public static string Bottom => "Bottom";
public static string BottomRight => "BottomRight";
}
internal class HudTimerFormat
{
public static string Minutes => "Minutes";
public static string Seconds => "Seconds";
}
}
namespace SplashMeads.Models
{
internal class CustomPrefabs
{
public GameObject BarlyWineSplash;
public GameObject BarlyWineSplashProjectile;
public GameObject BarlyWineSplashExplosion;
public GameObject BarlyWineSplashFX;
public GameObject BarlyWineSplashHudIcon;
public GameObject FrostResistSplash;
public GameObject FrostResistSplashProjectile;
public GameObject FrostResistSplashExplosion;
public GameObject FrostResistSplashFX;
public GameObject FrostResistSplashHudIcon;
public GameObject PoisonResistSplash;
public GameObject PoisonResistSplashProjectile;
public GameObject PoisonResistSplashExplosion;
public GameObject PoisonResistSplashFX;
public GameObject PoisonResistSplashHudIcon;
public GameObject RatatoskSplash;
public GameObject RatatoskSplashProjectile;
public GameObject RatatoskSplashExplosion;
public GameObject RatatoskSplashFX;
public GameObject RatatoskSplashHudIcon;
public GameObject VananidirSplash;
public GameObject VananidirSplashProjectile;
public GameObject VananidirSplashExplosion;
public GameObject VananidirSplashFX;
public GameObject VananidirSplashHudIcon;
public GameObject AntiStingSplash;
public GameObject AntiStingSplashProjectile;
public GameObject AntiStingSplashExplosion;
public GameObject AntiStingSplashFX;
public GameObject AntiStingSplashHudIcon;
public GameObject MajorHealthSplash;
public GameObject MajorHealthSplashProjectile;
public GameObject MajorHealthSplashExplosion;
public GameObject MajorHealthSplashFX;
public GameObject MajorHealthSplashHudIcon;
public GameObject MediumHealthSplash;
public GameObject MediumHealthSplashProjectile;
public GameObject MediumHealthSplashExplosion;
public GameObject MediumHealthSplashFX;
public GameObject MediumHealthSplashHudIcon;
public GameObject MinorHealthSplash;
public GameObject MinorHealthSplashProjectile;
public GameObject MinorHealthSplashExplosion;
public GameObject MinorHealthSplashFX;
public GameObject MinorHealthSplashHudIcon;
}
internal class CustomStatusEffects
{
public StatusEffect BarlyWineSplash;
public StatusEffect FrostResistSplash;
public StatusEffect PoisonResistSplash;
public StatusEffect RatatoskSplash;
public StatusEffect VananidirSplash;
public StatusEffect AntiStingSplash;
public StatusEffect MajorHealthSplash;
public StatusEffect MediumHealthSplash;
public StatusEffect MinorHealthSplash;
}
internal class SplashMeadConfigOptions
{
public GameObject prefab;
public string sectionName;
public string recipeName;
public bool enable = true;
public string name;
public string? description;
public string? craftingStation;
public int minStationLevel = 1;
public string recipe;
public int recipeAmount = 1;
public int maxStackSize = 10;
public float weight = 1f;
public int duration = 300;
public float radius = 4f;
public bool isCooldown;
public SplashMeadConfigOptions(GameObject prefab, string name, string recipe, bool isCooldown = false)
{
this.prefab = prefab;
this.name = name;
sectionName = name.Replace("'", "") ?? "";
this.recipe = recipe;
recipeName = "Recipe_" + ((Object)prefab).name;
this.isCooldown = isCooldown;
}
}
internal class UpdateItemDataOptions
{
public string? name = null;
public string? description = null;
public float? weight = null;
public int? maxStackSize = null;
}
internal class IconPosition
{
public float x;
public float y;
public IconPosition(float x, float y)
{
this.x = x;
this.y = y;
}
}
}
namespace SplashMeads.Helpers
{
internal class ItemHelper
{
public static void Create(GameObject prefab, SplashMeadConfig config)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: Expected O, but got Unknown
try
{
ItemConfig val = new ItemConfig();
val.Enabled = config.enable.Value;
val.Name = config.name.Value;
val.Description = config.description.Value;
val.CraftingStation = config.craftingStation.Value;
val.MinStationLevel = config.minStationLevel.Value;
val.Amount = config.recipeAmount.Value;
RequirementConfig[] asRequirementConfigArray = RecipeHelper.GetAsRequirementConfigArray(config.recipe.Value, null, null);
if (asRequirementConfigArray == null || asRequirementConfigArray.Length == 0)
{
Logger.LogWarning((object)("Could not resolve recipe for: " + ((Object)prefab).name));
}
else
{
val.Requirements = asRequirementConfigArray;
}
UpdateHelper.UpdateItemData(prefab, new UpdateItemDataOptions
{
weight = config.weight.Value,
maxStackSize = config.maxStackSize.Value
});
UpdateHelper.UpdateDuration(prefab, config.duration.Value);
UpdateHelper.UpdateRadius(prefab, config.radius.Value);
ItemManager.Instance.AddItem(new CustomItem(prefab, true, val));
}
catch (Exception ex)
{
Logger.LogError((object)("Could not create item: " + ex));
}
}
}
internal class UpdateHelper
{
public static void UpdateItemData(GameObject prefab, UpdateItemDataOptions options)
{
if ((Object)(object)prefab == (Object)null)
{
throw new Exception("Prefab is null");
}
ItemData itemData = prefab.GetComponent<ItemDrop>().m_itemData;
UpdateItemData(itemData, options);
UpdateItemDataInInventory(itemData, options);
}
public static void UpdateItemData(ItemData itemData, UpdateItemDataOptions options)
{
if (itemData == null)
{
throw new Exception("ItemData is null");
}
if (options.name != null)
{
itemData.m_shared.m_name = options.name;
}
if (options.description != null)
{
itemData.m_shared.m_description = options.description;
}
if (options.weight.HasValue)
{
itemData.m_shared.m_weight = options.weight.Value;
}
if (options.maxStackSize.HasValue)
{
itemData.m_shared.m_maxStackSize = options.maxStackSize.Value;
}
}
public static void UpdateItemDataInInventory(ItemData itemData, UpdateItemDataOptions options)
{
if ((Object)(object)Player.m_localPlayer == (Object)null)
{
return;
}
Inventory inventory = ((Humanoid)Player.m_localPlayer).GetInventory();
if (inventory == null)
{
return;
}
List<ItemData> list = inventory.GetAllItems().FindAll((ItemData item) => item.m_shared.m_name == itemData.m_shared.m_name);
if (list == null)
{
throw new Exception("Could not find items from Inventory");
}
foreach (ItemData item in list)
{
UpdateItemData(item, options);
}
}
public static void UpdateFXEnabled(GameObject prefab, bool value)
{
if ((Object)(object)prefab == (Object)null)
{
throw new Exception("Prefab is null");
}
Transform val = prefab.transform.Find("lingering_effects/particles");
if (!((Object)(object)val == (Object)null))
{
((Component)val).gameObject.SetActive(value);
}
}
public static void UpdateDuration(GameObject prefab, int duration)
{
//IL_0318: Unknown result type (might be due to invalid IL or missing references)
//IL_031d: Unknown result type (might be due to invalid IL or missing references)
//IL_032d: Unknown result type (might be due to invalid IL or missing references)
//IL_0352: Unknown result type (might be due to invalid IL or missing references)
//IL_0357: Unknown result type (might be due to invalid IL or missing references)
//IL_0381: Unknown result type (might be due to invalid IL or missing references)
//IL_0386: Unknown result type (might be due to invalid IL or missing references)
try
{
GameObject val = null;
StatusEffect val2 = null;
string name = ((Object)prefab).name;
string text = name;
if (text == ((Object)SplashMeads.Instance.prefabs.BarlyWineSplash).name)
{
val = SplashMeads.Instance.prefabs.BarlyWineSplashFX;
val2 = SplashMeads.Instance.effects.BarlyWineSplash;
}
else
{
string text2 = text;
if (text2 == ((Object)SplashMeads.Instance.prefabs.FrostResistSplash).name)
{
val = SplashMeads.Instance.prefabs.FrostResistSplashFX;
val2 = SplashMeads.Instance.effects.FrostResistSplash;
}
else
{
string text3 = text;
if (text3 == ((Object)SplashMeads.Instance.prefabs.PoisonResistSplash).name)
{
val = SplashMeads.Instance.prefabs.PoisonResistSplashFX;
val2 = SplashMeads.Instance.effects.PoisonResistSplash;
}
else
{
string text4 = text;
if (text4 == ((Object)SplashMeads.Instance.prefabs.RatatoskSplash).name)
{
val = SplashMeads.Instance.prefabs.RatatoskSplashFX;
val2 = SplashMeads.Instance.effects.RatatoskSplash;
}
else
{
string text5 = text;
if (text5 == ((Object)SplashMeads.Instance.prefabs.VananidirSplash).name)
{
val = SplashMeads.Instance.prefabs.VananidirSplashFX;
val2 = SplashMeads.Instance.effects.VananidirSplash;
}
else
{
string text6 = text;
if (text6 == ((Object)SplashMeads.Instance.prefabs.AntiStingSplash).name)
{
val = SplashMeads.Instance.prefabs.AntiStingSplashFX;
val2 = SplashMeads.Instance.effects.AntiStingSplash;
}
else
{
string text7 = text;
if (text7 == ((Object)SplashMeads.Instance.prefabs.MajorHealthSplash).name)
{
val = SplashMeads.Instance.prefabs.MajorHealthSplashFX;
val2 = SplashMeads.Instance.effects.MajorHealthSplash;
}
else
{
string text8 = text;
if (text8 == ((Object)SplashMeads.Instance.prefabs.MediumHealthSplash).name)
{
val = SplashMeads.Instance.prefabs.MediumHealthSplashFX;
val2 = SplashMeads.Instance.effects.MediumHealthSplash;
}
else
{
string text9 = text;
if (text9 == ((Object)SplashMeads.Instance.prefabs.MinorHealthSplash).name)
{
val = SplashMeads.Instance.prefabs.MinorHealthSplashFX;
val2 = SplashMeads.Instance.effects.MinorHealthSplash;
}
}
}
}
}
}
}
}
}
if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null)
{
throw new Exception("Could not find corresponding fx prefab or statuseffect");
}
val.GetComponent<TimedDestruction>().m_timeout = duration;
val2.m_ttl = duration;
Transform val3 = val.transform.Find("lingering_effects/flare");
Transform val4 = val.transform.Find("lingering_effects/flakes_up");
Transform val5 = val.transform.Find("lingering_effects/particles");
if ((Object)(object)val3 != (Object)null)
{
MainModule main = ((Component)val3).gameObject.GetComponent<ParticleSystem>().main;
((MainModule)(ref main)).duration = duration;
((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit((float)duration);
}
if ((Object)(object)val4 != (Object)null)
{
MainModule main2 = ((Component)val4).gameObject.GetComponent<ParticleSystem>().main;
((MainModule)(ref main2)).duration = duration - 3;
}
if ((Object)(object)val5 != (Object)null)
{
MainModule main3 = ((Component)val5).gameObject.GetComponent<ParticleSystem>().main;
((MainModule)(ref main3)).duration = duration - 3;
}
}
catch (Exception ex)
{
Logger.LogError((object)("Could not update splash mead duration: " + ex));
}
}
public static void UpdateRadius(GameObject prefab, float radius)
{
//IL_0278: Unknown result type (might be due to invalid IL or missing references)
try
{
GameObject val = null;
string name = ((Object)prefab).name;
string text = name;
if (text == ((Object)SplashMeads.Instance.prefabs.BarlyWineSplash).name)
{
val = SplashMeads.Instance.prefabs.BarlyWineSplashExplosion;
}
else
{
string text2 = text;
if (text2 == ((Object)SplashMeads.Instance.prefabs.FrostResistSplash).name)
{
val = SplashMeads.Instance.prefabs.FrostResistSplashExplosion;
}
else
{
string text3 = text;
if (text3 == ((Object)SplashMeads.Instance.prefabs.PoisonResistSplash).name)
{
val = SplashMeads.Instance.prefabs.PoisonResistSplashExplosion;
}
else
{
string text4 = text;
if (text4 == ((Object)SplashMeads.Instance.prefabs.RatatoskSplash).name)
{
val = SplashMeads.Instance.prefabs.RatatoskSplashExplosion;
}
else
{
string text5 = text;
if (text5 == ((Object)SplashMeads.Instance.prefabs.VananidirSplash).name)
{
val = SplashMeads.Instance.prefabs.VananidirSplashExplosion;
}
else
{
string text6 = text;
if (text6 == ((Object)SplashMeads.Instance.prefabs.AntiStingSplash).name)
{
val = SplashMeads.Instance.prefabs.AntiStingSplashExplosion;
}
else
{
string text7 = text;
if (text7 == ((Object)SplashMeads.Instance.prefabs.MajorHealthSplash).name)
{
val = SplashMeads.Instance.prefabs.MajorHealthSplashExplosion;
}
else
{
string text8 = text;
if (text8 == ((Object)SplashMeads.Instance.prefabs.MediumHealthSplash).name)
{
val = SplashMeads.Instance.prefabs.MediumHealthSplashExplosion;
}
else
{
string text9 = text;
if (text9 == ((Object)SplashMeads.Instance.prefabs.MinorHealthSplash).name)
{
val = SplashMeads.Instance.prefabs.MinorHealthSplashExplosion;
}
}
}
}
}
}
}
}
}
if ((Object)(object)val == (Object)null)
{
throw new Exception("Could not find corresponding explosion prefab");
}
if (radius < 2f)
{
radius = 2f;
}
else if (radius > 10f)
{
radius = 10f;
}
val.GetComponent<Aoe>().m_radius = radius;
Transform val2 = val.transform.Find("particles/wetsplsh");
if ((Object)(object)val2 == (Object)null)
{
throw new Exception("Could not find wet splash transform");
}
float num = 0.25f * radius;
val2.localScale = new Vector3(num, num, num);
}
catch (Exception ex)
{
Logger.LogError((object)("Could not update splash mead radius: " + ex));
}
}
}
}
namespace SplashMeads.Harmony
{
[HarmonyPatch]
public class PatchesSM
{
[HarmonyPrefix]
[HarmonyPatch(typeof(StatusEffect), "ResetTime")]
public static bool ResetTime_Prefix(ref StatusEffect __instance)
{
try
{
if ((Object)(object)__instance == (Object)null || (__instance.m_nameHash != SplashMeads.majorHealthSplashHash && __instance.m_nameHash != SplashMeads.mediumHealthSplashHash && __instance.m_nameHash != SplashMeads.minorHealthSplashHash))
{
return true;
}
return false;
}
catch (Exception ex)
{
Logger.LogError((object)("Something went wrong in ResetTime_Prefix: " + ex));
return true;
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(SEMan), "Internal_AddStatusEffect")]
public static bool Internal_AddStatusEffect_Prefix(ref SEMan __instance, int nameHash, bool resetTime, int itemLevel, float skillLevel)
{
try
{
if (__instance == null || nameHash == 0 || (nameHash != SplashMeads.majorHealthSplashHash && nameHash != SplashMeads.mediumHealthSplashHash && nameHash != SplashMeads.minorHealthSplashHash))
{
return true;
}
return ShouldHealthSplashRefresh(__instance, nameHash);
}
catch (Exception ex)
{
Logger.LogError((object)("Something went wrong in Internal_AddStatusEffect_Prefix: " + ex));
return true;
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(Character), "ApplyDamage")]
public static void ApplyDamage_Postfix(ref Character __instance, HitData hit)
{
try
{
if (!((Object)(object)__instance == (Object)null) && hit != null)
{
RefreshSplash(__instance, hit);
}
}
catch (Exception ex)
{
Logger.LogError((object)("Something went wrong in ApplyDamage_Postfix: " + ex));
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(Player), "ConsumeItem")]
public static void ConsumeItem_Postfix(ref Player __instance, ItemData item)
{
try
{
if ((Object)(object)__instance == (Object)null || item == null)
{
return;
}
StatusEffect consumeStatusEffect = item.m_shared.m_consumeStatusEffect;
string text = ((consumeStatusEffect != null) ? ((Object)consumeStatusEffect).name : null);
if (text != null)
{
int stableHashCode = StringExtensionMethods.GetStableHashCode(text);
if (stableHashCode != 0)
{
RemoveSplashWhenConsumeNormal(__instance, stableHashCode);
}
}
}
catch (Exception ex)
{
Logger.LogError((object)("Something went wrong in ConsumeItem_Postfix: " + ex));
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(EnemyHud), "Awake")]
public static void AwakeEnemyHud_Postfix(ref EnemyHud __instance)
{
try
{
if (!((Object)(object)__instance == (Object)null))
{
SplashMeads.Instance.prefabs.BarlyWineSplashHudIcon.transform.SetParent(__instance.m_baseHud.transform, false);
SplashMeads.Instance.prefabs.FrostResistSplashHudIcon.transform.SetParent(__instance.m_baseHud.transform, false);
SplashMeads.Instance.prefabs.PoisonResistSplashHudIcon.transform.SetParent(__instance.m_baseHud.transform, false);
SplashMeads.Instance.prefabs.RatatoskSplashHudIcon.transform.SetParent(__instance.m_baseHud.transform, false);
SplashMeads.Instance.prefabs.VananidirSplashHudIcon.transform.SetParent(__instance.m_baseHud.transform, false);
SplashMeads.Instance.prefabs.AntiStingSplashHudIcon.transform.SetParent(__instance.m_baseHud.transform, false);
SplashMeads.Instance.prefabs.MajorHealthSplashHudIcon.transform.SetParent(__instance.m_baseHud.transform, false);
SplashMeads.Instance.prefabs.MediumHealthSplashHudIcon.transform.SetParent(__instance.m_baseHud.transform, false);
SplashMeads.Instance.prefabs.MinorHealthSplashHudIcon.transform.SetParent(__instance.m_baseHud.transform, false);
}
}
catch (Exception ex)
{
Logger.LogError((object)("Something went wrong in AwakeEnemyHud_Postfix: " + ex));
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(MonsterAI), "PheromoneFleeCheck")]
public static void PheromoneFleeCheck_Postfix(ref MonsterAI __instance, ref bool __result, Character target)
{
try
{
if ((Object)(object)__instance == (Object)null)
{
return;
}
foreach (StatusEffect statusEffect in target.GetSEMan().GetStatusEffects())
{
SE_Stats val = (SE_Stats)(object)((statusEffect is SE_Stats) ? statusEffect : null);
if (val != null && val.m_pheromoneFlee)
{
Character component = val.m_pheromoneTarget.GetComponent<Character>();
if (component != null && component.m_name == ((BaseAI)__instance).m_character.m_name)
{
__result = true;
return;
}
}
}
__result = false;
}
catch (Exception ex)
{
Logger.LogError((object)("Something went wrong in PheromoneFleeCheck_Postfix: " + ex));
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(EnemyHud), "UpdateHuds")]
public static bool UpdateHuds_Prefix(ref EnemyHud __instance, Player player, Sadle sadle, float dt)
{
//IL_028b: Unknown result type (might be due to invalid IL or missing references)
//IL_0292: Expected O, but got Unknown
//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
//IL_02af: Expected O, but got Unknown
//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
//IL_02cc: Expected O, but got Unknown
//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
//IL_02e9: Expected O, but got Unknown
//IL_02ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0306: Expected O, but got Unknown
//IL_031c: Unknown result type (might be due to invalid IL or missing references)
//IL_0323: Expected O, but got Unknown
//IL_0339: Unknown result type (might be due to invalid IL or missing references)
//IL_0340: Expected O, but got Unknown
//IL_0356: Unknown result type (might be due to invalid IL or missing references)
//IL_035d: Expected O, but got Unknown
//IL_0373: Unknown result type (might be due to invalid IL or missing references)
//IL_037a: Expected O, but got Unknown
//IL_05ce: Unknown result type (might be due to invalid IL or missing references)
//IL_05d3: Unknown result type (might be due to invalid IL or missing references)
//IL_0628: Unknown result type (might be due to invalid IL or missing references)
//IL_062d: Unknown result type (might be due to invalid IL or missing references)
//IL_0637: Unknown result type (might be due to invalid IL or missing references)
//IL_063c: Unknown result type (might be due to invalid IL or missing references)
//IL_0641: Unknown result type (might be due to invalid IL or missing references)
//IL_0644: Unknown result type (might be due to invalid IL or missing references)
//IL_0646: Unknown result type (might be due to invalid IL or missing references)
//IL_064b: Unknown result type (might be due to invalid IL or missing references)
//IL_064d: Unknown result type (might be due to invalid IL or missing references)
//IL_061a: Unknown result type (might be due to invalid IL or missing references)
//IL_05f2: Unknown result type (might be due to invalid IL or missing references)
//IL_05fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0607: Unknown result type (might be due to invalid IL or missing references)
//IL_060c: Unknown result type (might be due to invalid IL or missing references)
//IL_065b: Unknown result type (might be due to invalid IL or missing references)
//IL_066a: Unknown result type (might be due to invalid IL or missing references)
//IL_06ab: Unknown result type (might be due to invalid IL or missing references)
//IL_0678: Unknown result type (might be due to invalid IL or missing references)
//IL_0687: Unknown result type (might be due to invalid IL or missing references)
try
{
Camera mainCamera = Utils.GetMainCamera();
if (!Object.op_Implicit((Object)(object)mainCamera))
{
return false;
}
Character val = (Object.op_Implicit((Object)(object)sadle) ? sadle.GetCharacter() : null);
Character val2 = (Object.op_Implicit((Object)(object)player) ? player.GetHoverCreature() : null);
Character val3 = null;
foreach (KeyValuePair<Character, HudData> hud in __instance.m_huds)
{
HudData value = hud.Value;
if (!Object.op_Implicit((Object)(object)value.m_character) || !__instance.TestShow(value.m_character, true) || (Object)(object)value.m_character == (Object)(object)val)
{
if ((Object)(object)val3 == (Object)null)
{
val3 = value.m_character;
Object.Destroy((Object)(object)value.m_gui);
}
continue;
}
if ((Object)(object)value.m_character == (Object)(object)val2)
{
value.m_hoverTimer = 0f;
}
value.m_hoverTimer += dt;
float healthPercentage = value.m_character.GetHealthPercentage();
if (value.m_character.IsPlayer() || value.m_character.IsBoss() || value.m_isMount || value.m_hoverTimer < __instance.m_hoverShowDuration)
{
value.m_gui.SetActive(true);
int level = value.m_character.GetLevel();
if (Object.op_Implicit((Object)(object)value.m_level2))
{
((Component)value.m_level2).gameObject.SetActive(level == 2);
}
if (Object.op_Implicit((Object)(object)value.m_level3))
{
((Component)value.m_level3).gameObject.SetActive(level == 3);
}
((TMP_Text)value.m_name).text = Localization.instance.Localize(value.m_character.GetHoverName());
if (!value.m_character.IsBoss() && !value.m_character.IsPlayer())
{
bool flag = value.m_character.GetBaseAI().HaveTarget();
bool flag2 = value.m_character.GetBaseAI().IsAlerted();
((Component)value.m_alerted).gameObject.SetActive(flag2);
((Component)value.m_aware).gameObject.SetActive(!flag2 && flag);
if (value.m_character.IsTamed())
{
RectTransform icon = (RectTransform)value.m_gui.transform.Find("SplashBarleyWine");
RectTransform icon2 = (RectTransform)value.m_gui.transform.Find("SplashFrostResist");
RectTransform icon3 = (RectTransform)value.m_gui.transform.Find("SplashPoisonResist");
RectTransform icon4 = (RectTransform)value.m_gui.transform.Find("SplashRatatosk");
RectTransform icon5 = (RectTransform)value.m_gui.transform.Find("SplashVananidir");
RectTransform icon6 = (RectTransform)value.m_gui.transform.Find("SplashAntiSting");
RectTransform icon7 = (RectTransform)value.m_gui.transform.Find("SplashMajorHealth");
RectTransform icon8 = (RectTransform)value.m_gui.transform.Find("SplashMediumHealth");
RectTransform icon9 = (RectTransform)value.m_gui.transform.Find("SplashMinorHealth");
IconPosition iconPos = new IconPosition(0f - (PluginConfig.HudIconSize.Value + 5f), (level == 1) ? (0f - PluginConfig.HudIconSize.Value / 2f) : (0f - PluginConfig.HudIconSize.Value));
iconPos = UpdateHudIcon(value.m_character, icon, SplashMeads.barleyWineSplashHash, iconPos);
iconPos = UpdateHudIcon(value.m_character, icon2, SplashMeads.frostResistSplashHash, iconPos);
iconPos = UpdateHudIcon(value.m_character, icon3, SplashMeads.poisonResistSplashHash, iconPos);
iconPos = UpdateHudIcon(value.m_character, icon4, SplashMeads.ratatoskSplashHash, iconPos);
iconPos = UpdateHudIcon(value.m_character, icon5, SplashMeads.vananidirSplashHash, iconPos);
iconPos = UpdateHudIcon(value.m_character, icon6, SplashMeads.antiStingSplashHash, iconPos);
iconPos = UpdateHudIcon(value.m_character, icon7, SplashMeads.majorHealthSplashHash, iconPos);
iconPos = UpdateHudIcon(value.m_character, icon8, SplashMeads.mediumHealthSplashHash, iconPos);
iconPos = UpdateHudIcon(value.m_character, icon9, SplashMeads.minorHealthSplashHash, iconPos);
}
}
}
else
{
value.m_gui.SetActive(false);
}
value.m_healthSlow.SetValue(healthPercentage);
if (Object.op_Implicit((Object)(object)value.m_healthFastFriendly))
{
bool flag3 = !Object.op_Implicit((Object)(object)player) || BaseAI.IsEnemy((Character)(object)player, value.m_character);
((Component)value.m_healthFast).gameObject.SetActive(flag3);
((Component)value.m_healthFastFriendly).gameObject.SetActive(!flag3);
value.m_healthFast.SetValue(healthPercentage);
value.m_healthFastFriendly.SetValue(healthPercentage);
}
else
{
value.m_healthFast.SetValue(healthPercentage);
}
if (value.m_isMount)
{
float stamina = sadle.GetStamina();
float maxStamina = sadle.GetMaxStamina();
value.m_stamina.SetValue(stamina / maxStamina);
((TMP_Text)value.m_healthText).text = Mathf.CeilToInt(value.m_character.GetHealth()).ToString();
((TMP_Text)value.m_staminaText).text = Mathf.CeilToInt(stamina).ToString();
}
if (!value.m_character.IsBoss() && value.m_gui.activeSelf)
{
Vector3 zero = Vector3.zero;
zero = (value.m_character.IsPlayer() ? (value.m_character.GetHeadPoint() + Vector3.up * 0.3f) : ((!value.m_isMount) ? value.m_character.GetTopPoint() : (((Component)player).transform.position - ((Component)player).transform.up * 0.5f)));
Vector3 val4 = Utils.WorldToScreenPointScaled(mainCamera, zero);
if (val4.x < 0f || val4.x > (float)Screen.width || val4.y < 0f || val4.y > (float)Screen.height || val4.z > 0f)
{
value.m_gui.transform.position = val4;
value.m_gui.SetActive(true);
}
else
{
value.m_gui.SetActive(false);
}
}
}
if ((Object)(object)val3 != (Object)null)
{
__instance.m_huds.Remove(val3);
}
return false;
}
catch (Exception ex)
{
Logger.LogError((object)("Something went wrong in UpdateHuds_Prefix: " + ex));
return true;
}
}
private static void RefreshSplash(Character character, HitData hit)
{
int statusEffectHash = hit.m_statusEffectHash;
if (statusEffectHash == SplashMeads.barleyWineSplashHash && character.GetSEMan().HaveStatusEffect(SplashMeads.barleyWineSplashHash))
{
character.GetSEMan().RemoveStatusEffect(SplashMeads.barleyWineSplashHash, false);
if (ShouldSplashRefresh(character, SplashMeads.barleyWineHash, PluginConfig.mead1.duration.Value, removeOriginal: true))
{
ApplySkinnedMeshToFX(SplashMeads.Instance.prefabs.BarlyWineSplashFX, character);
character.GetSEMan().AddStatusEffect(SplashMeads.barleyWineSplashHash, false, 0, 0f);
}
}
else if (statusEffectHash == SplashMeads.frostResistSplashHash && character.GetSEMan().HaveStatusEffect(SplashMeads.frostResistSplashHash))
{
character.GetSEMan().RemoveStatusEffect(SplashMeads.frostResistSplashHash, false);
if (ShouldSplashRefresh(character, SplashMeads.frostResistHash, PluginConfig.mead2.duration.Value, removeOriginal: true))
{
ApplySkinnedMeshToFX(SplashMeads.Instance.prefabs.FrostResistSplashFX, character);
character.GetSEMan().AddStatusEffect(SplashMeads.frostResistSplashHash, false, 0, 0f);
}
}
else if (statusEffectHash == SplashMeads.poisonResistSplashHash && character.GetSEMan().HaveStatusEffect(SplashMeads.poisonResistSplashHash))
{
character.GetSEMan().RemoveStatusEffect(SplashMeads.poisonResistSplashHash, false);
if (ShouldSplashRefresh(character, SplashMeads.poisonResistHash, PluginConfig.mead3.duration.Value, removeOriginal: true))
{
ApplySkinnedMeshToFX(SplashMeads.Instance.prefabs.PoisonResistSplashFX, character);
character.GetSEMan().AddStatusEffect(SplashMeads.poisonResistSplashHash, false, 0, 0f);
}
}
else if (statusEffectHash == SplashMeads.ratatoskSplashHash && character.GetSEMan().HaveStatusEffect(SplashMeads.ratatoskSplashHash))
{
character.GetSEMan().RemoveStatusEffect(SplashMeads.ratatoskSplashHash, false);
if (ShouldSplashRefresh(character, SplashMeads.ratatoskHash, PluginConfig.mead4.duration.Value, removeOriginal: true))
{
ApplySkinnedMeshToFX(SplashMeads.Instance.prefabs.RatatoskSplashFX, character);
if (((Object)((Component)character).gameObject).name == "Lox(Clone)")
{
GameObject gameObject = ((Component)SplashMeads.Instance.prefabs.RatatoskSplashFX.transform.Find("lingering_effects/particles")).gameObject;
GameObject gameObject2 = ((Component)SplashMeads.Instance.prefabs.RatatoskSplashFX.transform.Find("lingering_effects/particles_lox")).gameObject;
gameObject.SetActive(false);
gameObject2.SetActive(true);
character.GetSEMan().AddStatusEffect(SplashMeads.ratatoskSplashHash, false, 0, 0f);
gameObject.SetActive(true);
gameObject2.SetActive(false);
}
else
{
character.GetSEMan().AddStatusEffect(SplashMeads.ratatoskSplashHash, false, 0, 0f);
}
}
}
else if (statusEffectHash == SplashMeads.vananidirSplashHash && character.GetSEMan().HaveStatusEffect(SplashMeads.vananidirSplashHash))
{
character.GetSEMan().RemoveStatusEffect(SplashMeads.vananidirSplashHash, false);
if (ShouldSplashRefresh(character, SplashMeads.vananidirHash, PluginConfig.mead5.duration.Value, removeOriginal: true))
{
ApplySkinnedMeshToFX(SplashMeads.Instance.prefabs.VananidirSplashFX, character);
character.GetSEMan().AddStatusEffect(SplashMeads.vananidirSplashHash, false, 0, 0f);
}
}
else
{
if (statusEffectHash != SplashMeads.antiStingSplashHash || !character.GetSEMan().HaveStatusEffect(SplashMeads.antiStingSplashHash))
{
return;
}
character.GetSEMan().RemoveStatusEffect(SplashMeads.antiStingSplashHash, false);
if (ShouldSplashRefresh(character, SplashMeads.antiStingHash, PluginConfig.mead6.duration.Value, removeOriginal: true))
{
ApplySkinnedMeshToFX(SplashMeads.Instance.prefabs.AntiStingSplashFX, character);
if (((Object)((Component)character).gameObject).name == "Lox(Clone)")
{
GameObject gameObject3 = ((Component)SplashMeads.Instance.prefabs.AntiStingSplashFX.transform.Find("lingering_effects/particles")).gameObject;
GameObject gameObject4 = ((Component)SplashMeads.Instance.prefabs.AntiStingSplashFX.transform.Find("lingering_effects/particles_lox")).gameObject;
gameObject3.SetActive(false);
gameObject4.SetActive(true);
character.GetSEMan().AddStatusEffect(SplashMeads.antiStingSplashHash, false, 0, 0f);
gameObject3.SetActive(true);
gameObject4.SetActive(false);
}
else
{
character.GetSEMan().AddStatusEffect(SplashMeads.antiStingSplashHash, false, 0, 0f);
}
}
}
}
private static bool ShouldSplashRefresh(Character character, int originalEffectHash, int splashDuration, bool removeOriginal = false)
{
if (!character.GetSEMan().HaveStatusEffect(originalEffectHash))
{
return true;
}
StatusEffect statusEffect = character.GetSEMan().GetStatusEffect(originalEffectHash);
if (statusEffect.GetRemaningTime() < (float)splashDuration)
{
if (removeOriginal)
{
character.GetSEMan().RemoveStatusEffect(statusEffect, false);
}
return true;
}
return false;
}
private static bool ShouldHealthSplashRefresh(SEMan __instance, int effectHash)
{
if (!__instance.HaveStatusEffectCategory("healthpotion"))
{
return true;
}
return false;
}
private static void ApplySkinnedMeshToFX(GameObject prefab, Character character)
{
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
if (!PluginConfig.showParticles.Value)
{
return;
}
Transform val = prefab.transform.Find("lingering_effects/flare");
Transform val2 = prefab.transform.Find("lingering_effects/flakes_up");
Transform val3 = prefab.transform.Find("lingering_effects/particles");
if (character.IsPlayer() && !PluginConfig.showParticlesOnPlayers.Value)
{
if (val != null)
{
((Component)val).gameObject.SetActive(false);
}
if (val2 != null)
{
((Component)val2).gameObject.SetActive(false);
}
if (val3 != null)
{
((Component)val3).gameObject.SetActive(false);
}
return;
}
if (val != null)
{
((Component)val).gameObject.SetActive(true);
}
if (val2 != null)
{
((Component)val2).gameObject.SetActive(true);
}
if (val3 != null)
{
((Component)val3).gameObject.SetActive(true);
}
if (!((Object)(object)val3 == (Object)null))
{
ParticleSystem component = ((Component)val3).GetComponent<ParticleSystem>();
ShapeModule shape = component.shape;
}
}
private static SkinnedMeshRenderer GetBodyRenderer(SkinnedMeshRenderer[] renderers)
{
List<string> list = new List<string> { "poly art boar", "body", "m", "lavaneck.001" };
if (renderers.Length == 1)
{
return renderers[0];
}
foreach (SkinnedMeshRenderer val in renderers)
{
if (list.Contains(((Object)val).name.ToLower()))
{
return val;
}
}
return null;
}
private static void RemoveSplashWhenConsumeNormal(Player player, int effectHash)
{
if (effectHash == SplashMeads.barleyWineHash && ((Character)player).GetSEMan().HaveStatusEffect(SplashMeads.barleyWineSplashHash))
{
((Character)player).GetSEMan().RemoveStatusEffect(SplashMeads.barleyWineSplashHash, false);
}
else if (effectHash == SplashMeads.frostResistHash && ((Character)player).GetSEMan().HaveStatusEffect(SplashMeads.frostResistSplashHash))
{
((Character)player).GetSEMan().RemoveStatusEffect(SplashMeads.frostResistSplashHash, false);
}
else if (effectHash == SplashMeads.poisonResistHash && ((Character)player).GetSEMan().HaveStatusEffect(SplashMeads.poisonResistSplashHash))
{
((Character)player).GetSEMan().RemoveStatusEffect(SplashMeads.poisonResistSplashHash, false);
}
else if (effectHash == SplashMeads.ratatoskHash && ((Character)player).GetSEMan().HaveStatusEffect(SplashMeads.ratatoskSplashHash))
{
((Character)player).GetSEMan().RemoveStatusEffect(SplashMeads.ratatoskSplashHash, false);
}
else if (effectHash == SplashMeads.vananidirHash && ((Character)player).GetSEMan().HaveStatusEffect(SplashMeads.vananidirSplashHash))
{
((Character)player).GetSEMan().RemoveStatusEffect(SplashMeads.vananidirSplashHash, false);
}
else if (effectHash == SplashMeads.antiStingHash && ((Character)player).GetSEMan().HaveStatusEffect(SplashMeads.antiStingSplashHash))
{
((Character)player).GetSEMan().RemoveStatusEffect(SplashMeads.antiStingSplashHash, false);
}
}
private static IconPosition UpdateHudIcon(Character character, RectTransform icon, int splashHash, IconPosition iconPos)
{
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Expected O, but got Unknown
//IL_0118: Unknown result type (might be due to invalid IL or missing references)
if (!PluginConfig.showHudIcons.Value)
{
((Component)icon).gameObject.SetActive(false);
return iconPos;
}
if (character.GetSEMan().HaveStatusEffect(splashHash))
{
((Component)icon).gameObject.SetActive(true);
icon.sizeDelta = new Vector2(PluginConfig.HudIconSize.Value, PluginConfig.HudIconSize.Value);
icon.anchoredPosition = new Vector2(iconPos.x, iconPos.y);
RectTransform val = (RectTransform)((Transform)icon).Find("Text");
if ((Object)(object)val == (Object)null)
{
throw new Exception("Could not find text component");
}
TextMeshProUGUI component = ((Component)val).gameObject.GetComponent<TextMeshProUGUI>();
if (PluginConfig.showHudTimers.Value)
{
StatusEffect statusEffect = character.GetSEMan().GetStatusEffect(splashHash);
string text = FormatTime(statusEffect.GetRemaningTime());
((TMP_Text)component).SetText(text);
((TMP_Text)component).fontSize = PluginConfig.timersFontSize.Value;
val.sizeDelta = new Vector2(PluginConfig.HudIconSize.Value, PluginConfig.HudIconSize.Value);
switch (PluginConfig.timersAlignment.Value)
{
case "TopLeft":
((TMP_Text)component).alignment = (TextAlignmentOptions)257;
break;
case "Top":
((TMP_Text)component).alignment = (TextAlignmentOptions)258;
break;
case "TopRight":
((TMP_Text)component).alignment = (TextAlignmentOptions)260;
break;
case "Left":
((TMP_Text)component).alignment = (TextAlignmentOptions)513;
break;
case "Center":
((TMP_Text)component).alignment = (TextAlignmentOptions)514;
break;
case "Right":
((TMP_Text)component).alignment = (TextAlignmentOptions)516;
break;
case "BottomLeft":
((TMP_Text)component).alignment = (TextAlignmentOptions)1025;
break;
case "Bottom":
((TMP_Text)component).alignment = (TextAlignmentOptions)1026;
break;
case "BottomRight":
((TMP_Text)component).alignment = (TextAlignmentOptions)1028;
break;
default:
((TMP_Text)component).alignment = (TextAlignmentOptions)514;
break;
}
}
else
{
((TMP_Text)component).SetText("");
}
return CalcIconPos(iconPos);
}
((Component)icon).gameObject.SetActive(false);
return iconPos;
}
private static string FormatTime(float time)
{
if (PluginConfig.timersFormat.Value == HudTimerFormat.Seconds)
{
return time.ToString("F0");
}
int num = int.Parse(time.ToString("F0"));
int num2 = num / 60;
int num3 = num % 60;
string text = ((num2 > 0) ? $"{num2}:" : "");
string text2 = ((num2 > 0 && num3 < 10) ? $"0{num3}" : $"{num3}");
return text + text2;
}
private static IconPosition CalcIconPos(IconPosition value)
{
float num = value.x + PluginConfig.HudIconSize.Value + 5f;
float y = value.y;
if (num > PluginConfig.HudIconSize.Value + 5f)
{
num = 0f - (PluginConfig.HudIconSize.Value + 5f);
y = value.y + (0f - PluginConfig.HudIconSize.Value);
}
return new IconPosition(num, y);
}
}
}
namespace SplashMeads.Configs
{
internal static class PluginConfig
{
private static string mead1Name = "Splash Fire Resistance Barley Wine";
private static string mead1Recipe = "BarleyWine:6, LeatherScraps:3, Resin:2";
public static SplashMeadConfig mead1 = new SplashMeadConfig();
private static string mead2Name = "Splash Frost Resistance Mead";
private static string mead2Recipe = "MeadFrostResist:6, LeatherScraps:3, Resin:2";
public static SplashMeadConfig mead2 = new SplashMeadConfig();
private static string mead3Name = "Splash Poison Resistance Mead";
private static string mead3Recipe = "MeadPoisonResist:6, LeatherScraps:3, Resin:2";
public static SplashMeadConfig mead3 = new SplashMeadConfig();
private static string mead4Name = "Splash Ratatosk Tonic";
private static string mead4Recipe = "MeadHasty:6, LeatherScraps:3, Resin:2";
public static SplashMeadConfig mead4 = new SplashMeadConfig();
private static string mead5Name = "Splash Vananidir Mead";
private static string mead5Recipe = "MeadSwimmer:6, LeatherScraps:3, Resin:2";
public static SplashMeadConfig mead5 = new SplashMeadConfig();
private static string mead6Name = "Splash Anti-Sting Mead";
private static string mead6Recipe = "MeadBugRepellent:6, LeatherScraps:3, Resin:2";
public static SplashMeadConfig mead6 = new SplashMeadConfig();
private static string mead7Name = "Splash Major Health Mead";
private static string mead7Recipe = "MeadHealthMajor:6, LeatherScraps:3, Resin:2";
public static SplashMeadConfig mead7 = new SplashMeadConfig();
private static string mead8Name = "Splash Medium Health Mead";
private static string mead8Recipe = "MeadHealthMedium:6, LeatherScraps:3, Resin:2";
public static SplashMeadConfig mead8 = new SplashMeadConfig();
private static string mead9Name = "Splash Minor Health Mead";
private static string mead9Recipe = "MeadHealthMinor:6, LeatherScraps:3, Resin:2";
public static SplashMeadConfig mead9 = new SplashMeadConfig();
public static string generalSectionname = "General";
public static ConfigEntry<bool> showParticles;
public static ConfigEntry<bool> showParticlesOnPlayers;
public static ConfigEntry<bool> showHudIcons;
public static ConfigEntry<float> HudIconSize;
public static ConfigEntry<bool> showHudTimers;
public static ConfigEntry<int> timersFontSize;
public static ConfigEntry<string> timersFormat;
public static ConfigEntry<string> timersAlignment;
public static string[] hudAlignmentOptions = new string[9]
{
HudAlignmentType.TopLeft,
HudAlignmentType.Top,
HudAlignmentType.TopRight,
HudAlignmentType.Left,
HudAlignmentType.Center,
HudAlignmentType.Right,
HudAlignmentType.BottomLeft,
HudAlignmentType.Bottom,
HudAlignmentType.BottomRight
};
public static string[] hudTimerFormatOptions = new string[2]
{
HudTimerFormat.Minutes,
HudTimerFormat.Seconds
};
public static void Init()
{
InitGeneralConfig();
InitMeadsConfig();
}
public static void InitGeneralConfig()
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Expected O, but got Unknown
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Expected O, but got Unknown
//IL_004e: Expected O, but got Unknown
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Expected O, but got Unknown
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Expected O, but got Unknown
//IL_00ca: Expected O, but got Unknown
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Expected O, but got Unknown
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_011b: Expected O, but got Unknown
//IL_011b: Expected O, but got Unknown
//IL_0134: Unknown result type (might be due to invalid IL or missing references)
//IL_015a: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: Unknown result type (might be due to invalid IL or missing references)
//IL_0167: Unknown result type (might be due to invalid IL or missing references)
//IL_0174: Expected O, but got Unknown
//IL_0174: Unknown result type (might be due to invalid IL or missing references)
//IL_017e: Expected O, but got Unknown
//IL_017e: Expected O, but got Unknown
//IL_0197: Unknown result type (might be due to invalid IL or missing references)
//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
//IL_01c5: Expected O, but got Unknown
//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
//IL_01cf: Expected O, but got Unknown
//IL_01cf: Expected O, but got Unknown
//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
//IL_0205: Unknown result type (might be due to invalid IL or missing references)
//IL_020a: Unknown result type (might be due to invalid IL or missing references)
//IL_0212: Unknown result type (might be due to invalid IL or missing references)
//IL_021f: Expected O, but got Unknown
//IL_021f: Unknown result type (might be due to invalid IL or missing references)
//IL_0229: Expected O, but got Unknown
//IL_0229: Expected O, but got Unknown
//IL_0242: Unknown result type (might be due to invalid IL or missing references)
//IL_0263: Unknown result type (might be due to invalid IL or missing references)
//IL_0268: Unknown result type (might be due to invalid IL or missing references)
//IL_0270: Unknown result type (might be due to invalid IL or missing references)
//IL_027d: Expected O, but got Unknown
//IL_027d: Unknown result type (might be due to invalid IL or missing references)
//IL_0287: Expected O, but got Unknown
//IL_0287: Expected O, but got Unknown
//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
//IL_02db: Expected O, but got Unknown
//IL_02db: Unknown result type (might be due to invalid IL or missing references)
//IL_02e5: Expected O, but got Unknown
//IL_02e5: Expected O, but got Unknown
showParticles = ((BaseUnityPlugin)SplashMeads.Instance).Config.Bind<bool>(new ConfigDefinition(generalSectionname, "Show particles"), true, new ConfigDescription("Show particles when tames/players are affected by a splash mead", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
{
IsAdminOnly = false,
Order = 10
} }));
showParticles.SettingChanged += delegate
{
UpdateHelper.UpdateFXEnabled(SplashMeads.Instance.prefabs.BarlyWineSplashFX, showParticles.Value);
UpdateHelper.UpdateFXEnabled(SplashMeads.Instance.prefabs.FrostResistSplashFX, showParticles.Value);
UpdateHelper.UpdateFXEnabled(SplashMeads.Instance.prefabs.PoisonResistSplashFX, showParticles.Value);
UpdateHelper.UpdateFXEnabled(SplashMeads.Instance.prefabs.RatatoskSplashFX, showParticles.Value);
UpdateHelper.UpdateFXEnabled(SplashMeads.Instance.prefabs.VananidirSplashFX, showParticles.Value);
UpdateHelper.UpdateFXEnabled(SplashMeads.Instance.prefabs.AntiStingSplashFX, showParticles.Value);
};
showParticlesOnPlayers = ((BaseUnityPlugin)SplashMeads.Instance).Config.Bind<bool>(new ConfigDefinition(generalSectionname, "Show particles on players"), true, new ConfigDescription("Show particles on players affected by a splash mead", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
{
IsAdminOnly = false,
Order = 9
} }));
showHudIcons = ((BaseUnityPlugin)SplashMeads.Instance).Config.Bind<bool>(new ConfigDefinition(generalSectionname, "Show hud icons"), true, new ConfigDescription("Show splash mead icons underneath healthbar of tames", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
{
IsAdminOnly = false,
Order = 8
} }));
HudIconSize = ((BaseUnityPlugin)SplashMeads.Instance).Config.Bind<float>(new ConfigDefinition(generalSectionname, "Icon size"), 30f, new ConfigDescription("The hud icon size", (AcceptableValueBase)(object)new AcceptableValueRange<float>(30f, 50f), new object[1] { (object)new ConfigurationManagerAttributes
{
IsAdminOnly = false,
Order = 7
} }));
showHudTimers = ((BaseUnityPlugin)SplashMeads.Instance).Config.Bind<bool>(new ConfigDefinition(generalSectionname, "Show hud timers"), true, new ConfigDescription("Show a timer on the icons", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
{
IsAdminOnly = false,
Order = 6
} }));
timersFontSize = ((BaseUnityPlugin)SplashMeads.Instance).Config.Bind<int>(new ConfigDefinition(generalSectionname, "Timer font size"), 16, new ConfigDescription("The font size of hud timers", (AcceptableValueBase)(object)new AcceptableValueRange<int>(12, 24), new object[1] { (object)new ConfigurationManagerAttributes
{
IsAdminOnly = false,
Order = 5
} }));
timersFormat = ((BaseUnityPlugin)SplashMeads.Instance).Config.Bind<string>(new ConfigDefinition(generalSectionname, "Timer format"), HudTimerFormat.Minutes, new ConfigDescription("The format in which the timers are displayed (minutes:seconds or the entire duration in seconds)", (AcceptableValueBase)(object)new AcceptableValueList<string>(hudTimerFormatOptions), new object[1] { (object)new ConfigurationManagerAttributes
{
IsAdminOnly = false,
Order = 4
} }));
timersAlignment = ((BaseUnityPlugin)SplashMeads.Instance).Config.Bind<string>(new ConfigDefinition(generalSectionname, "Timer alignment"), HudAlignmentType.Bottom, new ConfigDescription("The alignment of the hud timers (topLeft, top, center etc.", (AcceptableValueBase)(object)new AcceptableValueList<string>(hudAlignmentOptions), new object[1] { (object)new ConfigurationManagerAttributes
{
IsAdminOnly = false,
Order = 3
} }));
}
public static void InitMeadsConfig()
{
try
{
SplashMeadConfigOptions options = new SplashMeadConfigOptions(SplashMeads.Instance.prefabs.BarlyWineSplash, mead1Name, mead1Recipe)
{
description = "Applies " + mead1Name.Replace("Splash ", "") + " to friendlies hit or in the splash radius",
craftingStation = CraftingStationType.Workbench,
minStationLevel = 3,
recipeAmount = 2
};
mead1.GenerateConfig(options);
SplashMeadConfigOptions options2 = new SplashMeadConfigOptions(SplashMeads.Instance.prefabs.FrostResistSplash, mead2Name, mead2Recipe)
{
description = "Applies " + mead2Name.Replace("Splash ", "") + " to friendlies hit or in the splash radius",
craftingStation = CraftingStationType.Workbench,
minStationLevel = 3,
recipeAmount = 2
};
mead2.GenerateConfig(options2);
SplashMeadConfigOptions options3 = new SplashMeadConfigOptions(SplashMeads.Instance.prefabs.PoisonResistSplash, mead3Name, mead3Recipe)
{
description = "Applies " + mead3Name.Replace("Splash ", "") + " to friendlies hit or in the splash radius",
craftingStation = CraftingStationType.Workbench,
minStationLevel = 3,
recipeAmount = 2
};
mead3.GenerateConfig(options3);
SplashMeadConfigOptions options4 = new SplashMeadConfigOptions(SplashMeads.Instance.prefabs.RatatoskSplash, mead4Name, mead4Recipe)
{
description = "Applies " + mead4Name.Replace("Splash ", "") + " to friendlies hit or in the splash radius",
craftingStation = CraftingStationType.Workbench,
minStationLevel = 3,
recipeAmount = 2
};
mead4.GenerateConfig(options4);
SplashMeadConfigOptions options5 = new SplashMeadConfigOptions(SplashMeads.Instance.prefabs.VananidirSplash, mead5Name, mead5Recipe)
{
description = "Applies " + mead5Name.Replace("Splash ", "") + " to friendlies hit or in the splash radius",
craftingStation = CraftingStationType.Workbench,
minStationLevel = 3,
recipeAmount = 2
};
mead5.GenerateConfig(options5);
SplashMeadConfigOptions options6 = new SplashMeadConfigOptions(SplashMeads.Instance.prefabs.AntiStingSplash, mead6Name, mead6Recipe)
{
description = "Applies " + mead6Name.Replace("Splash ", "") + " to friendlies hit or in the splash radius",
craftingStation = CraftingStationType.Workbench,
minStationLevel = 3,
recipeAmount = 2
};
mead6.GenerateConfig(options6);
SplashMeadConfigOptions options7 = new SplashMeadConfigOptions(SplashMeads.Instance.prefabs.MajorHealthSplash, mead7Name, mead7Recipe)
{
description = "Applies " + mead7Name.Replace("Splash ", "") + " to friendlies hit or in the splash radius",
craftingStation = CraftingStationType.Workbench,
minStationLevel = 3,
recipeAmount = 2,
duration = 120,
isCooldown = true
};
mead7.GenerateConfig(options7);
SplashMeadConfigOptions options8 = new SplashMeadConfigOptions(SplashMeads.Instance.prefabs.MediumHealthSplash, mead8Name, mead8Recipe)
{
description = "Applies " + mead8Name.Replace("Splash ", "") + " to friendlies hit or in the splash radius",
craftingStation = CraftingStationType.Workbench,
minStationLevel = 3,
recipeAmount = 2,
duration = 120,
isCooldown = true
};
mead8.GenerateConfig(options8);
SplashMeadConfigOptions options9 = new SplashMeadConfigOptions(SplashMeads.Instance.prefabs.MinorHealthSplash, mead9Name, mead9Recipe)
{
description = "Applies " + mead9Name.Replace("Splash ", "") + " to friendlies hit or in the splash radius",
craftingStation = CraftingStationType.Workbench,
minStationLevel = 3,
recipeAmount = 2,
duration = 120,
isCooldown = true
};
mead9.GenerateConfig(options9);
}
catch (Exception ex)
{
Logger.LogError((object)("Could not initialise splash meads config: " + ex));
}
}
}
internal class SplashMeadConfig
{
public static string[] craftingStationOptions = new string[9]
{
CraftingStationType.None,
CraftingStationType.Disabled,
CraftingStationType.Workbench,
CraftingStationType.Forge,
CraftingStationType.Stonecutter,
CraftingStationType.Cauldron,
CraftingStationType.ArtisanTable,
CraftingStationType.BlackForge,
CraftingStationType.GaldrTable
};
public ConfigEntry<bool> enable;
public ConfigEntry<string> name;
public ConfigEntry<string> description;
public ConfigEntry<string> craftingStation;
public ConfigEntry<int> minStationLevel;
public ConfigEntry<string> recipe;
public ConfigEntry<int> recipeAmount;
public ConfigEntry<float> weight;
public ConfigEntry<int> maxStackSize;
public ConfigEntry<int> duration;
public ConfigEntry<float> radius;
private int entryCount = 10;
public void GenerateConfig(SplashMeadConfigOptions options)
{
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Expected O, but got Unknown
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Expected O, but got Unknown
//IL_0079: Expected O, but got Unknown
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Expected O, but got Unknown
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Expected O, but got Unknown
//IL_00ef: Expected O, but got Unknown
//IL_011e: Unknown result type (might be due to invalid IL or missing references)
//IL_013c: Unknown result type (might be due to invalid IL or missing references)
//IL_0141: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Unknown result type (might be due to invalid IL or missing references)
//IL_015b: Expected O, but got Unknown
//IL_015b: Unknown result type (might be due to invalid IL or missing references)
//IL_0165: Expected O, but got Unknown
//IL_0165: Expected O, but got Unknown
//IL_0195: Unknown result type (might be due to invalid IL or missing references)
//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
//IL_01db: Expected O, but got Unknown
//IL_01db: Unknown result type (might be due to invalid IL or missing references)
//IL_01e5: Expected O, but got Unknown
//IL_01e5: Expected O, but got Unknown
//IL_0214: Unknown result type (might be due to invalid IL or missing references)
//IL_0232: Unknown result type (might be due to invalid IL or missing references)
//IL_0237: 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_0251: Expected O, but got Unknown
//IL_0251: Unknown result type (might be due to invalid IL or missing references)
//IL_025b: Expected O, but got Unknown
//IL_025b: Expected O, but got Unknown
//IL_028a: Unknown result type (might be due to invalid IL or missing references)
//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
//IL_02c7: Expected O, but got Unknown
//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
//IL_02d1: Expected O, but got Unknown
//IL_02d1: Expected O, but got Unknown
//IL_0300: 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_0323: Unknown result type (might be due to invalid IL or missing references)
//IL_032b: Unknown result type (might be due to invalid IL or missing references)
//IL_033d: Expected O, but got Unknown
//IL_033d: Unknown result type (might be due to invalid IL or missing references)
//IL_0347: Expected O, but got Unknown
//IL_0347: Expected O, but got Unknown
//IL_0376: Unknown result type (might be due to invalid IL or missing references)
//IL_0394: Unknown result type (might be due to invalid IL or missing references)
//IL_0399: Unknown result type (might be due to invalid IL or missing references)
//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
//IL_03b3: Expected O, but got Unknown
//IL_03b3: Unknown result type (might be due to invalid IL or missing references)
//IL_03bd: Expected O, but got Unknown
//IL_03bd: Expected O, but got Unknown
//IL_03ec: Unknown result type (might be due to invalid IL or missing references)
//IL_0412: 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_041f: Unknown result type (might be due to invalid IL or missing references)
//IL_0431: Expected O, but got Unknown
//IL_0431: Unknown result type (might be due to invalid IL or missing references)
//IL_043b: Expected O, but got Unknown
//IL_043b: Expected O, but got Unknown
//IL_047e: Unknown result type (might be due to invalid IL or missing references)
//IL_04ca: Unknown result type (might be due to invalid IL or missing references)
//IL_04cf: Unknown result type (might be due to invalid IL or missing references)
//IL_04d7: Unknown result type (might be due to invalid IL or missing references)
//IL_04e9: Expected O, but got Unknown
//IL_04e9: Unknown result type (might be due to invalid IL or missing references)
//IL_04f3: Expected O, but got Unknown
//IL_04f3: Expected O, but got Unknown
//IL_0522: Unknown result type (might be due to invalid IL or missing references)
//IL_0540: Unknown result type (might be due to invalid IL or missing references)
//IL_0545: Unknown result type (might be due to invalid IL or missing references)
//IL_054d: Unknown result type (might be due to invalid IL or missing references)
//IL_055f: Expected O, but got Unknown
//IL_055f: Unknown result type (might be due to invalid IL or missing references)
//IL_0569: Expected O, but got Unknown
//IL_0569: Expected O, but got Unknown
ConfigFile config = ((BaseUnityPlugin)SplashMeads.Instance).Config;
enable = config.Bind<bool>(new ConfigDefinition(options.sectionName, "Enable"), options.enable, new ConfigDescription("Wether the recipe for this item is enabled", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
{
IsAdminOnly = true,
Order = HandleOrder()
} }));
enable.SettingChanged += delegate
{
RecipeHelper.UpdateRecipe(new UpdateRecipeOptions
{
name = options.recipeName,
updateType = RecipeUpdateType.ENABLE,
enable = enable.Value
});
};
name = config.Bind<string>(new ConfigDefinition(options.sectionName, "Name"), options.name, new ConfigDescription("The name of the item", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
{
IsAdminOnly = true,
Order = HandleOrder()
} }));
name.SettingChanged += delegate
{
UpdateHelper.UpdateItemData(options.prefab, new UpdateItemDataOptions
{
name = name.Value
});
};
description = config.Bind<string>(new ConfigDefinition(options.sectionName, "Description"), options.description, new ConfigDescription("The description of the item", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
{
IsAdminOnly = true,
Order = HandleOrder()
} }));
description.SettingChanged += delegate
{
UpdateHelper.UpdateItemData(options.prefab, new UpdateItemDataOptions
{
description = description.Value
});
};
craftingStation = config.Bind<string>(new ConfigDefinition(options.sectionName, "Crafting station"), options.craftingStation, new ConfigDescription("The crafting station the item can be crafted in", (AcceptableValueBase)(object)new AcceptableValueList<string>(craftingStationOptions), new object[1] { (object)new ConfigurationManagerAttributes
{
IsAdminOnly = true,
Order = HandleOrder()
} }));
craftingStation.SettingChanged += delegate
{
RecipeHelper.UpdateRecipe(new UpdateRecipeOptions
{
name = options.recipeName,
updateType = RecipeUpdateType.CRAFTINGSTATION,
craftingStation = craftingStation.Value
});
};
minStationLevel = config.Bind<int>(new ConfigDefinition(options.sectionName, "Required station level"), options.minStationLevel, new ConfigDescription("The required station level to craft this item", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
{
IsAdminOnly = true,
Order = HandleOrder()
} }));
minStationLevel.SettingChanged += delegate
{
RecipeHelper.UpdateRecipe(new UpdateRecipeOptions
{
name = options.recipeName,
updateType = RecipeUpdateType.MINREQUIREDSTATIONLEVEL,
requiredStationLevel = minStationLevel.Value
});
};
recipe = config.Bind<string>(new ConfigDefinition(options.sectionName, "Recipe"), options.recipe, new ConfigDescription("The items required to craft this item", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
{
IsAdminOnly = true,
Order = HandleOrder()
} }));
recipe.SettingChanged += delegate
{
RecipeHelper.UpdateRecipe(new UpdateRecipeOptions
{
name = options.recipeName,
updateType = RecipeUpdateType.RECIPE,
requirements = recipe.Value
});
};
recipeAmount = config.Bind<int>(new ConfigDefinition(options.sectionName, "Amount crafted"), options.recipeAmount, new ConfigDescription("The amount of this item you'll get when crafting it", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
{
IsAdminOnly = true,
Order = HandleOrder()
} }));
recipeAmount.SettingChanged += delegate
{
RecipeHelper.UpdateRecipe(new UpdateRecipeOptions
{
name = options.recipeName,
updateType = RecipeUpdateType.AMOUNT,
amount = recipeAmount.Value
});
};
weight = config.Bind<float>(new ConfigDefinition(options.sectionName, "Weight"), options.weight, new ConfigDescription("The weight applied to the item", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
{
IsAdminOnly = true,
Order = HandleOrder()
} }));
weight.SettingChanged += delegate
{
UpdateHelper.UpdateItemData(options.prefab, new UpdateItemDataOptions
{
weight = weight.Value
});
};
maxStackSize = config.Bind<int>(new ConfigDefinition(options.sectionName, "Max stack size"), options.maxStackSize, new ConfigDescription("The amount the item will stack", (AcceptableValueBase)(object)new AcceptableValueRange<int>(10, 50), new object[1] { (object)new ConfigurationManagerAttributes
{
IsAdminOnly = true,
Order = HandleOrder()
} }));
maxStackSize.SettingChanged += delegate
{
UpdateHelper.UpdateItemData(options.prefab, new UpdateItemDataOptions
{
maxStackSize = maxStackSize.Value
});
};
duration = config.Bind<int>(new ConfigDefinition(options.sectionName, options.isCooldown ? "Cooldown" : "Duration"), options.duration, new ConfigDescription("The " + (options.isCooldown ? "cooldown" : "duration") + " applied to the status effect (seconds)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(60, 600), new object[1] { (object)new ConfigurationManagerAttributes
{
IsAdminOnly = true,
Order = HandleOrder()
} }));
duration.SettingChanged += delegate
{
UpdateHelper.UpdateDuration(options.prefab, duration.Value);
};
radius = config.Bind<float>(new ConfigDefinition(options.sectionName, "Radius"), options.radius, new ConfigDescription("The radius of the splash and applying status effect (between 2 - 10)", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
{
IsAdminOnly = true,
Order = HandleOrder()
} }));
radius.SettingChanged += delegate
{
UpdateHelper.UpdateRadius(options.prefab, radius.Value);
};
}
private int HandleOrder()
{
entryCount--;
return (entryCount >= 0) ? entryCount : 0;
}
}
}
namespace DeathWizshAPI
{
internal class DeathWizshAPI
{
public const string version = "1.0.0";
}
}
namespace DeathWizshAPI.ModularMagic
{
internal class ModularMagic
{
public static SkillType AddSkill(string skillType, Sprite sprite)
{
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Expected O, but got Unknown
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
if (skillType == null)
{
throw new Exception("No skillType provided");
}
if ((Object)(object)sprite == (Object)null)
{
throw new Exception("No sprite provided");
}
SkillData skillData = GetSkillData(skillType);
if (skillData == null)
{
throw new Exception("Skill data is null");
}
SkillConfig val = new SkillConfig();
val.Identifier = skillType;
val.Name = skillData.name + " magic";
val.Description = "Allows increasingly advanced " + skillData.name + " magic imbuements";
val.IncreaseStep = 1f;
val.Icon = sprite;
return SkillManager.Instance.AddSkill(val);
}
private static SkillData GetSkillData(string skillType)
{
if (skillType == null)
{
throw new Exception("No skillType provided");
}
return skillType switch
{
"Earth" => new SkillData("MMES", "Earth"),
"Fire" => new SkillData("MMFS", "Fire"),
"Ice" => new SkillData("MMIS", "Ice"),
"Lightning" => new SkillData("MMLS", "Lightning"),
_ => null,
};
}
}
}
namespace DeathWizshAPI.ModularMagic.Types
{
internal class SkillType
{
public static string Earth => "Skill_MMES";
public static string Fire => "Skill_MMFS";
public static string Ice => "Skill_MMIS";
public static string Lightning => "Skill_MMLS";
}
}
namespace DeathWizshAPI.ModularMagic.Models
{
internal class SkillData
{
public string acronym;
public string name;
public SkillData(string acronym, string name)
{
this.acronym = acronym;
this.name = name;
}
}
}
namespace DeathWizshAPI.Helpers
{
internal class RecipeHelper
{
private static readonly Regex nukeWhiteSpaceRegex = new Regex("\\s+");
private static readonly Regex recipeEntryRegex = new Regex("^([a-zA-Z0-9_]+:[0-9]+)$");
public static void UpdateRecipe(UpdateRecipeOptions options)
{
try
{
CustomRecipe recipe = ItemManager.Instance.GetRecipe(options.name);
if (recipe != null)
{
UpdateRecipe(recipe.Recipe, options);
return;
}
if ((Object)(object)options.prefab == (Object)null)
{
throw new Exception("Could not find recipe of: " + options.name + ", prefab is null");
}
Recipe recipeFromObjectDB = GetRecipeFromObjectDB(options.prefab);
if ((Object)(object)recipeFromObjectDB != (Object)null)
{
UpdateRecipe(recipeFromObjectDB, options);
}
}
catch (Exception ex)
{
Logger.LogError((object)("Could not update recipe: " + ex));
}
}
private static void UpdateRecipe(Recipe recipe, UpdateRecipeOptions options)
{
switch (options.updateType)
{
case RecipeUpdateType.ALL:
{
if (options.requirements == null)
{
throw new Exception("Requirements is null");
}
Requirement[] asPieceRequirementArray2 = GetAsPieceRequirementArray(options.requirements, options.upgradeRequirements, options.upgradeMultiplier);
if (asPieceRequirementArray2 == null)
{
Logger.LogWarning((object)"Cannot update recipe, requirements is null");
break;
}
recipe.m_resources = asPieceRequirementArray2;
if (options.craftingStation == null || options.craftingStation == "")
{
throw new Exception("Craftingstation is null or empty string");
}
if (options.craftingStation == "None")
{
recipe.m_craftingStation = null;
recipe.m_enabled = true;
}
else if (options.craftingStation == "Disabled")
{
recipe.m_craftingStation = null;
recipe.m_enabled = false;
}
else
{
string internalName2 = CraftingStations.GetInternalName(options.craftingStation);
recipe.m_enabled = true;
recipe.m_craftingStation = PrefabManager.Instance.GetPrefab(internalName2).GetComponent<CraftingStation>();
}
if (!options.requiredStationLevel.HasValue || options.requiredStationLevel < 1)
{
throw new Exception("Required station level is null or lower then 1");
}
recipe.m_minStationLevel = options.requiredStationLevel.Value;
if (options.amount.HasValue)
{
recipe.m_amount = options.amount.Value;
}
if (!options.enable.HasValue)
{
throw new Exception("Enable is null");
}
recipe.m_enabled = options.enable.Value;
break;
}
case RecipeUpdateType.ENABLE:
if (!options.enable.HasValue)
{
throw new Exception("Enable is null");
}
recipe.m_enabled = options.enable.Value;
break;
case RecipeUpdateType.AMOUNT:
if (!options.amount.HasValue)
{
throw new Exception("Amount is null");
}
recipe.m_amount = options.amount.Value;
break;
case RecipeUpdateType.RECIPE:
{
if (options.requirements == null)
{
throw new Exception("Requirements is null");
}
Requirement[] asPieceRequirementArray = GetAsPieceRequirementArray(options.requirements, options.upgradeRequirements, options.upgradeMultiplier);
if (asPieceRequirementArray == null)
{
Logger.LogWarning((object)"Cannot update recipe, requirements is null");
}
else
{
recipe.m_resources = asPieceRequirementArray;
}
break;
}
case RecipeUpdateType.CRAFTINGSTATION:
if (options.craftingStation == null || options.craftingStation == "")
{
throw new Exception("Craftingstation is null or empty string");
}
if (options.craftingStation == "None")
{
recipe.m_craftingStation = null;
recipe.m_enabled = true;
}
else if (options.craftingStation == "Disabled")
{
recipe.m_craftingStation = null;
recipe.m_enabled = false;
}
else
{
string internalName = CraftingStations.GetInternalName(options.craftingStation);
recipe.m_enabled = true;
recipe.m_craftingStation = PrefabManager.Instance.GetPrefab(internalName).GetComponent<CraftingStation>();
}
break;
case RecipeUpdateType.MINREQUIREDSTATIONLEVEL:
if (!options.requiredStationLevel.HasValue || options.requiredStationLevel < 1)
{
throw new Exception("Required station level is null or lower then 1");
}
recipe.m_minStationLevel = options.requiredStationLevel.Value;
break;
case RecipeUpdateType.FROM_RECIPE:
if (options.fromRecipe == null)
{
throw new Exception("Field fromRecipe is null");
}
recipe.m_enabled = options.fromRecipe.enabled;
recipe.m_craftingStation = options.fromRecipe.craftingStation;
recipe.m_resources = options.fromRecipe.resources;
recipe.m_minStationLevel = options.fromRecipe.minStationLevel;
break;
case RecipeUpdateType.MINREQUIREDREPAIRLEVEL:
break;
}
}
public static RequirementConfig[]? GetAsRequirementConfigArray(string recipe, string? upgradeRecipe, int? multiplier)
{
return GetAsRequirementConfigList(recipe, upgradeRecipe, multiplier)?.ToArray();
}
public static Requirement[]? GetAsPieceRequirementArray(string recipe, string? upgradeRecipe, int? multiplier)
{
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Expected O, but got Unknown
List<RequirementConfig> asRequirementConfigList = GetAsRequirementConfigList(recipe, upgradeRecipe, multiplier);
List<Requirement> list = new List<Requirement>();
if (asRequirementConfigList == null)
{
return null;
}
foreach (RequirementConfig item in asRequirementConfigList)
{
GameObject prefab = PrefabManager.Instance.GetPrefab(item.Item);
if ((Object)(object)prefab == (Object)null)
{
throw new Exception("Could not find item, please check config!");
}
Requirement val = new Requirement();
val.m_resItem = prefab.GetComponent<ItemDrop>();
val.m_amount = item.Amount;
val.m_recover = item.Recover;
if (upgradeRecipe != null && multiplier.HasValue)
{
val.m_amountPerLevel = item.AmountPerLevel;
}
list.Add(val);
}
return list.ToArray();
}
public static List<RequirementConfig>? GetAsRequirementConfigList(string recipe, string? upgradeRecipe, int? multiplier)
{
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Expected O, but got Unknown
recipe = nukeWhiteSpaceRegex.Replace(recipe, "");
if (upgradeRecipe != null)
{
upgradeRecipe = nukeWhiteSpaceRegex.Replace(upgradeRecipe, "");
}
if (!IsConfigRecipeValid(recipe, upgradeRecipe))
{
Logger.LogWarning((object)"Config is not valid, please check the values");
return null;
}
List<RequirementConfig> list = new List<RequirementConfig>();
string[] array = recipe.Trim().Split(new char[1] { ',' });
string[] array2 = array;
foreach (string text in array2)
{
RequirementConfig val = new RequirementConfig();
string[] array3 = text.Split(new char[1] { ':' });
val.Item = array3[0];
val.Amount = int.Parse(array3[1]);
val.Recover = true;
if (upgradeRecipe != null && !Utility.IsNullOrWhiteSpace(upgradeRecipe) && multiplier.HasValue)
{
string[] array4 = upgradeRecipe.Trim().Split(new char[1] { ',' });
string[] array5 = array4;
foreach (string text2 in array5)
{
string[] array6 = text2.Split(new char[1] { ':' });
if (val.Item == array6[0])
{
val.AmountPerLevel = int.Parse(array6[1]) * multiplier.Value;
break;
}
}
}
list.Add(val);
}
return list;
}
public static bool IsConfigRecipeValid(string configRecipe, string? upgradeRecipe)
{
try
{
bool result = true;
string[] array = configRecipe.Split(new char[1] { ',' });
string[] array2 = array;
foreach (string text in array2)
{
if (!recipeEntryRegex.IsMatch(text))
{
result = false;
Logger.LogWarning((object)("Cannot resolve " + text + " from the crafting recipe"));
}
}
if (upgradeRecipe == null || Utility.IsNullOrWhiteSpace(upgradeRecipe))
{
return result;
}
string[] array3 = upgradeRecipe.Split(new char[1] { ',' });
string[] array4 = array3;
foreach (string text2 in array4)
{
if (!recipeEntryRegex.IsMatch(text2))
{
result = false;
Logger.LogWarning((object)("Cannot resolve " + text2 + " from the upgrade recipe"));
}
}
return result;
}
catch (Exception ex)
{
Logger.LogError((object)("Could not validate recipe due to an error: " + ex));
return false;
}
}
public static Recipe? GetRecipeFromObjectDB(GameObject prefab)
{
if ((Object)(object)prefab == (Object)null)
{
throw new Exception("Could not find recipe in ObjectDB, prefab is null");
}
ItemDrop component = prefab.GetComponent<ItemDrop>();
if ((Object)(object)component == (Object)null)
{
throw new Exception("Could not find recipe in ObjectDB, no item drop for " + ((Object)prefab).name + " was found");
}
Recipe recipe = ObjectDB.instance.GetRecipe(component.m_itemData);
if ((Object)(object)recipe == (Object)null)
{
throw new Exception("Could not find recipe in ObjectDB, no recipe for " + ((Object)prefab).name + " was foun