Decompiled source of Herbalist v1.3.9
Herbalist.dll
Decompiled 3 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.IO; using System.IO.Compression; using System.Linq; using System.Linq.Expressions; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using HarmonyLib; using Herbalist.Functions; using Herbalist.Patches; using Herbalist.SE; using Herbalist.Utils; using JetBrains.Annotations; using LocalizationManager; using Microsoft.CodeAnalysis; using ServerSync; using TMPro; using UnityEngine; using UnityEngine.SceneManagement; using YamlDotNet.Core; using YamlDotNet.Core.Events; using YamlDotNet.Core.Tokens; using YamlDotNet.Helpers; using YamlDotNet.Serialization; using YamlDotNet.Serialization.Converters; using YamlDotNet.Serialization.EventEmitters; using YamlDotNet.Serialization.NamingConventions; using YamlDotNet.Serialization.NodeDeserializers; using YamlDotNet.Serialization.NodeTypeResolvers; using YamlDotNet.Serialization.ObjectFactories; using YamlDotNet.Serialization.ObjectGraphTraversalStrategies; using YamlDotNet.Serialization.ObjectGraphVisitors; using YamlDotNet.Serialization.Schemas; using YamlDotNet.Serialization.TypeInspectors; using YamlDotNet.Serialization.TypeResolvers; using YamlDotNet.Serialization.Utilities; using YamlDotNet.Serialization.ValueDeserializers; [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("Herbalist")] [assembly: AssemblyDescription("https://valheim.thunderstore.io/package/blacks7ar/Herbalist/")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("blacks7ar")] [assembly: AssemblyProduct("Herbalist")] [assembly: AssemblyTrademark("")] [assembly: CompilationRelaxations(8)] [assembly: ComVisible(false)] [assembly: AssemblyFileVersion("1.3.9")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: Guid("9BE88F47-A4AB-4529-BB81-ABB9BA43BC1B")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.3.9.0")] [module: UnverifiableCode] [module: <23593810-74f8-46a5-80bf-b3db6d77a27f>RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [<29a176fd-f0a7-4a8d-8e22-396342e00336>Embedded] [CompilerGenerated] internal sealed class <29a176fd-f0a7-4a8d-8e22-396342e00336>EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [<29a176fd-f0a7-4a8d-8e22-396342e00336>Embedded] [CompilerGenerated] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class <615600cf-e8b8-42d9-863c-39634c47a7e9>NullableAttribute : Attribute { public readonly byte[] NullableFlags; public <615600cf-e8b8-42d9-863c-39634c47a7e9>NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public <615600cf-e8b8-42d9-863c-39634c47a7e9>NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [<29a176fd-f0a7-4a8d-8e22-396342e00336>Embedded] [CompilerGenerated] internal sealed class <81b753b3-ce60-4aa5-bbab-8b7f0e11f337>NullableContextAttribute : Attribute { public readonly byte Flag; public <81b753b3-ce60-4aa5-bbab-8b7f0e11f337>NullableContextAttribute(byte P_0) { Flag = P_0; } } [<29a176fd-f0a7-4a8d-8e22-396342e00336>Embedded] [CompilerGenerated] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class <23593810-74f8-46a5-80bf-b3db6d77a27f>RefSafetyRulesAttribute : Attribute { public readonly int Version; public <23593810-74f8-46a5-80bf-b3db6d77a27f>RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Herbalist { [BepInPlugin("blacks7ar.Herbalist", "Herbalist", "1.3.9")] public class Plugin : BaseUnityPlugin { private const string modGUID = "blacks7ar.Herbalist"; public const string modName = "Herbalist"; public const string modAuthor = "blacks7ar"; public const string modVersion = "1.3.9"; public const string modLink = "https://valheim.thunderstore.io/package/blacks7ar/Herbalist/"; private static readonly Harmony _harmony = new Harmony("blacks7ar.Herbalist"); private static readonly ConfigSync _configSync = new ConfigSync("blacks7ar.Herbalist") { DisplayName = "Herbalist", CurrentVersion = "1.3.9", MinimumRequiredVersion = "1.3.9", ModRequired = true }; private static ConfigEntry<Toggle> _serverConfigLocked; private static ConfigEntry<float> _expGainFactor; public static ConfigEntry<Toggle> _displayExpGained; public static ConfigEntry<float> _dandelionHealthOverTime; public static ConfigEntry<float> _dandelionDuration; public static ConfigEntry<float> _dandelionInterval; public static ConfigEntry<float> _thistleHealthOverTime; public static ConfigEntry<float> _thistleDuration; public static ConfigEntry<float> _thistleInterval; public static ConfigEntry<float> _healBonusFactor; public static ConfigEntry<float> _durationBonusFactor; public static ConfigEntry<int> _minorLevel; public static ConfigEntry<int> _mediumLevel; public static ConfigEntry<int> _largeLevel; public static ConfigEntry<float> _expCooldownTimer; private static ConfigEntry<int> _expLoss; public static ConfigEntry<Toggle> _returnBottles; public static ConfigEntry<string> _potionsList; public static ConfigEntry<float> _craftingExp; public static Plugin _Instance; private static Skill _herbalist; public static readonly HashSet<string> _ToReduceCooldown = new HashSet<string> { "MeadEitrMinor", "MeadHealthMajor", "MeadHealthMedium", "MeadHealthMinor", "MeadStaminaMedium", "MeadStaminaMinor", "Flask_of_the_Gods", "Grand_Healing_Tide_Potion", "Grand_Spiritual_Healing_Potion", "Grand_Stamina_Elixir", "Medium_Healing_Tide_Flask", "Medium_Spiritual_Healing_Flask", "Medium_Stamina_Flask", "Lesser_Healing_Tide_Vial", "Lesser_Spiritual_Healing_Vial", "Lesser_Stamina_Vial", "Lesser_Group_Healing", "Medium_Group_Healing", "Grand_Group_Healing", "Lesser_Mana_Potion", "Large_Mana_Potion", "Grand_Mana_Potion" }; public static readonly HashSet<string> _ToIncreaseDuration = new HashSet<string> { "BarleyWine", "MeadFrostResist", "MeadPoisonResist", "MeadStaminaLingering", "MeadTasty", "Flask_of_Elements", "Flask_of_Fortification", "Flask_of_Magelight", "Flask_of_Second_Wind", "Grand_Healing_Tide_Potion", "Grand_Stamina_Elixir", "Grand_Stealth_Elixir", "Medium_Healing_Tide_Flask", "Lesser_Healing_Tide_Vial", "Brew_of_Cunning_Toxicity", "Brew_of_Fiery_Revenge", "Brew_of_Icy_Touch", "Brew_of_Spiritual_Death", "Brew_of_Thunderous_Words" }; private static readonly HashSet<string> _herbalistPotions = new HashSet<string> { "BH_BeserkerElixer", "BH_DefenderElixer", "BH_GhostElixer", "BH_HeavyLifterElixer", "BH_JumpElixer", "BH_LargeEitrTonic", "BH_LargeHealthTonic", "BH_LargeStaminaTonic", "BH_LearningElixer", "BH_MediumEitrTonic", "BH_MediumHealthTonic", "BH_MediumStaminaTonic", "BH_MinorEitrTonic", "BH_MinorHealthTonic", "BH_MinorStaminaTonic", "BH_RunnerElixer", "BH_SlowFallElixer" }; public static HashSet<string> _potionsToGainExpList; public ConfigEntry<T> config<T>(string group, string name, T value, ConfigDescription description, bool _synchronizedConfig = true) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown ConfigDescription val = new ConfigDescription(description.Description + (_synchronizedConfig ? " [Synced with Server]" : " [Not Synced with Server]"), description.AcceptableValues, description.Tags); ConfigEntry<T> val2 = ((BaseUnityPlugin)this).Config.Bind<T>(group, name, value, val); _configSync.AddConfigEntry<T>(val2).SynchronizedConfig = _synchronizedConfig; return val2; } private ConfigEntry<T> config2<T>(string group, string name, T value, string desc, bool synchronizedConfig = true) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown Herbalist.Functions.ConfigurationManagerAttributes configurationManagerAttributes = new Herbalist.Functions.ConfigurationManagerAttributes { CustomDrawer = TextBox }; return config(group, name, value, new ConfigDescription(desc, (AcceptableValueBase)null, new object[1] { configurationManagerAttributes }), synchronizedConfig); } public void Awake() { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Expected O, but got Unknown //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Expected O, but got Unknown //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Expected O, but got Unknown //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Expected O, but got Unknown //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Expected O, but got Unknown //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Expected O, but got Unknown //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Expected O, but got Unknown //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Expected O, but got Unknown //IL_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Expected O, but got Unknown //IL_032c: Unknown result type (might be due to invalid IL or missing references) //IL_0337: Expected O, but got Unknown //IL_0370: Unknown result type (might be due to invalid IL or missing references) //IL_037b: Expected O, but got Unknown //IL_03b4: Unknown result type (might be due to invalid IL or missing references) //IL_03bf: Expected O, but got Unknown //IL_03ed: Unknown result type (might be due to invalid IL or missing references) //IL_03f8: Expected O, but got Unknown //IL_0451: Unknown result type (might be due to invalid IL or missing references) //IL_045c: Expected O, but got Unknown //IL_048a: Unknown result type (might be due to invalid IL or missing references) //IL_0495: Expected O, but got Unknown //IL_04b8: Unknown result type (might be due to invalid IL or missing references) //IL_04c3: Expected O, but got Unknown //IL_052e: Unknown result type (might be due to invalid IL or missing references) //IL_0539: Expected O, but got Unknown _Instance = this; Localizer.Load(); ((BaseUnityPlugin)this).Config.SaveOnConfigSet = false; _herbalist = new Skill("Herbalist", "herbalist.png"); _herbalist.Description.English("Makes pickable plants like Dandelion and Thistle into healing medicines."); _herbalist.Configurable = false; _serverConfigLocked = config("1- ServerSync", "Lock Configuration", Toggle.On, new ConfigDescription("If On, the configuration is locked and can be changed by server admins only.", (AcceptableValueBase)null, Array.Empty<object>())); _configSync.AddLockingConfigEntry<Toggle>(_serverConfigLocked); _healBonusFactor = config("2- General", "Heal Bonus Factor", 10f, new ConfigDescription("Heal bonus factor at skill level 100 for dandelion and thistle.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 10f), Array.Empty<object>())); _durationBonusFactor = config("2- General", "Duration Bonus Factor", 10f, new ConfigDescription("Heal duration bonus factor at skill level 100 for dandelion and thistle.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 15f), Array.Empty<object>())); _dandelionHealthOverTime = config("3- Dandelion", "Heal Amount", 5f, new ConfigDescription("Dandelion base heal amount.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 10f), new object[1] { new Herbalist.Functions.ConfigurationManagerAttributes { ShowRangeAsPercent = false } })); _returnBottles = config("2- General", "Return Bottles", Toggle.On, new ConfigDescription("If On, bottles and containers will return to your inventory after you consume tonics or elixirs.", (AcceptableValueBase)null, Array.Empty<object>())); _potionsList = config2("2- General", "Additional Potions To Gain Exp", "", "Additional potions you added to the mortar and pestle that you want to gain an exp."); _potionsList.SettingChanged += delegate { GeneratePotionsList(); }; _dandelionDuration = config("3- Dandelion", "Heal Duration", 10f, new ConfigDescription("Dandelion base heal duration in seconds.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 30f), Array.Empty<object>())); _dandelionInterval = config("3- Dandelion", "Heal Interval", 0.5f, new ConfigDescription("Dandelion heal interval.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 1f), new object[1] { new Herbalist.Functions.ConfigurationManagerAttributes { ShowRangeAsPercent = false } })); _thistleHealthOverTime = config("4- Thistle", "Heal Amount", 15f, new ConfigDescription("Thistle base heal amount.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 20f), Array.Empty<object>())); _thistleDuration = config("4- Thistle", "Heal Duration", 10f, new ConfigDescription("Thistle base heal duration in seconds.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 30f), Array.Empty<object>())); _thistleInterval = config("4- Thistle", "Heal Interval", 0.5f, new ConfigDescription("Thistle heal interval.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 1f), new object[1] { new Herbalist.Functions.ConfigurationManagerAttributes { ShowRangeAsPercent = false } })); _minorLevel = config("4- Tonics Requirement Level", "Minor Tonics Level", 1, new ConfigDescription("Required skill level to craft minor tonics.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 100), new object[1] { new Herbalist.Functions.ConfigurationManagerAttributes { ShowRangeAsPercent = false } })); _mediumLevel = config("4- Tonics Requirement Level", "Medium Tonics Level", 30, new ConfigDescription("Required skill level to craft medium tonics.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 100), new object[1] { new Herbalist.Functions.ConfigurationManagerAttributes { ShowRangeAsPercent = false } })); _largeLevel = config("4- Tonics Requirement Level", "Large Tonics Level", 60, new ConfigDescription("Required skill level to craft large tonics.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 100), new object[1] { new Herbalist.Functions.ConfigurationManagerAttributes { ShowRangeAsPercent = false } })); _expGainFactor = config("5- Skill Exp", "Exp Gain Factor", 1f, new ConfigDescription("Exp gain factor for herbalist skill.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 5f), Array.Empty<object>())); _expGainFactor.SettingChanged += delegate { _herbalist.SkillGainFactor = _expGainFactor.Value; }; _herbalist.SkillGainFactor = _expGainFactor.Value; _displayExpGained = config("5- Skill Exp", "Display Exp Gained", Toggle.On, new ConfigDescription("Enable/Disables exp gain notification.", (AcceptableValueBase)null, Array.Empty<object>())); _expCooldownTimer = config("5- Skill Exp", "Exp Gain Cooldown", 30f, new ConfigDescription("Cooldown timer in seconds, before getting exp when picking up dandelion and thistle.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 120f), Array.Empty<object>())); _expLoss = config("5- Skill Exp", "Exp Loss Amount", 0, new ConfigDescription("Skill exp loss on death.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>())); _expLoss.SettingChanged += delegate { _herbalist.SkillLoss = _expLoss.Value; }; _herbalist.SkillLoss = _expLoss.Value; _craftingExp = config("5- Skill Exp", "Potion Crafting Exp Gain Factor", 1f, new ConfigDescription("Exp gain factor from crafting potions in mortar and pestle.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 5f), Array.Empty<object>())); ConfigSetup.Init(); PrefabSetup.Init(); ((BaseUnityPlugin)this).Config.SaveOnConfigSet = true; ((BaseUnityPlugin)this).Config.Save(); GeneratePotionsList(); Assembly executingAssembly = Assembly.GetExecutingAssembly(); _harmony.PatchAll(executingAssembly); } private void OnDestroy() { ((BaseUnityPlugin)this).Config.Save(); } private static void GeneratePotionsList() { HashSet<string> other = new HashSet<string>(_potionsList.Value.Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries)); _herbalistPotions.UnionWith(other); _potionsToGainExpList = _herbalistPotions; } private static void TextBox(ConfigEntryBase entryBase) { entryBase.BoxedValue = GUILayout.TextArea((string)entryBase.BoxedValue, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true) }); } } [PublicAPI] public class Skill { public static class LocalizationCache { private static readonly Dictionary<string, Localization> localizations = new Dictionary<string, Localization>(); internal static void LocalizationPostfix(Localization __instance, string language) { string key = localizations.FirstOrDefault((KeyValuePair<string, Localization> l) => l.Value == __instance).Key; if (key != null) { localizations.Remove(key); } if (!localizations.ContainsKey(language)) { localizations.Add(language, __instance); } } public static Localization ForLanguage([<615600cf-e8b8-42d9-863c-39634c47a7e9>Nullable(2)] string language = null) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown if (localizations.TryGetValue(language ?? PlayerPrefs.GetString("language", "English"), out var value)) { return value; } value = new Localization(); if (language != null) { value.SetupLanguage(language); } return value; } } [PublicAPI] public class LocalizeKey { private static readonly List<LocalizeKey> keys = new List<LocalizeKey>(); public readonly string Key; public readonly Dictionary<string, string> Localizations = new Dictionary<string, string>(); public LocalizeKey(string key) { Key = key.Replace("$", ""); } public void Alias(string alias) { Localizations.Clear(); if (!alias.Contains("$")) { alias = "$" + alias; } Localizations["alias"] = alias; Localization.instance.AddWord(Key, Localization.instance.Localize(alias)); } public LocalizeKey English(string key) { return addForLang("English", key); } public LocalizeKey Swedish(string key) { return addForLang("Swedish", key); } public LocalizeKey French(string key) { return addForLang("French", key); } public LocalizeKey Italian(string key) { return addForLang("Italian", key); } public LocalizeKey German(string key) { return addForLang("German", key); } public LocalizeKey Spanish(string key) { return addForLang("Spanish", key); } public LocalizeKey Russian(string key) { return addForLang("Russian", key); } public LocalizeKey Romanian(string key) { return addForLang("Romanian", key); } public LocalizeKey Bulgarian(string key) { return addForLang("Bulgarian", key); } public LocalizeKey Macedonian(string key) { return addForLang("Macedonian", key); } public LocalizeKey Finnish(string key) { return addForLang("Finnish", key); } public LocalizeKey Danish(string key) { return addForLang("Danish", key); } public LocalizeKey Norwegian(string key) { return addForLang("Norwegian", key); } public LocalizeKey Icelandic(string key) { return addForLang("Icelandic", key); } public LocalizeKey Turkish(string key) { return addForLang("Turkish", key); } public LocalizeKey Lithuanian(string key) { return addForLang("Lithuanian", key); } public LocalizeKey Czech(string key) { return addForLang("Czech", key); } public LocalizeKey Hungarian(string key) { return addForLang("Hungarian", key); } public LocalizeKey Slovak(string key) { return addForLang("Slovak", key); } public LocalizeKey Polish(string key) { return addForLang("Polish", key); } public LocalizeKey Dutch(string key) { return addForLang("Dutch", key); } public LocalizeKey Portuguese_European(string key) { return addForLang("Portuguese_European", key); } public LocalizeKey Portuguese_Brazilian(string key) { return addForLang("Portuguese_Brazilian", key); } public LocalizeKey Chinese(string key) { return addForLang("Chinese", key); } public LocalizeKey Japanese(string key) { return addForLang("Japanese", key); } public LocalizeKey Korean(string key) { return addForLang("Korean", key); } public LocalizeKey Hindi(string key) { return addForLang("Hindi", key); } public LocalizeKey Thai(string key) { return addForLang("Thai", key); } public LocalizeKey Abenaki(string key) { return addForLang("Abenaki", key); } public LocalizeKey Croatian(string key) { return addForLang("Croatian", key); } public LocalizeKey Georgian(string key) { return addForLang("Georgian", key); } public LocalizeKey Greek(string key) { return addForLang("Greek", key); } public LocalizeKey Serbian(string key) { return addForLang("Serbian", key); } public LocalizeKey Ukrainian(string key) { return addForLang("Ukrainian", key); } private LocalizeKey addForLang(string lang, string value) { Localizations[lang] = value; if (Localization.instance.GetSelectedLanguage() == lang) { Localization.instance.AddWord(Key, value); } else if (lang == "English" && !Localization.instance.m_translations.ContainsKey(Key)) { Localization.instance.AddWord(Key, value); } return this; } [HarmonyPriority(300)] internal static void AddLocalizedKeys(Localization __instance, string language) { foreach (LocalizeKey key in keys) { string value2; if (key.Localizations.TryGetValue(language, out var value) || key.Localizations.TryGetValue("English", out value)) { __instance.AddWord(key.Key, value); } else if (key.Localizations.TryGetValue("alias", out value2)) { Localization.instance.AddWord(key.Key, Localization.instance.Localize(value2)); } } } } private class ConfigurationManagerAttributes { [<615600cf-e8b8-42d9-863c-39634c47a7e9>Nullable(2)] [UsedImplicitly] public string Category; } [HarmonyPatch(typeof(Skills), "IsSkillValid")] private static class Patch_Skills_IsSkillValid { private static void Postfix(SkillType type, ref bool __result) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) if (!__result && skills.ContainsKey(type)) { __result = true; } } } private static readonly Dictionary<SkillType, Skill> skills; internal static readonly Dictionary<string, Skill> skillByName; private readonly string skillName; private readonly string internalSkillName; private readonly SkillDef skillDef; public readonly LocalizeKey Name; public readonly LocalizeKey Description; private float skillEffectFactor = 1f; private int skillLoss = 5; public bool Configurable; private static bool InitializedTerminal; [<615600cf-e8b8-42d9-863c-39634c47a7e9>Nullable(2)] private static Localization _english; [<615600cf-e8b8-42d9-863c-39634c47a7e9>Nullable(2)] private static BaseUnityPlugin _plugin; private static bool hasConfigSync; [<615600cf-e8b8-42d9-863c-39634c47a7e9>Nullable(2)] private static object _configSync; public float SkillGainFactor { get { return skillDef.m_increseStep; } set { skillDef.m_increseStep = value; this.SkillGainFactorChanged?.Invoke(value); } } public float SkillEffectFactor { get { return skillEffectFactor; } set { skillEffectFactor = value; this.SkillEffectFactorChanged?.Invoke(value); } } public int SkillLoss { get { return skillLoss; } set { skillLoss = value; this.SkillLossChanged?.Invoke(value); } } private static Localization english => _english ?? (_english = LocalizationCache.ForLanguage("English")); private static BaseUnityPlugin plugin { get { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown object obj = _plugin; if (obj == null) { BaseUnityPlugin val = (BaseUnityPlugin)Chainloader.ManagerObject.GetComponent((Type)Assembly.GetExecutingAssembly().DefinedTypes.First((TypeInfo t) => t.IsClass && typeof(BaseUnityPlugin).IsAssignableFrom(t))); _plugin = val; obj = (object)val; } return (BaseUnityPlugin)obj; } } [<615600cf-e8b8-42d9-863c-39634c47a7e9>Nullable(2)] private static object configSync { [<81b753b3-ce60-4aa5-bbab-8b7f0e11f337>NullableContext(2)] get { if (_configSync == null && hasConfigSync) { Type type = Assembly.GetExecutingAssembly().GetType("ServerSync.ConfigSync"); if ((object)type != null) { _configSync = Activator.CreateInstance(type, plugin.Info.Metadata.GUID + " SkillManager"); type.GetField("CurrentVersion").SetValue(_configSync, plugin.Info.Metadata.Version.ToString()); type.GetProperty("IsLocked").SetValue(_configSync, true); } else { hasConfigSync = false; } } return _configSync; } } [<615600cf-e8b8-42d9-863c-39634c47a7e9>Nullable(2)] [method: <81b753b3-ce60-4aa5-bbab-8b7f0e11f337>NullableContext(2)] [field: <615600cf-e8b8-42d9-863c-39634c47a7e9>Nullable(2)] public event Action<float> SkillGainFactorChanged; [<615600cf-e8b8-42d9-863c-39634c47a7e9>Nullable(2)] [method: <81b753b3-ce60-4aa5-bbab-8b7f0e11f337>NullableContext(2)] [field: <615600cf-e8b8-42d9-863c-39634c47a7e9>Nullable(2)] public event Action<float> SkillEffectFactorChanged; [<615600cf-e8b8-42d9-863c-39634c47a7e9>Nullable(2)] [method: <81b753b3-ce60-4aa5-bbab-8b7f0e11f337>NullableContext(2)] [field: <615600cf-e8b8-42d9-863c-39634c47a7e9>Nullable(2)] public event Action<float> SkillLossChanged; public Skill(string englishName, string icon) : this(englishName, loadSprite(icon, 64, 64)) { } public Skill(string englishName, Sprite icon) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Expected O, but got Unknown SkillType val = fromName(englishName); string text = new Regex("[^a-zA-Z]").Replace(englishName, "_"); skills[val] = this; skillByName[englishName] = this; skillDef = new SkillDef { m_description = "$skilldesc_" + text, m_icon = icon, m_increseStep = 1f, m_skill = val }; internalSkillName = text; skillName = englishName; Name = new LocalizeKey("skill_" + ((object)(SkillType)(ref val)).ToString()).English(englishName); Description = new LocalizeKey("skilldesc_" + text); } public static SkillType fromName(string englishName) { return (SkillType)Math.Abs(StringExtensionMethods.GetStableHashCode(englishName)); } static Skill() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected O, but got Unknown //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Expected O, but got Unknown //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Expected O, but got Unknown //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Expected O, but got Unknown //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Expected O, but got Unknown //IL_01ab: Expected O, but got Unknown //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Expected O, but got Unknown //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Expected O, but got Unknown //IL_023c: Expected O, but got Unknown skills = new Dictionary<SkillType, Skill>(); skillByName = new Dictionary<string, Skill>(); InitializedTerminal = false; hasConfigSync = true; Harmony val = new Harmony("org.bepinex.helpers.skillmanager"); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(FejdStartup), "Awake", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(Skill), "Patch_FejdStartup", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(Skills), "GetSkillDef", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(Skill), "Patch_Skills_GetSkillDef", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(Skills), "CheatRaiseSkill", (Type[])null, (Type[])null), new HarmonyMethod(AccessTools.DeclaredMethod(typeof(Skill), "Patch_Skills_CheatRaiseskill", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(Skills), "CheatResetSkill", (Type[])null, (Type[])null), new HarmonyMethod(AccessTools.DeclaredMethod(typeof(Skill), "Patch_Skills_CheatResetSkill", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(Localization), "LoadCSV", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(LocalizeKey), "AddLocalizedKeys", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(Terminal), "InitTerminal", (Type[])null, (Type[])null), new HarmonyMethod(AccessTools.DeclaredMethod(typeof(Skill), "Patch_Terminal_InitTerminal_Prefix", (Type[])null, (Type[])null)), new HarmonyMethod(AccessTools.DeclaredMethod(typeof(Skill), "Patch_Terminal_InitTerminal", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(Localization), "SetupLanguage", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(LocalizationCache), "LocalizationPostfix", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(Skills), "OnDeath", (Type[])null, (Type[])null), new HarmonyMethod(AccessTools.DeclaredMethod(typeof(Skill), "Patch_Skills_OnDeath_Prefix", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(Skill), "Patch_Skills_OnDeath_Finalizer", (Type[])null, (Type[])null)), (HarmonyMethod)null); } private static void Patch_FejdStartup() { //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Expected O, but got Unknown //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Expected O, but got Unknown //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Expected O, but got Unknown foreach (Skill skill in skills.Values) { if (skill.Configurable) { string key = skill.Name.Key; string group = new Regex("['[\"\\]]").Replace(english.Localize(key), "").Trim(); string category = Localization.instance.Localize(key).Trim(); ConfigEntry<float> skillGain = config(group, "Skill gain factor", skill.SkillGainFactor, new ConfigDescription("The rate at which you gain experience for the skill.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.01f, 5f), new object[1] { new ConfigurationManagerAttributes { Category = category } })); skill.SkillGainFactor = skillGain.Value; skillGain.SettingChanged += delegate { skill.SkillGainFactor = skillGain.Value; }; ConfigEntry<float> skillEffect = config(group, "Skill effect factor", skill.SkillEffectFactor, new ConfigDescription("The power of the skill, based on the default power.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.01f, 5f), new object[1] { new ConfigurationManagerAttributes { Category = category } })); skill.SkillEffectFactor = skillEffect.Value; skillEffect.SettingChanged += delegate { skill.SkillEffectFactor = skillEffect.Value; }; ConfigEntry<int> skillLoss = config(group, "Skill loss", skill.skillLoss, new ConfigDescription("How much experience to lose on death.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), new object[1] { new ConfigurationManagerAttributes { Category = category } })); skill.skillLoss = skillLoss.Value; skillLoss.SettingChanged += delegate { skill.skillLoss = skillLoss.Value; }; } } } private static void Patch_Skills_GetSkillDef([<615600cf-e8b8-42d9-863c-39634c47a7e9>Nullable(2)] ref SkillDef __result, List<SkillDef> ___m_skills, SkillType type) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) if (__result == null) { SkillDef val = GetSkillDef(type); if (val != null) { ___m_skills.Add(val); __result = val; } } } private static bool Patch_Skills_CheatRaiseskill(Skills __instance, string name, float value, Player ___m_player) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) foreach (SkillType key in skills.Keys) { SkillType current = key; Skill skill = skills[current]; if (string.Equals(skill.internalSkillName, name, StringComparison.CurrentCultureIgnoreCase)) { Skill skill2 = __instance.GetSkill(current); skill2.m_level += value; skill2.m_level = Mathf.Clamp(skill2.m_level, 0f, 100f); ((Character)___m_player).Message((MessageType)1, "Skill increased " + Localization.instance.Localize("$skill_" + ((object)(SkillType)(ref current)).ToString()) + ": " + (int)skill2.m_level, 0, skill2.m_info.m_icon); Console.instance.Print("Skill " + skill.internalSkillName + " = " + skill2.m_level); return false; } } return true; } private static bool Patch_Skills_CheatResetSkill(Skills __instance, string name) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) foreach (SkillType key in skills.Keys) { Skill skill = skills[key]; if (string.Equals(skill.internalSkillName, name, StringComparison.CurrentCultureIgnoreCase)) { __instance.ResetSkill(key); Console.instance.Print("Skill " + skill.internalSkillName + " reset"); return false; } } return true; } private static void Patch_Skills_OnDeath_Prefix(Skills __instance, [<615600cf-e8b8-42d9-863c-39634c47a7e9>Nullable(new byte[] { 2, 0 })] ref Dictionary<SkillType, Skill> __state) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) if (__state == null) { __state = new Dictionary<SkillType, Skill>(); } foreach (KeyValuePair<SkillType, Skill> skill in skills) { if (__instance.m_skillData.TryGetValue(skill.Key, out var value)) { __state[skill.Key] = value; if (skill.Value.skillLoss > 0) { Skill obj = value; obj.m_level -= value.m_level * (float)skill.Value.SkillLoss / 100f; value.m_accumulator = 0f; } __instance.m_skillData.Remove(skill.Key); } } } private static void Patch_Skills_OnDeath_Finalizer(Skills __instance, [<615600cf-e8b8-42d9-863c-39634c47a7e9>Nullable(new byte[] { 2, 0 })] ref Dictionary<SkillType, Skill> __state) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) if (__state == null) { return; } foreach (KeyValuePair<SkillType, Skill> item in __state) { __instance.m_skillData[item.Key] = item.Value; } __state = null; } private static void Patch_Terminal_InitTerminal_Prefix() { InitializedTerminal = Terminal.m_terminalInitialized; } private static void Patch_Terminal_InitTerminal() { if (!InitializedTerminal) { AddSkill(Terminal.commands["raiseskill"]); AddSkill(Terminal.commands["resetskill"]); } static void AddSkill(ConsoleCommand command) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown ConsoleOptionsFetcher fetcher = command.m_tabOptionsFetcher; command.m_tabOptionsFetcher = (ConsoleOptionsFetcher)delegate { List<string> list = fetcher.Invoke(); list.AddRange(skills.Values.Select((Skill skill) => skill.internalSkillName)); return list; }; } } [<81b753b3-ce60-4aa5-bbab-8b7f0e11f337>NullableContext(2)] private static SkillDef GetSkillDef(SkillType skillType) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) if (!skills.ContainsKey(skillType)) { return null; } return skills[skillType].skillDef; } private static byte[] ReadEmbeddedFileBytes(string name) { using MemoryStream memoryStream = new MemoryStream(); Assembly.GetExecutingAssembly().GetManifestResourceStream(Assembly.GetExecutingAssembly().GetName().Name + "." + name).CopyTo(memoryStream); return memoryStream.ToArray(); } private static Texture2D loadTexture(string name) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_001f: Expected O, but got Unknown Texture2D val = new Texture2D(0, 0); ImageConversion.LoadImage(val, ReadEmbeddedFileBytes("icons." + name)); return val; } private static Sprite loadSprite(string name, int width, int height) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) return Sprite.Create(loadTexture(name), new Rect(0f, 0f, (float)width, (float)height), Vector2.zero); } private static ConfigEntry<T> config<T>(string group, string name, T value, ConfigDescription description) { ConfigEntry<T> val = plugin.Config.Bind<T>(group, name, value, description); configSync?.GetType().GetMethod("AddConfigEntry").MakeGenericMethod(typeof(T)) .Invoke(configSync, new object[1] { val }); return val; } private static ConfigEntry<T> config<T>(string group, string name, T value, string description) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown return config(group, name, value, new ConfigDescription(description, (AcceptableValueBase)null, Array.Empty<object>())); } } [PublicAPI] public static class SkillExtensions { public static float GetSkillFactor(this Character character, string name) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return character.GetSkillFactor(Skill.fromName(name)) * Skill.skillByName[name].SkillEffectFactor; } public static float GetSkillFactor(this Skills skills, string name) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return skills.GetSkillFactor(Skill.fromName(name)) * Skill.skillByName[name].SkillEffectFactor; } public static void RaiseSkill(this Character character, string name, float value = 1f) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) character.RaiseSkill(Skill.fromName(name), value); } public static void RaiseSkill(this Skills skill, string name, float value = 1f) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) skill.RaiseSkill(Skill.fromName(name), value); } public static void LowerSkill(this Character character, string name, float factor = 1f) { character.GetSkills().LowerSkill(name, factor); } public static void LowerSkill(this Skills skills, string name, float factor) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) if (factor > 0f && skills.m_skillData.TryGetValue(Skill.fromName(name), out var value)) { Skill obj = value; obj.m_level -= value.m_level * factor; value.m_accumulator = 0f; } } } } namespace Herbalist.SE { public class SE_Berserker : SE_Stats { public float m_duration; public float m_damageMultiplier; public void Awake() { ((StatusEffect)this).m_name = "Berserker"; ((Object)this).name = "bh_berserker_elixir"; ((StatusEffect)this).m_tooltip = "Boost your attack damage but makes you weak to physical and range attacks." + $"\nDamage Multiplier: <color=orange>{m_damageMultiplier}x</color>" + $"\nDuration: <color=orange>{m_duration / 60f}min/s</color>"; ((StatusEffect)this).m_icon = PrefabSetup._herbalistBundle.LoadAsset<Sprite>("BH_BeserkerElixer.png"); } public override void Setup(Character character) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown EffectList val = new EffectList(); val.m_effectPrefabs = (EffectData[])(object)new EffectData[1] { new EffectData { m_prefab = ZNetScene.instance.GetPrefab("fx_GP_Activation"), m_enabled = true, m_variant = -1, m_attach = true } }; ((StatusEffect)this).m_startEffects = val; ((SE_Stats)this).Setup(character); } public void SetDuration(float duration) { m_duration = duration; ((StatusEffect)this).m_tooltip = "Boost your attack damage but makes you weak to physical and range attacks." + $"\nDamage Multiplier: <color=orange>{m_damageMultiplier}x</color>" + $"\nDuration: <color=orange>{m_duration / 60f}min/s</color>"; } public void SetMultiplier(float damage) { m_damageMultiplier = damage; ((StatusEffect)this).m_tooltip = "Boost your attack damage but makes you weak to physical and range attacks." + $"\nDamage Multiplier: <color=orange>{m_damageMultiplier}x</color>" + $"\nDuration: <color=orange>{m_duration / 60f}min/s</color>"; } public override void ModifyAttack(SkillType skill, ref HitData hitData) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) ((SE_Stats)this).ModifyAttack(skill, ref hitData); ((DamageTypes)(ref hitData.m_damage)).Modify(m_damageMultiplier); } public override void ModifyDamageMods(ref DamageModifiers modifiers) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) ((SE_Stats)this).ModifyDamageMods(ref modifiers); List<DamageModPair> list = new List<DamageModPair> { new DamageModPair { m_type = (DamageType)1, m_modifier = (DamageModifier)6 }, new DamageModPair { m_type = (DamageType)8, m_modifier = (DamageModifier)6 }, new DamageModPair { m_type = (DamageType)31, m_modifier = (DamageModifier)6 }, new DamageModPair { m_type = (DamageType)16, m_modifier = (DamageModifier)6 }, new DamageModPair { m_type = (DamageType)4, m_modifier = (DamageModifier)6 }, new DamageModPair { m_type = (DamageType)2, m_modifier = (DamageModifier)6 } }; ((DamageModifiers)(ref modifiers)).Apply(list); } } public class SE_Chicory : StatusEffect { public float m_duration { get { return base.m_ttl; } set { base.m_ttl = value; } } public void Awake() { base.m_name = "Chicory"; ((Object)this).name = "bh_chicory_buff"; base.m_tooltip = "Cures poison and gives you a poison resist for a short amount of time. \n<color=orange>Resistant</color> Vs. <color=orange>Poison</color>"; base.m_icon = PrefabSetup._herbalistBundle.LoadAsset<Sprite>("BH_Chicory.png"); } public override void Setup(Character character) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown m_duration = 10f; EffectList val = new EffectList(); val.m_effectPrefabs = (EffectData[])(object)new EffectData[1] { new EffectData { m_prefab = ZNetScene.instance.GetPrefab("sfx_creature_consume"), m_enabled = true, m_variant = -1, m_attach = true } }; base.m_startEffects = val; ((StatusEffect)this).Setup(character); } } public class SE_Daisy : StatusEffect { public float m_duration { get { return base.m_ttl; } set { base.m_ttl = value; } } public void Awake() { base.m_name = "Daisy"; ((Object)this).name = "bh_daisy_buff"; base.m_tooltip = "Removes freezing status effect and gives you a freezing resist for a short amount of time. \n<color=orange>Resistant</color> Vs. <color=orange>Freezing</color>"; base.m_icon = PrefabSetup._herbalistBundle.LoadAsset<Sprite>("BH_Daisy.png"); } public override void Setup(Character character) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown m_duration = 10f; EffectList val = new EffectList(); val.m_effectPrefabs = (EffectData[])(object)new EffectData[1] { new EffectData { m_prefab = ZNetScene.instance.GetPrefab("sfx_creature_consume"), m_enabled = true, m_variant = -1, m_attach = true } }; base.m_startEffects = val; ((StatusEffect)this).Setup(character); } } public class SE_Defender : SE_Stats { public float m_duration; public void Awake() { ((StatusEffect)this).m_name = "Defender"; ((Object)this).name = "bh_defender_elixir"; ((StatusEffect)this).m_tooltip = "Boost your overall defense but makes your attacks very weak." + $"\nDuration: <color=orange>{m_duration / 60f}min/s</color>"; ((StatusEffect)this).m_icon = PrefabSetup._herbalistBundle.LoadAsset<Sprite>("BH_DefenderElixer.png"); } public override void Setup(Character character) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown EffectList val = new EffectList(); val.m_effectPrefabs = (EffectData[])(object)new EffectData[1] { new EffectData { m_prefab = ZNetScene.instance.GetPrefab("fx_GP_Activation"), m_enabled = true, m_variant = -1, m_attach = true } }; ((StatusEffect)this).m_startEffects = val; ((SE_Stats)this).Setup(character); } public void SetDuration(float duration) { m_duration = duration; ((StatusEffect)this).m_tooltip = "Boost your overall defense but makes your attacks very weak." + $"\nDuration: <color=orange>{m_duration / 60f}min/s</color>"; } public override void ModifyAttack(SkillType skill, ref HitData hitData) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) ((SE_Stats)this).ModifyAttack(skill, ref hitData); ((DamageTypes)(ref hitData.m_damage)).Modify(0.2f); } public override void ModifyDamageMods(ref DamageModifiers modifiers) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: 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_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) ((SE_Stats)this).ModifyDamageMods(ref modifiers); List<DamageModPair> list = new List<DamageModPair> { new DamageModPair { m_type = (DamageType)1, m_modifier = (DamageModifier)5 }, new DamageModPair { m_type = (DamageType)8, m_modifier = (DamageModifier)5 }, new DamageModPair { m_type = (DamageType)31, m_modifier = (DamageModifier)5 }, new DamageModPair { m_type = (DamageType)16, m_modifier = (DamageModifier)5 }, new DamageModPair { m_type = (DamageType)4, m_modifier = (DamageModifier)5 }, new DamageModPair { m_type = (DamageType)2, m_modifier = (DamageModifier)5 }, new DamageModPair { m_type = (DamageType)224, m_modifier = (DamageModifier)5 }, new DamageModPair { m_type = (DamageType)32, m_modifier = (DamageModifier)5 }, new DamageModPair { m_type = (DamageType)64, m_modifier = (DamageModifier)5 }, new DamageModPair { m_type = (DamageType)128, m_modifier = (DamageModifier)5 }, new DamageModPair { m_type = (DamageType)256, m_modifier = (DamageModifier)5 }, new DamageModPair { m_type = (DamageType)512, m_modifier = (DamageModifier)5 } }; ((DamageModifiers)(ref modifiers)).Apply(list); } } public class SE_Ghost : StatusEffect { public float m_duration; public void Awake() { base.m_name = "Invisibility"; ((Object)this).name = "bh_invisibility_elixir"; base.m_tooltip = $"Makes you invisible for <color=orange>{m_duration / 60f}min/s</color>"; base.m_icon = PrefabSetup._herbalistBundle.LoadAsset<Sprite>("BH_GhostElixer.png"); } public override void Setup(Character character) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown EffectList val = new EffectList(); val.m_effectPrefabs = (EffectData[])(object)new EffectData[1] { new EffectData { m_prefab = ZNetScene.instance.GetPrefab("fx_GP_Activation"), m_enabled = true, m_variant = -1, m_attach = true } }; base.m_startEffects = val; ((StatusEffect)this).Setup(character); } public void SetDuration(float duration) { m_duration = duration; base.m_tooltip = $"Makes you invisible for <color=orange>{m_duration / 60f}min/s</color>"; } public override void UpdateStatusEffect(float dt) { ((StatusEffect)this).UpdateStatusEffect(dt); Character character = base.m_character; Character obj = ((character is Player) ? character : null); ((Player)obj).SetGhostMode(obj.GetSEMan().HaveStatusEffect(StringExtensionMethods.GetStableHashCode("bh_invisibility_elixir"))); } } public class SE_HeavyLifter : StatusEffect { public float m_duration; public void Awake() { base.m_name = "HeavyLifter"; ((Object)this).name = "bh_heavylifter_elixir"; base.m_tooltip = "Doubles your max carry weight.\nSide Effects: <color=orange>Halved Stamina Points</color>" + $"\nDuration: <color=orange>{m_duration / 60f}min/s</color>"; base.m_icon = PrefabSetup._herbalistBundle.LoadAsset<Sprite>("BH_HeavyLifterElixer.png"); } public override void Setup(Character character) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown EffectList val = new EffectList(); val.m_effectPrefabs = (EffectData[])(object)new EffectData[1] { new EffectData { m_prefab = ZNetScene.instance.GetPrefab("fx_GP_Activation"), m_enabled = true, m_variant = -1, m_attach = true } }; base.m_startEffects = val; ((StatusEffect)this).Setup(character); } public void SetDuration(float duration) { m_duration = duration; base.m_tooltip = "Doubles your max carry weight.\nSide Effects: <color=orange>Halved Stamina Points</color>" + $"\nDuration: <color=orange>{m_duration / 60f}min/s</color>"; } public override void ModifyMaxCarryWeight(float baseLimit, ref float limit) { ((StatusEffect)this).ModifyMaxCarryWeight(baseLimit, ref limit); limit *= 2f; } public override void UpdateStatusEffect(float dt) { ((StatusEffect)this).UpdateStatusEffect(dt); Character character = base.m_character; Character obj = ((character is Player) ? character : null); float num = default(float); float num2 = default(float); float num3 = default(float); ((Player)obj).GetTotalFoodValue(ref num, ref num2, ref num3); ((Player)obj).SetMaxStamina(num2 / 2f, false); } } public class SE_Herbalist : StatusEffect { public float m_healthOverTime; public float m_healthOverTimeInterval; public float m_healthOverTimeDuration; public float m_healthOverTimeTimer; public float m_healthOverTimeTicks; public float m_healthOverTimeTickHP; public float m_skillFactor; public float m_healBonusFactor; public float m_durationFactor; public void SetHealthOverTimeInterval(float bonus) { m_healthOverTimeInterval = bonus; } public void SetSkillFactor(float bonus) { m_skillFactor = bonus; } public void SetHealthOverTime(float bonus) { m_healthOverTime = bonus; } public void SetHealthOverTimeDuration(float bonus) { m_healthOverTimeDuration = bonus; } public void SetHealBonusFactor(float bonus) { m_healBonusFactor = bonus; } public void SetDurationFactor(float bonus) { m_durationFactor = bonus; } public override void Setup(Character character) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown EffectList val = new EffectList(); val.m_effectPrefabs = (EffectData[])(object)new EffectData[1] { new EffectData { m_prefab = ZNetScene.instance.GetPrefab("sfx_creature_consume"), m_enabled = true, m_variant = -1, m_attach = true } }; base.m_startEffects = val; ((StatusEffect)this).Setup(character); if (m_healthOverTime > 0f && m_healthOverTimeInterval > 0f) { if (m_healthOverTimeDuration <= 0f) { m_healthOverTimeDuration = base.m_ttl; } m_healthOverTimeTicks = m_healthOverTimeDuration + m_durationFactor * m_skillFactor / m_healthOverTimeInterval; m_healthOverTimeTickHP = m_healthOverTime + m_healBonusFactor * m_skillFactor / m_healthOverTimeTicks; } } public override void UpdateStatusEffect(float dt) { ((StatusEffect)this).UpdateStatusEffect(dt); if (m_healthOverTimeTicks > 0f) { m_healthOverTimeTimer += dt; if (m_healthOverTimeTimer > m_healthOverTimeInterval) { m_healthOverTimeTimer = 0f; m_healthOverTimeTicks -= 1f; base.m_character.Heal(m_healthOverTimeTickHP / 10f, true); } } } } public class SE_EitrTonic : StatusEffect { public float m_eitrOverTime; public float m_eitrOverTimeDuration; public float m_skillLevel; public void Awake() { base.m_tooltip = "Recovers your eitr over time." + $"\n<color=orange>Eitr: {m_eitrOverTime}</color>" + $"\n<color=orange>Duration: {m_eitrOverTimeDuration / 60f}min/s</color>" + "\n\nRequirement:" + $"\n<color=orange>Herbalist Lv: {m_skillLevel}</color>"; } public void SetEitrOverTime(float bonus) { m_eitrOverTime = bonus; base.m_tooltip = "Recovers your eitr over time." + $"\n<color=orange>Eitr: {m_eitrOverTime}</color>" + $"\n<color=orange>Duration: {m_eitrOverTimeDuration / 60f}min/s</color>" + "\n\nRequirement:" + $"\n<color=orange>Herbalist Lv: {m_skillLevel}</color>"; } public void SetEitrOverTimeDuration(float bonus) { m_eitrOverTimeDuration = bonus; base.m_tooltip = "Recovers your eitr over time." + $"\n<color=orange>Eitr: {m_eitrOverTime}</color>" + $"\n<color=orange>Duration: {m_eitrOverTimeDuration / 60f}min/s</color>" + "\n\nRequirement:" + $"\n<color=orange>Herbalist Lv: {m_skillLevel}</color>"; } public void SetSkillLevel(float bonus) { m_skillLevel = bonus; base.m_tooltip = "Recovers your eitr over time." + $"\n<color=orange>Eitr: {m_eitrOverTime}</color>" + $"\n<color=orange>Duration: {m_eitrOverTimeDuration / 60f}min/s</color>" + "\n\nRequirement:" + $"\n<color=orange>Herbalist Lv: {m_skillLevel}</color>"; } public override void Setup(Character character) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown EffectList val = new EffectList(); val.m_effectPrefabs = (EffectData[])(object)new EffectData[1] { new EffectData { m_prefab = ZNetScene.instance.GetPrefab("vfx_Potion_eitr_minor"), m_enabled = true, m_variant = -1, m_attach = true } }; base.m_startEffects = val; ((StatusEffect)this).Setup(character); if (m_eitrOverTime > 0f && m_eitrOverTimeDuration <= 0f) { m_eitrOverTimeDuration = base.m_ttl; } } public override void UpdateStatusEffect(float dt) { ((StatusEffect)this).UpdateStatusEffect(dt); if (m_eitrOverTime != 0f && base.m_time <= m_eitrOverTimeDuration) { float num = m_eitrOverTimeDuration / dt; base.m_character.AddEitr(m_eitrOverTime / num * 50f); } } } public class SE_HealthTonic : StatusEffect { public float m_healthOverTime; public float m_healthOverTimeInterval; public float m_healthOverTimeDuration; public float m_healthOverTimeTimer; public float m_healthOverTimeTicks; public float m_healthOverTimeTickHP; public int m_skillLevel; public void Awake() { base.m_tooltip = "Recovers your health over time." + $"\n<color=orange>HealOverTime: {Mathf.FloorToInt(m_healthOverTime / (m_healthOverTimeDuration / 60f / m_healthOverTimeInterval))}</color>" + $"\n<color=orange>Duration: {m_healthOverTimeDuration / 60f}min/s</color>" + "\n\nRequirement:" + $"\n<color=orange>Herbalist Lv: {m_skillLevel}</color>"; } public void SetHealthOverTimeInterval(float bonus) { m_healthOverTimeInterval = bonus; base.m_tooltip = "Recovers your health over time." + $"\n<color=orange>HealOverTime: {Mathf.FloorToInt(m_healthOverTime / (m_healthOverTimeDuration / 60f / m_healthOverTimeInterval))}</color>" + $"\n<color=orange>Duration: {m_healthOverTimeDuration / 60f}min/s</color>" + "\n\nRequirement:" + $"\n<color=orange>Herbalist Lv: {m_skillLevel}</color>"; } public void SetHealthOverTime(float bonus) { m_healthOverTime = bonus; base.m_tooltip = "Recovers your health over time." + $"\n<color=orange>HealOverTime: {Mathf.FloorToInt(m_healthOverTime / (m_healthOverTimeDuration / 60f / m_healthOverTimeInterval))}</color>" + $"\n<color=orange>Duration: {m_healthOverTimeDuration / 60f}min/s</color>" + "\n\nRequirement:" + $"\n<color=orange>Herbalist Lv: {m_skillLevel}</color>"; } public void SetHealthOverTimeDuration(float bonus) { m_healthOverTimeDuration = bonus; base.m_tooltip = "Recovers your health over time." + $"\n<color=orange>HealOverTime: {Mathf.FloorToInt(m_healthOverTime / (m_healthOverTimeDuration / 60f / m_healthOverTimeInterval))}</color>" + $"\n<color=orange>Duration: {m_healthOverTimeDuration / 60f}min/s</color>" + "\n\nRequirement:" + $"\n<color=orange>Herbalist Lv: {m_skillLevel}</color>"; } public void SetSkillLevel(int bonus) { m_skillLevel = bonus; base.m_tooltip = "Recovers your health over time." + $"\n<color=orange>HealOverTime: {Mathf.FloorToInt(m_healthOverTime / (m_healthOverTimeDuration / 60f / m_healthOverTimeInterval))}</color>" + $"\n<color=orange>Duration: {m_healthOverTimeDuration / 60f}min/s</color>" + "\n\nRequirement:" + $"\n<color=orange>Herbalist Lv: {m_skillLevel}</color>"; } public override void Setup(Character character) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown EffectList val = new EffectList(); val.m_effectPrefabs = (EffectData[])(object)new EffectData[1] { new EffectData { m_prefab = ZNetScene.instance.GetPrefab("vfx_Potion_health_medium"), m_enabled = true, m_variant = -1, m_attach = true } }; base.m_startEffects = val; ((StatusEffect)this).Setup(character); if (m_healthOverTime > 0f && m_healthOverTimeInterval > 0f) { if (m_healthOverTimeDuration <= 0f) { m_healthOverTimeDuration = base.m_ttl; } m_healthOverTimeTicks = m_healthOverTimeDuration / m_healthOverTimeInterval; m_healthOverTimeTickHP = m_healthOverTime / m_healthOverTimeTicks; } } public override void UpdateStatusEffect(float dt) { ((StatusEffect)this).UpdateStatusEffect(dt); if (m_healthOverTimeTicks > 0f) { m_healthOverTimeTimer += dt; if (m_healthOverTimeTimer > m_healthOverTimeInterval) { m_healthOverTimeTimer = 0f; m_healthOverTimeTicks -= 1f; base.m_character.Heal(m_healthOverTimeTickHP, true); } } } } public class SE_FastLearner : StatusEffect { public float m_duration; public float m_expMultiplier; public void Awake() { base.m_name = "FastLearner"; ((Object)this).name = "bh_fastlearner_elixir"; base.m_tooltip = "You're quick to learn things. " + $"\nExperience Gained: <color=orange>x{m_expMultiplier}</color>" + "\nSide Effects: <color=orange>Halved Health Points</color>" + $"\nDuration: <color=orange>{m_duration / 60f}min/s</color>"; base.m_icon = PrefabSetup._herbalistBundle.LoadAsset<Sprite>("BH_LearningElixer.png"); } public override void Setup(Character character) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown EffectList val = new EffectList(); val.m_effectPrefabs = (EffectData[])(object)new EffectData[1] { new EffectData { m_prefab = ZNetScene.instance.GetPrefab("fx_GP_Activation"), m_enabled = true, m_variant = -1, m_attach = true } }; base.m_startEffects = val; ((StatusEffect)this).Setup(character); } public void SetDuration(float duration) { m_duration = duration; base.m_tooltip = "You're quick to learn things. " + $"\nExperience Gained: <color=orange>x{m_expMultiplier}</color>" + "\nSide Effects: <color=orange>Halved Health Points</color>" + $"\nDuration: <color=orange>{m_duration / 60f}min/s</color>"; } public void SetMultiplier(float multiplier) { m_expMultiplier = multiplier; base.m_tooltip = "You're quick to learn everything. " + $"\nExperience Gained: <color=orange>x{m_expMultiplier}</color>" + "\nSide Effects: <color=orange>Halved Health Points</color>" + $"\nDuration: <color=orange>{m_duration / 60f}min/s</color>"; } public override void UpdateStatusEffect(float dt) { ((StatusEffect)this).UpdateStatusEffect(dt); Character character = base.m_character; Character obj = ((character is Player) ? character : null); float num = default(float); float num2 = default(float); float num3 = default(float); ((Player)obj).GetTotalFoodValue(ref num, ref num2, ref num3); ((Player)obj).SetMaxHealth(num / 2f, false); } } public class SE_Jump : StatusEffect { public float m_duration; public float m_jumpMultiplier; public void Awake() { base.m_name = "JumpElixir"; ((Object)this).name = "bh_jump_elixir"; base.m_tooltip = "Boost your jump ability.\nSide Effects: <color=orange>Doubles Jump Stamina Usage</color>" + $"\nDuration: <color=orange>{m_duration / 60f}min/s</color>"; base.m_icon = PrefabSetup._herbalistBundle.LoadAsset<Sprite>("BH_JumpElixer.png"); } public override void Setup(Character character) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown EffectList val = new EffectList(); val.m_effectPrefabs = (EffectData[])(object)new EffectData[1] { new EffectData { m_prefab = ZNetScene.instance.GetPrefab("fx_GP_Activation"), m_enabled = true, m_variant = -1, m_attach = true } }; base.m_startEffects = val; ((StatusEffect)this).Setup(character); } public void SetDuration(float duration) { m_duration = duration; base.m_tooltip = "Boost your jump ability.\nSide Effects: <color=orange>Doubles Jump Stamina Usage</color>" + $"\nDuration: <color=orange>{m_duration / 60f}min/s</color>"; } public void SetJumpMultiplier(float jump) { m_jumpMultiplier = jump; } public override void ModifyJump(Vector3 baseJump, ref Vector3 jump) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) ((StatusEffect)this).ModifyJump(baseJump, ref jump); jump *= m_jumpMultiplier; } public override void ModifyJumpStaminaUsage(float baseStaminaUse, ref float staminaUse) { ((StatusEffect)this).ModifyJumpStaminaUsage(baseStaminaUse, ref staminaUse); staminaUse *= 2f; } } public class SE_Swift : StatusEffect { public float m_duration; public float m_speedMultiplier; public void Awake() { base.m_name = "Swift"; ((Object)this).name = "bh_swift_elixir"; base.m_tooltip = "Makes you run faster but makes you fragile." + $"\nRunSpeed Multiplier: <color=orange>x{m_speedMultiplier}</color>" + "\nSide Effects: <color=orange>Halved Health Points</color>" + $"\nDuration: <color=orange>{m_duration / 60f}min/s</color>"; base.m_icon = PrefabSetup._herbalistBundle.LoadAsset<Sprite>("BH_RunnerElixer.png"); } public override void Setup(Character character) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown EffectList val = new EffectList(); val.m_effectPrefabs = (EffectData[])(object)new EffectData[1] { new EffectData { m_prefab = ZNetScene.instance.GetPrefab("fx_GP_Activation"), m_enabled = true, m_variant = -1, m_attach = true } }; base.m_startEffects = val; ((StatusEffect)this).Setup(character); } public void SetDuration(float duration) { m_duration = duration; base.m_tooltip = "Makes you run faster but makes you fragile." + $"\nRunSpeed Multiplier: <color=orange>x{m_speedMultiplier}</color>" + "\nSide Effects: <color=orange>Halved Health Points</color>" + $"\nDuration: <color=orange>{m_duration / 60f}min/s</color>"; } public void SetMultiplier(float multiplier) { m_speedMultiplier = multiplier; base.m_tooltip = "Makes you run faster but makes you fragile." + $"\nRunSpeed Multiplier: <color=orange>x{m_speedMultiplier}</color>" + "\nSide Effects: <color=orange>Halved Health Points</color>" + $"\nDuration: <color=orange>{m_duration / 60f}min/s</color>"; } public override void UpdateStatusEffect(float dt) { ((StatusEffect)this).UpdateStatusEffect(dt); Character character = base.m_character; Character obj = ((character is Player) ? character : null); float num = default(float); float num2 = default(float); float num3 = default(float); ((Player)obj).GetTotalFoodValue(ref num, ref num2, ref num3); ((Player)obj).SetMaxHealth(num / 2f, false); } public override void ModifySpeed(float baseSpeed, ref float speed, Character character, Vector3 dir) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) ((StatusEffect)this).ModifySpeed(baseSpeed, ref speed, character, dir); speed *= m_speedMultiplier; } } public class SE_SlowFall : SE_Stats { public float m_duration; public void Awake() { ((StatusEffect)this).m_name = "SlowFall"; ((Object)this).name = "bh_slowfall_elixir"; ((StatusEffect)this).m_tooltip = "Makes you fall slowly." + $"\nDuration: <color=orange>{m_duration / 60f}min/s</color>"; ((StatusEffect)this).m_icon = PrefabSetup._herbalistBundle.LoadAsset<Sprite>("BH_SlowFallElixer.png"); } public override void Setup(Character character) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown EffectList val = new EffectList(); val.m_effectPrefabs = (EffectData[])(object)new EffectData[1] { new EffectData { m_prefab = ZNetScene.instance.GetPrefab("fx_GP_Activation"), m_enabled = true, m_variant = -1, m_attach = true } }; ((StatusEffect)this).m_startEffects = val; ((SE_Stats)this).Setup(character); } public void SetDuration(float duration) { m_duration = duration; ((StatusEffect)this).m_tooltip = "Makes you fall slowly." + $"\nDuration: <color=orange>{m_duration / 60f}min/s</color>"; } } public class SE_StaminaTonic : StatusEffect { public float m_staminaOverTime; public float m_staminaOverTimeDuration; public float m_skillLevel; public void Awake() { base.m_tooltip = "Recovers your stamina over time." + $"<color=orange>Stamina: {m_staminaOverTime}</color>" + $"\n<color=orange>Duration: {m_staminaOverTimeDuration / 60f}min/s</color>" + "\n\nRequirement:" + $"\n<color=orange>Herbalist Lv: {m_skillLevel}</color>"; } public void SetStaminaOverTime(float bonus) { m_staminaOverTime = bonus; base.m_tooltip = "Recovers your stamina over time." + $"\n<color=orange>Stamina: {m_staminaOverTime}</color>" + $"\n<color=orange>Duration: {m_staminaOverTimeDuration / 60f}min/s</color>" + "\n\nRequirement:" + $"\n<color=orange>Herbalist Lv: {m_skillLevel}</color>"; } public void SetStaminaOverTimeDuration(float bonus) { m_staminaOverTimeDuration = bonus; base.m_tooltip = "Recovers your stamina over time." + $"\n<color=orange>Stamina: {m_staminaOverTime}</color>" + $"\n<color=orange>Duration: {m_staminaOverTimeDuration / 60f}min/s</color>" + "\n\nRequirement:" + $"\n<color=orange>Herbalist Lv: {m_skillLevel}</color>"; } public void SetSkillLevel(float bonus) { m_skillLevel = bonus; base.m_tooltip = "Recovers your stamina over time." + $"\n<color=orange>Stamina: {m_staminaOverTime}</color>" + $"\n<color=orange>Duration: {m_staminaOverTimeDuration / 60f}min/s</color>" + "\n\nRequirement:" + $"\n<color=orange>Herbalist Lv: {m_skillLevel}</color>"; } public override void Setup(Character character) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown EffectList val = new EffectList(); val.m_effectPrefabs = (EffectData[])(object)new EffectData[1] { new EffectData { m_prefab = ZNetScene.instance.GetPrefab("vfx_Potion_stamina_medium"), m_enabled = true, m_variant = -1, m_attach = true } }; base.m_startEffects = val; ((StatusEffect)this).Setup(character); if (m_staminaOverTime > 0f && m_staminaOverTimeDuration <= 0f) { m_staminaOverTimeDuration = base.m_ttl; } } public override void UpdateStatusEffect(float dt) { ((StatusEffect)this).UpdateStatusEffect(dt); if (m_staminaOverTime != 0f && base.m_time <= m_staminaOverTimeDuration) { float num = m_staminaOverTimeDuration / dt; base.m_character.AddStamina(m_staminaOverTime / num * 50f); } } } } namespace Herbalist.Utils { public abstract class RegisterEffectsToZNetScene { private static ZNetScene _zNetScene => ZNetScene.instance; public static void Init() { if (Helper.ZNetSceneAwake()) { GameObject gameObject = PrefabSetup._herbalistBundle.LoadAsset<GameObject>("bh_sfx_build_hammer_wood"); _zNetScene.AddClonedObject(gameObject); GameObject gameObject2 = PrefabSetup._herbalistBundle.LoadAsset<GameObject>("bh_sfx_gui_craftitem_cauldron"); _zNetScene.AddClonedObject(gameObject2); GameObject gameObject3 = PrefabSetup._herbalistBundle.LoadAsset<GameObject>("bh_sfx_gui_craftitem_cauldron_end"); _zNetScene.AddClonedObject(gameObject3); GameObject gameObject4 = PrefabSetup._herbalistBundle.LoadAsset<GameObject>("bh_sfx_gui_repairitem_workbench"); _zNetScene.AddClonedObject(gameObject4); GameObject gameObject5 = PrefabSetup._herbalistBundle.LoadAsset<GameObject>("bh_sfx_MeadBurp"); _zNetScene.AddClonedObject(gameObject5); GameObject gameObject6 = PrefabSetup._herbalistBundle.LoadAsset<GameObject>("bh_sfx_pickable_pick"); _zNetScene.AddClonedObject(gameObject6); GameObject gameObject7 = PrefabSetup._herbalistBundle.LoadAsset<GameObject>("bh_sfx_wood_destroyed"); _zNetScene.AddClonedObject(gameObject7); GameObject gameObject8 = PrefabSetup._herbalistBundle.LoadAsset<GameObject>("bh_vfx_MeadSplash"); _zNetScene.AddClonedObject(gameObject8); GameObject gameObject9 = PrefabSetup._herbalistBundle.LoadAsset<GameObject>("bh_vfx_pickable_pick"); _zNetScene.AddClonedObject(gameObject9); GameObject gameObject10 = PrefabSetup._herbalistBundle.LoadAsset<GameObject>("bh_vfx_Place_workbench"); _zNetScene.AddClonedObject(gameObject10); GameObject gameObject11 = PrefabSetup._herbalistBundle.LoadAsset<GameObject>("bh_vfx_SawDust"); _zNetScene.AddClonedObject(gameObject11); } } } } namespace Herbalist.Patches { public static class PrefabSetup { public static AssetBundle _herbalistBundle; public static GameObject _berserkerElixir; public static GameObject _boswellia; public static GameObject _chamomile; public static GameObject _chicory; public static GameObject _daisy; public static GameObject _defenderElixir; public static GameObject _echinacea; public static GameObject _emptyBottle; public static GameObject _emptyContainer; public static GameObject _emptyElixirBottle; public static GameObject _emptyLargeBottle; public static GameObject _ghostElixir; public static GameObject _heavyLifterElixir; public static GameObject _jumpElixir; public static GameObject _largeEitrTonic; public static GameObject _largeHealthTonic; public static GameObject _largeStaminaTonic; public static GameObject _lavender; public static GameObject _learningElixir; public static GameObject _mediumEitrTonic; public static GameObject _mediumHealthTonic; public static GameObject _mediumStaminaTonic; public static GameObject _minorEitrTonic; public static GameObject _minorHealthTonic; public static GameObject _minorStaminaTonic; public static GameObject _mortarAndPestle; public static GameObject _pickableBoswellia; public static GameObject _pickableChamomile; public static GameObject _pickableChicory; public static GameObject _pickableDaisy; public static GameObject _pickableEchinacea; public static GameObject _pickableLavender; public static GameObject _runnerElixir; public static GameObject _slowFallElixir; public static void Init() { _herbalistBundle = GetAssetBundleFromResources("herbalistbundle"); _berserkerElixir = _herbalistBundle.LoadAsset<GameObject>("BH_BeserkerElixer"); _boswellia = _herbalistBundle.LoadAsset<GameObject>("BH_Boswellia"); ShaderReplacer.Replace(_boswellia); _chamomile = _herbalistBundle.LoadAsset<GameObject>("BH_Chamomile"); ShaderReplacer.Replace(_chamomile); _chicory = _herbalistBundle.LoadAsset<GameObject>("BH_Chicory"); ShaderReplacer.Replace(_chicory); _daisy = _herbalistBundle.LoadAsset<GameObject>("BH_Daisy"); ShaderReplacer.Replace(_daisy); _defenderElixir = _herbalistBundle.LoadAsset<GameObject>("BH_DefenderElixer"); _echinacea = _herbalistBundle.LoadAsset<GameObject>("BH_Echinacea"); ShaderReplacer.Replace(_echinacea); _emptyBottle = _herbalistBundle.LoadAsset<GameObject>("BH_EmptyBottle"); _emptyContainer = _herbalistBundle.LoadAsset<GameObject>("BH_EmptyContainer"); _emptyElixirBottle = _herbalistBundle.LoadAsset<GameObject>("BH_EmptyElixerBottle"); _emptyLargeBottle = _herbalistBundle.LoadAsset<GameObject>("BH_EmptyLargeBottle"); _ghostElixir = _herbalistBundle.LoadAsset<GameObject>("BH_GhostElixer"); _heavyLifterElixir = _herbalistBundle.LoadAsset<GameObject>("BH_HeavyLifterElixer"); _jumpElixir = _herbalistBundle.LoadAsset<GameObject>("BH_JumpElixer"); _largeEitrTonic = _herbalistBundle.LoadAsset<GameObject>("BH_LargeEitrTonic"); _largeHealthTonic = _herbalistBundle.LoadAsset<GameObject>("BH_LargeHealthTonic"); _largeStaminaTonic = _herbalistBundle.LoadAsset<GameObject>("BH_LargeStaminaTonic"); _lavender = _herbalistBundle.LoadAsset<GameObject>("BH_Lavender"); ShaderReplacer.Replace(_lavender); _learningElixir = _herbalistBundle.LoadAsset<GameObject>("BH_LearningElixer"); _mediumEitrTonic = _herbalistBundle.LoadAsset<GameObject>("BH_MediumEitrTonic"); _mediumHealthTonic = _herbalistBundle.LoadAsset<GameObject>("BH_MediumHealthTonic"); _mediumStaminaTonic = _herbalistBundle.LoadAsset<GameObject>("BH_MediumStaminaTonic"); _minorEitrTonic = _herbalistBundle.LoadAsset<GameObject>("BH_MinorEitrTonic"); _minorHealthTonic = _herbalistBundle.LoadAsset<GameObject>("BH_MinorHealthTonic"); _minorStaminaTonic = _herbalistBundle.LoadAsset<GameObject>("BH_MinorStaminaTonic"); _mortarAndPestle = _herbalistBundle.LoadAsset<GameObject>("BH_MortarAndPestle"); ShaderReplacer.Replace(_mortarAndPestle); _pickableBoswellia = _herbalistBundle.LoadAsset<GameObject>("BH_Pickable_Boswellia"); ShaderReplacer.Replace(_pickableBoswellia); _pickableChamomile = _herbalistBundle.LoadAsset<GameObject>("BH_Pickable_Chamomile"); ShaderReplacer.Replace(_pickableChamomile); _pickableChicory = _herbalistBundle.LoadAsset<GameObject>("BH_Pickable_Chicory"); ShaderReplacer.Replace(_pickableChicory); _pickableDaisy = _herbalistBundle.LoadAsset<GameObject>("BH_Pickable_Daisy"); ShaderReplacer.Replace(_pickableDaisy); _pickableEchinacea = _herbalistBundle.LoadAsset<GameObject>("BH_Pickable_Echinacea"); ShaderReplacer.Replace(_pickableEchinacea); _pickableLavender = _herbalistBundle.LoadAsset<GameObject>("BH_Pickable_Lavender"); ShaderReplacer.Replace(_pickableLavender); _runnerElixir = _herbalistBundle.LoadAsset<GameObject>("BH_RunnerElixer"); _slowFallElixir = _herbalistBundle.LoadAsset<GameObject>("BH_SlowFallElixer"); } private static AssetBundle GetAssetBundleFromResources(string filename) { Assembly executingAssembly = Assembly.GetExecutingAssembly(); string name = executingAssembly.GetManifestResourceNames().Single((string x) => x.EndsWith(filename)); using Stream stream = executingAssembly.GetManifestResourceStream(name); return AssetBundle.LoadFromStream(stream); } } [HarmonyPatch(typeof(Character), "RPC_Damage")] public class CharacterPatch { public static void Postfix(ref Character __instance, ref HitData hit) { if (!((Object)(object)__instance == (Object)null) && !__instance.IsPlayer()) { Character attacker = hit.GetAttacker(); Player val = (Player)(object)((attacker is Player) ? attacker : null); if (val != null && __instance.m_name.StartsWith("$enemy_") && ((Character)val).GetSEMan().HaveStatusEffect(StringExtensionMethods.GetStableHashCode("bh_invisibility_elixir"))) { ((Character)val).GetSEMan().RemoveStatusEffect(StringExtensionMethods.GetStableHashCode("bh_invisibility_elixir"), false); val.SetGhostMode(false); } } } } [HarmonyPatch] public class HudPatch { [HarmonyPatch(typeof(Hud), "FlashHealthBar")] [HarmonyPostfix] public static void FlashHealthBar_Postfix(Hud __instance) { if (((Character)Player.m_localPlayer).GetSEMan().HaveStatusEffect(StringExtensionMethods.GetStableHashCode("bh_fastlearner_elixir")) || ((Character)Player.m_localPlayer).GetSEMan().HaveStatusEffect(StringExtensionMethods.GetStableHashCode("bh_swift_elixir"))) { __instance.m_healthAnimator.ResetTrigger("Flash"); } } [HarmonyPostfix] [HarmonyPatch(typeof(Hud), "StaminaBarUppgradeFlash")] public static void StaminaBarUpgradeFlash_Postfix(Hud __instance) { if (((Character)Player.m_localPlayer).GetSEMan().HaveStatusEffect(StringExtensionMethods.GetStableHashCode("bh_heavylifter_elixir"))) { __instance.m_staminaAnimator.ResetTrigger("Flash"); } } } [HarmonyPatch] public class InventoryGuiPatch { private static bool _RequirementsMet; [HarmonyPostfix] [HarmonyPatch(typeof(InventoryGui), "DoCrafting")] public static void DoCrafting_Postfix(InventoryGui __instance, ref Player player) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) Scene activeScene = SceneManager.GetActiveScene(); if (!(((Scene)(ref activeScene)).name != "main") && !((Object)(object)__instance == (Object)null) && !((Object)(object)player != (Object)(object)Player.m_localPlayer) && !((Object)(object)__instance.m_craftRecipe == (Object)null) && __instance.m_availableRecipes.Count > 0) { string name = ((Object)__instance.m_craftRecipe.m_item).name; if (Plugin._potionsToGainExpList.Contains(name) && _RequirementsMet) { ((Character)player).RaiseSkill(Skill.fromName("Herbalist"), Plugin._craftingExp.Value); } } } [HarmonyPrefix] [HarmonyPatch(typeof(InventoryGui), "DoCrafting")] public static bool DoCrafting_Prefix(InventoryGui __instance, ref Player player) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name != "main") { return false; } if ((Object)(object)__instance == (Object)null || (Object)(object)player != (Object)(object)Player.m_localPlayer || (Object)(object)__instance.m_craftRecipe == (Object)null) { return false; } ((Character)player).GetSkills().m_skillData.TryGetValue((SkillType)Math.Abs(StringExtensionMethods.GetStableHashCode("Herbalist")), out var value); if (((Object)((RecipeDataPair)(ref __instance.m_selectedRecipe)).Recipe.m_item).name.ToLower().Contains("bh_minor") && value.m_level < (float)Plugin._minorLevel.Value) { ((Character)player).Message((MessageType)2, "<size=28>Herbalist level not high enough.</size>", 0, (Sprite)null); _RequirementsMet = false; return false; } if (((Object)((RecipeDataPair)(ref __instance.m_selectedRecipe)).Recipe.m_item).name.ToLower().Contains("bh_medium") && value.m_level < (float)Plugin._mediumLevel.Value) { ((Character)player).Message((MessageType)2, "<size=28>Herbalist level not high enough.</size>", 0, (Sprite)null); _RequirementsMet = false; return false; } if (((Object)((RecipeDataPair)(ref __instance.m_selectedRecipe)).Recipe.m_item).name.ToLower().Contains("bh_large") && value.m_level < (float)Plugin._largeLevel.Value) { ((Character)player).Message((MessageType)2, "<size=28>Herbalist level not high enough.</size>", 0, (Sprite)null); _RequirementsMet = false; return false; } _RequirementsMet = true; return true; } } [HarmonyPatch] public class ItemDataPatch { [HarmonyPostfix] [HarmonyPatch(typeof(ItemData), "GetStatusEffectTooltip")] public static string GetStatusEffectTooltip_Postfix(string __result, ItemData __instance) { try { if (__instance?.m_shared == null) { return __result; } StringBuilder stringBuilder = new StringBuilder(__result); ((Character)Player.m_localPlayer).GetSkills().m_skillData.TryGetValue((SkillType)Math.Abs(StringExtensionMethods.GetStableHashCode("Herbalist")), out var value); float num = ((value.m_level <= 0f) ? 0f : value.m_level); float skillFactor = ((Character)(object)Player.m_localPlayer).GetSkillFactor("Herbalist"); float num2 = Plugin._dandelionDuration.Value + Plugin._durationBonusFactor.Value * skillFactor; float num3 = Plugin._thistleDuration.Value + Plugin._durationBonusFactor.Value * skillFactor; float num4 = num2 / Plugin._dandelionInterval.Value; float num5 = num3 / Plugin._thistleInterval.Value; float num6 = Plugin._dandelionHealthOverTime.Value + Plugin._healBonusFactor.Value * skillFactor / num4; float num7 = Plugin._thistleHealthOverTime.Value + Plugin._healBonusFactor.Value * skillFactor / num5; string name = ((Object)__instance.m_dropPrefab).name; if (!(name == "Dandelion")) { if (name == "Thistle") { stringBuilder.Append($"<color=red>Herbalist Lv: {num}</color>"); stringBuilder.Append("\nHeals you over time."); stringBuilder.Append($"\n<color=orange>HealOvertime: {num7 / 10f:#.##}</color>"); stringBuilder.Append($"\n<color=orange>Interval: {Plugin._thistleInterval.Value}</color>"); stringBuilder.Append($"\n<color=orange>Duration: {num3}</color>"); return stringBuilder.ToString(); } return __result; } stringBuilder.Append($"<color=red>Herbalist Lv: {num}</color>"); stringBuilder.Append("\nHeals you over time."); stringBuilder.Append($"\n<color=orange>HealOvertime: {num6 / 10f:#.##}</color>"); stringBuilder.Append($"\n<color=orange>Interval: {Plugin._dandelionInterval.Value}</color>"); stringBuilder.Append($"\n<color=orange>Duration: {num2}</color>"); return stringBuilder.ToString(); } catch { return __result; } } } [HarmonyPatch] public class ObjectDBPatch {