Decompiled source of Hunting v1.3.1
Hunting.dll
Decompiled 6 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.IO.Compression; using System.Linq; 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.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Hunting.Patches; using Hunting.Utils; using JetBrains.Annotations; using Microsoft.CodeAnalysis; using ServerSync; using SkillManager; using TMPro; using UnityEngine; using UnityEngine.UI; [assembly: Guid("D30D4CCF-E7C9-4819-AA2A-935D4907C49F")] [assembly: ComVisible(false)] [assembly: AssemblyTrademark("")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyProduct("Hunting")] [assembly: AssemblyCompany("blacks7ar")] [assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")] [assembly: AssemblyDescription("https://valheim.thunderstore.io/package/blacks7ar/Hunting/")] [assembly: AssemblyTitle("Hunting")] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: CompilationRelaxations(8)] [assembly: AssemblyFileVersion("1.3.1")] [assembly: AssemblyConfiguration("")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.3.1.0")] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [<5febb8bf-d11f-41a3-ba48-4b152d4d27eb>Embedded] internal sealed class <5febb8bf-d11f-41a3-ba48-4b152d4d27eb>EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [<5febb8bf-d11f-41a3-ba48-4b152d4d27eb>Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class <bb1761af-81b6-4d38-8e69-a3a16f80564b>NullableAttribute : Attribute { public readonly byte[] NullableFlags; public <bb1761af-81b6-4d38-8e69-a3a16f80564b>NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public <bb1761af-81b6-4d38-8e69-a3a16f80564b>NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [<5febb8bf-d11f-41a3-ba48-4b152d4d27eb>Embedded] [CompilerGenerated] internal sealed class <1a599cb2-8e4a-467d-bb30-90262a57839e>NullableContextAttribute : Attribute { public readonly byte Flag; public <1a599cb2-8e4a-467d-bb30-90262a57839e>NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace SkillManager { [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([<bb1761af-81b6-4d38-8e69-a3a16f80564b>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 { [UsedImplicitly] [<bb1761af-81b6-4d38-8e69-a3a16f80564b>Nullable(2)] 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; [<bb1761af-81b6-4d38-8e69-a3a16f80564b>Nullable(2)] private static Localization _english; [<bb1761af-81b6-4d38-8e69-a3a16f80564b>Nullable(2)] private static BaseUnityPlugin _plugin; private static bool hasConfigSync; [<bb1761af-81b6-4d38-8e69-a3a16f80564b>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; } } [<bb1761af-81b6-4d38-8e69-a3a16f80564b>Nullable(2)] private static object configSync { [<1a599cb2-8e4a-467d-bb30-90262a57839e>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; } } [<bb1761af-81b6-4d38-8e69-a3a16f80564b>Nullable(2)] [method: <1a599cb2-8e4a-467d-bb30-90262a57839e>NullableContext(2)] [field: <bb1761af-81b6-4d38-8e69-a3a16f80564b>Nullable(2)] public event Action<float> SkillGainFactorChanged; [<bb1761af-81b6-4d38-8e69-a3a16f80564b>Nullable(2)] [method: <1a599cb2-8e4a-467d-bb30-90262a57839e>NullableContext(2)] [field: <bb1761af-81b6-4d38-8e69-a3a16f80564b>Nullable(2)] public event Action<float> SkillEffectFactorChanged; [<bb1761af-81b6-4d38-8e69-a3a16f80564b>Nullable(2)] [method: <1a599cb2-8e4a-467d-bb30-90262a57839e>NullableContext(2)] [field: <bb1761af-81b6-4d38-8e69-a3a16f80564b>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([<bb1761af-81b6-4d38-8e69-a3a16f80564b>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, [<bb1761af-81b6-4d38-8e69-a3a16f80564b>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, [<bb1761af-81b6-4d38-8e69-a3a16f80564b>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; }; } } [<1a599cb2-8e4a-467d-bb30-90262a57839e>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 Hunting { [BepInPlugin("blacks7ar.Hunting", "Hunting", "1.3.1")] public class Plugin : BaseUnityPlugin { public enum DisplayOptions { Numerical, Percentage } private const string modGUID = "blacks7ar.Hunting"; public const string modName = "Hunting"; public const string modAuthor = "blacks7ar"; public const string modVersion = "1.3.1"; public const string modLink = "https://valheim.thunderstore.io/package/blacks7ar/Hunting/"; private static string configFileName = "blacks7ar.Hunting.cfg"; private static string configFileFullPath; private static readonly Harmony _harmony; private static readonly ConfigSync _configSync; private static ConfigEntry<Toggle> _serverConfigLocked; private static ConfigEntry<float> _expGainFactor; public static ConfigEntry<float> _huntingYieldFactor; public static ConfigEntry<string> _tier1Meadows; public static ConfigEntry<int> _tier1MeadowsLevel; public static ConfigEntry<string> _tier2BlackForest; public static ConfigEntry<int> _tier2BlackForestLevel; public static ConfigEntry<string> _tier3Swamps; public static ConfigEntry<int> _tier3SwampsLevel; public static ConfigEntry<string> _tier4Mountains; public static ConfigEntry<int> _tier4MountainsLevel; public static ConfigEntry<string> _tier5Plains; public static ConfigEntry<int> _tier5PlainsLevel; public static ConfigEntry<string> _tier6Mistlands; public static ConfigEntry<int> _tier6MistlandsLevel; public static ConfigEntry<string> _tier7Ashlands; public static ConfigEntry<int> _tier7AshlandsLevel; public static ConfigEntry<string> _tier8DeepNorth; public static ConfigEntry<int> _tier8DeepNorthLevel; public static ConfigEntry<float> _detectionRadius; public static ConfigEntry<Toggle> _displayExpGained; public static ConfigEntry<Toggle> _displayEnemyHPEnable; public static ConfigEntry<int> _displayEnemyHPLevel; public static ConfigEntry<DisplayOptions> _displayEnemyHPOptions; private static ConfigEntry<int> _expLoss; private static Skill _hunting; public static readonly List<string> _CreatureList; private 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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown Hunting.Utils.ConfigurationManagerAttributes configurationManagerAttributes = new Hunting.Utils.ConfigurationManagerAttributes { CustomDrawer = TextBox }; return config(group, name, value, new ConfigDescription(desc, (AcceptableValueBase)null, new object[1] { configurationManagerAttributes }), synchronizedConfig); } private void ConfigWatcher() { FileSystemWatcher fileSystemWatcher = new FileSystemWatcher(Paths.ConfigPath, configFileName); fileSystemWatcher.Changed += OnConfigChanged; fileSystemWatcher.Created += OnConfigChanged; fileSystemWatcher.Renamed += OnConfigChanged; fileSystemWatcher.IncludeSubdirectories = true; fileSystemWatcher.SynchronizingObject = ThreadingHelper.SynchronizingObject; fileSystemWatcher.EnableRaisingEvents = true; } private void OnConfigChanged(object sender, FileSystemEventArgs e) { if (!File.Exists(configFileFullPath)) { return; } try { Logging.LogDebug("OnConfigChanged called.."); ((BaseUnityPlugin)this).Config.Reload(); } catch { Logging.LogError("There was an issue loading your " + configFileName); Logging.LogError("Please check your config entries for spelling and format!"); } } public void Awake() { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Expected O, but got Unknown //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Expected O, but got Unknown //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Expected O, but got Unknown //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Expected O, but got Unknown //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Expected O, but got Unknown //IL_038e: Unknown result type (might be due to invalid IL or missing references) //IL_0399: Expected O, but got Unknown //IL_041b: Unknown result type (might be due to invalid IL or missing references) //IL_0426: Expected O, but got Unknown //IL_04a8: Unknown result type (might be due to invalid IL or missing references) //IL_04b3: Expected O, but got Unknown //IL_0535: Unknown result type (might be due to invalid IL or missing references) //IL_0540: Expected O, but got Unknown //IL_055c: Unknown result type (might be due to invalid IL or missing references) //IL_0567: Expected O, but got Unknown //IL_0583: Unknown result type (might be due to invalid IL or missing references) //IL_058e: Expected O, but got Unknown //IL_05c7: Unknown result type (might be due to invalid IL or missing references) //IL_05d2: Expected O, but got Unknown //IL_05ee: Unknown result type (might be due to invalid IL or missing references) //IL_05f9: Expected O, but got Unknown //IL_0627: Unknown result type (might be due to invalid IL or missing references) //IL_0632: Expected O, but got Unknown //IL_0692: Unknown result type (might be due to invalid IL or missing references) //IL_069d: Expected O, but got Unknown _hunting = new Skill("Hunting", "deericon2.png"); _hunting.Description.English("Increase item yield when hunting wild animals and pins them on the minimap for easy hunting."); _hunting.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); _huntingYieldFactor = config("2- Hunting", "Hunting Yield Factor", 2f, new ConfigDescription("Hunting yield factor at skill level 100.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 5f), Array.Empty<object>())); _detectionRadius = config("2- Hunting", "Detection Radius", 30f, new ConfigDescription("Detection radius for tracking down prey.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 50f), Array.Empty<object>())); _tier1Meadows = config2("3- Hunters Instinct", "Tier1 Meadows", "Deer,Boar,Neck,BOH_Hare_Brown,BOH_Hare_Native,BOH_Hare_DarkGrey,BOH_Hare_Exotic,BOH_Hare_White,Fox_TW", "Prefab names of creatures you want to track in meadows biome.\n(NOTE: You need to logout if you added additional creature while in-game)"); _tier1Meadows.SettingChanged += delegate { FillCreatureList(); }; _tier1MeadowsLevel = config("3- Hunters Instinct", "Tier1 Meadows Level", 10, new ConfigDescription("Required skill level needed to track down prey on meadows biome and pin them on the map.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), new object[1] { new Hunting.Utils.ConfigurationManagerAttributes { ShowRangeAsPercent = false } })); _tier2BlackForest = config2("3- Hunters Instinct", "Tier2 BlackForest", "Razorback_TW,BlackBear_TW", "Prefab names of creatures you want to track in blackforest biomes.\n(NOTE: You need to logout if you added additional creature while in-game)"); _tier2BlackForest.SettingChanged += delegate { FillCreatureList(); }; _tier2BlackForestLevel = config("3- Hunters Instinct", "Tier2 BlackForest Level", 20, new ConfigDescription("Required skill level needed to track down prey on blackforest biome and pin them on the map.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), new object[1] { new Hunting.Utils.ConfigurationManagerAttributes { ShowRangeAsPercent = false } })); _tier3Swamps = config2("3- Hunters Instinct", "Tier3 Swamp", "RottingElk_TW", "Prefab names of creatures you want to track in swamp biome.\n(NOTE: You need to logout if you added additional creature while in-game)"); _tier3Swamps.SettingChanged += delegate { FillCreatureList(); }; _tier3SwampsLevel = config("3- Hunters Instinct", "Tier3 Swamp Level", 30, new ConfigDescription("Required skill level needed to track down prey on swamp biome and pin them on the map.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), new object[1] { new Hunting.Utils.ConfigurationManagerAttributes { ShowRangeAsPercent = false } })); _tier4Mountains = config2("3- Hunters Instinct", "Tier4 Mountain", "Wolf,GrizzlyBear_TW", "Prefab names of creatures you want to track in mountain biome.\n(NOTE: You need to logout if you added additional creature while in-game)"); _tier4Mountains.SettingChanged += delegate { FillCreatureList(); }; _tier4MountainsLevel = config("3- Hunters Instinct", "Tier4 Mountain Level", 40, new ConfigDescription("Required skill level needed to track down prey on mountain biome and pin them on the map.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), new object[1] { new Hunting.Utils.ConfigurationManagerAttributes { ShowRangeAsPercent = false } })); _tier5Plains = config2("3- Hunters Instinct", "Tier5 Plains", "Lox,Prowler_TW", "Prefab names of creatures you want to track in plains biome.\n(NOTE: You need to logout if you added additional creature while in-game)"); _tier5Plains.SettingChanged += delegate { FillCreatureList(); }; _tier5PlainsLevel = config("3- Hunters Instinct", "Tier5 Plains Level", 50, new ConfigDescription("Required skill level needed to track down prey on plains biome and pin them on the map.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), new object[1] { new Hunting.Utils.ConfigurationManagerAttributes { ShowRangeAsPercent = false } })); _tier6Mistlands = config2("3- Hunters Instinct", "Tier6 Mistlands", "Hare", "Prefab names of creatures you want to track in mistlands biome.\n(NOTE: You need to logout if you added additional creature while in-game)"); _tier6Mistlands.SettingChanged += delegate { FillCreatureList(); }; _tier6MistlandsLevel = config("3- Hunters Instinct", "Tier6 Mistlands Level", 60, new ConfigDescription("Required skill level needed to track down prey on mistlands biome and pin them on the map.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), new object[1] { new Hunting.Utils.ConfigurationManagerAttributes { ShowRangeAsPercent = false } })); _tier7Ashlands = config2("3- Hunters Instinct", "Tier7 Ashlands", "AshenScorpid_TW,AshenDimetrodon_TW,AshenDrake_TW,AshenCrab_TW", "Prefab names of creatures you want to track in ashlands biome.\n(NOTE: You need to logout if you added additional creature while in-game)"); _tier7Ashlands.SettingChanged += delegate { FillCreatureList(); }; _tier7AshlandsLevel = config("3- Hunters Instinct", "Tier7 Ashlands Level", 70, new ConfigDescription("Required skill level needed to track down prey on ashlands biome and pin them on the map.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), new object[1] { new Hunting.Utils.ConfigurationManagerAttributes { ShowRangeAsPercent = false } })); _tier8DeepNorth = config2("3- Hunters Instinct", "Tier8 DeepNorth", "ArcticBear_TW,ArcticWolf_TW,ArcticDrake_TW,ArcticSerpent_TW", "Prefab names of creatures you want to track in deepnorth biome.\n(NOTE: You need to logout if you added additional creature while in-game)"); _tier8DeepNorth.SettingChanged += delegate { FillCreatureList(); }; _tier8DeepNorthLevel = config("3- Hunters Instinct", "Tier8 DeepNorth Level", 80, new ConfigDescription("Required skill level needed to track down prey on deepnorth biome and pin them on the map.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), new object[1] { new Hunting.Utils.ConfigurationManagerAttributes { ShowRangeAsPercent = false } })); _displayEnemyHPEnable = config("4- Hunters Vision", "Enable", Toggle.On, new ConfigDescription("If On, creatures health will be displayed in numerical or percentage value.", (AcceptableValueBase)null, Array.Empty<object>())); _displayEnemyHPOptions = config("4- Hunters Vision", "Display Creatures Health In", DisplayOptions.Percentage, new ConfigDescription("Displays creatures health in either numerical or percentage value.", (AcceptableValueBase)null, Array.Empty<object>())); _displayEnemyHPLevel = config("4- Hunters Vision", "Hunters Vision Level", 15, new ConfigDescription("Required skill level needed to display creatures health.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), new object[1] { new Hunting.Utils.ConfigurationManagerAttributes { ShowRangeAsPercent = false } })); _displayExpGained = config("5- Skills Exp", "Display Exp Gain", Toggle.On, new ConfigDescription("Enable/Disable exp gain notification.", (AcceptableValueBase)null, Array.Empty<object>())); _expGainFactor = config("5- Skills Exp", "Exp Gain Factor", 1f, new ConfigDescription("Exp gain factor for Hunting skill.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.01f, 5f), Array.Empty<object>())); _expGainFactor.SettingChanged += delegate { _hunting.SkillGainFactor = _expGainFactor.Value; }; _hunting.SkillGainFactor = _expGainFactor.Value; _expLoss = config("5- Skills Exp", "Exp Loss Amount", 0, new ConfigDescription("Skills exp loss on death.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>())); _expLoss.SettingChanged += delegate { _hunting.SkillLoss = _expLoss.Value; }; _hunting.SkillLoss = _expLoss.Value; FillCreatureList(); Assembly executingAssembly = Assembly.GetExecutingAssembly(); _harmony.PatchAll(executingAssembly); ConfigWatcher(); } private void OnDestroy() { ((BaseUnityPlugin)this).Config.Save(); } private static void FillCreatureList() { _CreatureList.Clear(); string[] array = _tier1Meadows.Value.Split(',', ' '); string[] array2 = _tier2BlackForest.Value.Split(',', ' '); string[] array3 = _tier3Swamps.Value.Split(',', ' '); string[] array4 = _tier4Mountains.Value.Split(',', ' '); string[] array5 = _tier5Plains.Value.Split(',', ' '); string[] array6 = _tier6Mistlands.Value.Split(',', ' '); string[] array7 = _tier7Ashlands.Value.Split(',', ' '); string[] array8 = _tier8DeepNorth.Value.Split(',', ' '); string[] array9; if (array.Length != 0) { array9 = array; foreach (string text in array9) { if (_CreatureList.Contains(text) && !(text == "")) { Logging.LogWarning(text + " already exists. remove the duplicate prefab name."); _CreatureList.Remove(text); } } _CreatureList.AddRange(array); } if (array2.Length != 0) { array9 = array2; foreach (string text2 in array9) { if (_CreatureList.Contains(text2) && !(text2 == "")) { Logging.LogWarning(text2 + " already exists. remove the duplicate prefab name."); _CreatureList.Remove(text2); } } _CreatureList.AddRange(array2); } if (array3.Length != 0) { array9 = array3; foreach (string text3 in array9) { if (_CreatureList.Contains(text3) && !(text3 == "")) { Logging.LogWarning(text3 + " already exists. remove the duplicate prefab name."); _CreatureList.Remove(text3); } } _CreatureList.AddRange(array3); } if (array4.Length != 0) { array9 = array4; foreach (string text4 in array9) { if (_CreatureList.Contains(text4) && !(text4 == "")) { Logging.LogWarning(text4 + " already exists. remove the duplicate prefab name."); _CreatureList.Remove(text4); } } _CreatureList.AddRange(array4); } if (array5.Length != 0) { array9 = array5; foreach (string text5 in array9) { if (_CreatureList.Contains(text5) && !(text5 == "")) { Logging.LogWarning(text5 + " already exists. remove the duplicate prefab name."); _CreatureList.Remove(text5); } } _CreatureList.AddRange(array5); } if (array6.Length != 0) { array9 = array6; foreach (string text6 in array9) { if (_CreatureList.Contains(text6) && !(text6 == "")) { Logging.LogWarning(text6 + " already exists. remove the duplicate prefab name."); _CreatureList.Remove(text6); } } _CreatureList.AddRange(array6); } if (array7.Length != 0) { array9 = array7; foreach (string text7 in array9) { if (_CreatureList.Contains(text7) && !(text7 == "")) { Logging.LogWarning(text7 + " already exists. remove the duplicate prefab name."); _CreatureList.Remove(text7); } } _CreatureList.AddRange(array7); } if (array8.Length == 0) { return; } array9 = array8; foreach (string text8 in array9) { if (_CreatureList.Contains(text8) && !(text8 == "")) { Logging.LogWarning(text8 + " already exists. remove the duplicate prefab name."); _CreatureList.Remove(text8); } } _CreatureList.AddRange(array8); } private static void TextBox(ConfigEntryBase entryBase) { entryBase.BoxedValue = GUILayout.TextArea((string)entryBase.BoxedValue, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true) }); } static Plugin() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown string configPath = Paths.ConfigPath; char directorySeparatorChar = Path.DirectorySeparatorChar; configFileFullPath = configPath + directorySeparatorChar + configFileName; _harmony = new Harmony("blacks7ar.Hunting"); _configSync = new ConfigSync("blacks7ar.Hunting") { DisplayName = "Hunting", CurrentVersion = "1.3.1", MinimumRequiredVersion = "1.3.1" }; _CreatureList = new List<string>(); } } } namespace Hunting.Utils { public class ConfigurationManagerAttributes { [UsedImplicitly] public bool? ShowRangeAsPercent; [UsedImplicitly] public int? Order; [UsedImplicitly] public bool? Browsable; [UsedImplicitly] public string Category; [UsedImplicitly] public Action<ConfigEntryBase> CustomDrawer; } public static class Helper { public static readonly IDictionary<string, Sprite> _Tier1Icons = new Dictionary<string, Sprite>(); public static readonly IDictionary<string, Sprite> _Tier2Icons = new Dictionary<string, Sprite>(); public static readonly IDictionary<string, Sprite> _Tier3Icons = new Dictionary<string, Sprite>(); public static readonly IDictionary<string, Sprite> _Tier4Icons = new Dictionary<string, Sprite>(); public static readonly IDictionary<string, Sprite> _Tier5Icons = new Dictionary<string, Sprite>(); public static readonly IDictionary<string, Sprite> _Tier6Icons = new Dictionary<string, Sprite>(); public static readonly IDictionary<string, Sprite> _Tier7Icons = new Dictionary<string, Sprite>(); public static readonly IDictionary<string, Sprite> _Tier8Icons = new Dictionary<string, Sprite>(); public static float tFloat(this float value, int digits) { double num = Math.Pow(10.0, digits); return (float)(Math.Truncate(num * (double)value) / num); } private static string TrackPrey(string prey, string track) { Match match = new Regex(track, RegexOptions.IgnoreCase).Match(prey); if (!match.Success) { return ""; } return match.Value; } public static void GetTier1PinIcons(string prey) { if (_Tier1Icons.ContainsKey(prey)) { return; } foreach (string key in ObjectDBPatch._SpritesDictTier1.Keys) { if (!(TrackPrey(prey, key) == "")) { _Tier1Icons.Add(prey, ObjectDBPatch._SpritesDictTier1[key]); break; } } } public static void GetTier2PinIcons(string prey) { if (_Tier2Icons.ContainsKey(prey)) { return; } foreach (string key in ObjectDBPatch._SpritesDictTier2.Keys) { if (!(TrackPrey(prey, key) == "")) { _Tier2Icons.Add(prey, ObjectDBPatch._SpritesDictTier2[key]); break; } } } public static void GetTier3PinIcons(string prey) { if (_Tier3Icons.ContainsKey(prey)) { return; } foreach (string key in ObjectDBPatch._SpritesDictTier3.Keys) { if (!(TrackPrey(prey, key) == "")) { _Tier3Icons.Add(prey, ObjectDBPatch._SpritesDictTier3[key]); break; } } } public static void GetTier4PinIcons(string prey) { if (_Tier4Icons.ContainsKey(prey)) { return; } foreach (string key in ObjectDBPatch._SpritesDictTier4.Keys) { if (!(TrackPrey(prey, key) == "")) { _Tier4Icons.Add(prey, ObjectDBPatch._SpritesDictTier4[key]); break; } } } public static void GetTier5PinIcons(string prey) { if (_Tier5Icons.ContainsKey(prey)) { return; } foreach (string key in ObjectDBPatch._SpritesDictTier5.Keys) { if (!(TrackPrey(prey, key) == "")) { _Tier5Icons.Add(prey, ObjectDBPatch._SpritesDictTier5[key]); break; } } } public static void GetTier6PinIcons(string prey) { if (_Tier6Icons.ContainsKey(prey)) { return; } foreach (string key in ObjectDBPatch._SpritesDictTier6.Keys) { if (!(TrackPrey(prey, key) == "")) { _Tier6Icons.Add(prey, ObjectDBPatch._SpritesDictTier6[key]); break; } } } public static void GetTier7PinIcons(string prey) { if (_Tier7Icons.ContainsKey(prey)) { return; } foreach (string key in ObjectDBPatch._SpritesDictTier7.Keys) { if (!(TrackPrey(prey, key) == "")) { _Tier7Icons.Add(prey, ObjectDBPatch._SpritesDictTier7[key]); break; } } } public static void GetTier8PinIcons(string prey) { if (_Tier8Icons.ContainsKey(prey)) { return; } foreach (string key in ObjectDBPatch._SpritesDictTier8.Keys) { if (!(TrackPrey(prey, key) == "")) { _Tier8Icons.Add(prey, ObjectDBPatch._SpritesDictTier8[key]); break; } } } } public static class Logging { private static readonly ManualLogSource HLogger = Logger.CreateLogSource("Hunting"); public static void LogDebug(string debug) { HLogger.LogDebug((object)debug); } public static void LogError(string error) { HLogger.LogError((object)error); } public static void LogInfo(string info) { HLogger.LogInfo((object)info); } public static void LogWarning(string warning) { HLogger.LogWarning((object)warning); } } public class Tier2Tracker : MonoBehaviour { private string m_preyName; private Vector2 m_trackRange; private Sprite m_pinIcon; private PinData m_pinData; public void Create(string preyName, float trackRange, Sprite icon) { //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) m_preyName = preyName; m_trackRange = new Vector2(trackRange, trackRange + 10f); m_pinIcon = icon; m_pinData = null; } private void Update() { //IL_0015: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if (Object.op_Implicit((Object)(object)localPlayer)) { Vector2 val = Vector2.op_Implicit(((Component)localPlayer).transform.position - ((Component)this).transform.position); float skillFactor = ((Character)(object)localPlayer).GetSkillFactor("Hunting"); if (m_pinData == null && ((Vector2)(ref val)).magnitude < m_trackRange.x && Plugin._tier2BlackForestLevel.Value > 0 && skillFactor >= (float)Plugin._tier2BlackForestLevel.Value / 100f) { m_pinData = Minimap.instance.AddPin(((Component)this).transform.position, (PinType)8, m_preyName, false, false, 0L, ""); m_pinData.m_icon = m_pinIcon; m_pinData.m_worldSize = 0f; } else if (m_pinData != null && ((Vector2)(ref val)).magnitude > m_trackRange.y) { Minimap.instance.RemovePin(m_pinData); m_pinData = null; } else if (m_pinData != null && (Plugin._tier2BlackForestLevel.Value <= 0 || (float)Plugin._tier2BlackForestLevel.Value / 100f > skillFactor)) { Minimap.instance.RemovePin(m_pinData); m_pinData = null; } else if (m_pinData != null && !Plugin._CreatureList.Contains(((Object)((Component)this).gameObject).name.Replace("(Clone)", ""))) { Minimap.instance.RemovePin(m_pinData); m_pinData = null; } if (m_pinData != null) { m_pinData.m_pos = ((Component)this).transform.position; } } } private void OnDestroy() { if (m_pinData == null) { return; } try { Minimap.instance.RemovePin(m_pinData); m_pinData = null; } catch { } } } public class Tier3Tracker : MonoBehaviour { private string m_preyName; private Vector2 m_trackRange; private Sprite m_pinIcon; private PinData m_pinData; public void Create(string preyName, float trackRange, Sprite icon) { //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) m_preyName = preyName; m_trackRange = new Vector2(trackRange, trackRange + 10f); m_pinIcon = icon; m_pinData = null; } private void Update() { //IL_0015: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if (Object.op_Implicit((Object)(object)localPlayer)) { Vector2 val = Vector2.op_Implicit(((Component)localPlayer).transform.position - ((Component)this).transform.position); float skillFactor = ((Character)(object)localPlayer).GetSkillFactor("Hunting"); if (m_pinData == null && ((Vector2)(ref val)).magnitude < m_trackRange.x && Plugin._tier3SwampsLevel.Value > 0 && skillFactor >= (float)Plugin._tier3SwampsLevel.Value / 100f) { m_pinData = Minimap.instance.AddPin(((Component)this).transform.position, (PinType)8, m_preyName, false, false, 0L, ""); m_pinData.m_icon = m_pinIcon; m_pinData.m_worldSize = 0f; } else if (m_pinData != null && ((Vector2)(ref val)).magnitude > m_trackRange.y) { Minimap.instance.RemovePin(m_pinData); m_pinData = null; } else if (m_pinData != null && (Plugin._tier3SwampsLevel.Value <= 0 || (float)Plugin._tier3SwampsLevel.Value / 100f > skillFactor)) { Minimap.instance.RemovePin(m_pinData); m_pinData = null; } else if (m_pinData != null && !Plugin._CreatureList.Contains(((Object)((Component)this).gameObject).name.Replace("(Clone)", ""))) { Minimap.instance.RemovePin(m_pinData); m_pinData = null; } if (m_pinData != null) { m_pinData.m_pos = ((Component)this).transform.position; } } } private void OnDestroy() { if (m_pinData == null) { return; } try { Minimap.instance.RemovePin(m_pinData); m_pinData = null; } catch { } } } public class Tier4Tracker : MonoBehaviour { private string m_preyName; private Vector2 m_trackRange; private Sprite m_pinIcon; private PinData m_pinData; public void Create(string preyName, float trackRange, Sprite icon) { //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) m_preyName = preyName; m_trackRange = new Vector2(trackRange, trackRange + 10f); m_pinIcon = icon; m_pinData = null; } private void Update() { //IL_0015: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if (Object.op_Implicit((Object)(object)localPlayer)) { Vector2 val = Vector2.op_Implicit(((Component)localPlayer).transform.position - ((Component)this).transform.position); float skillFactor = ((Character)(object)localPlayer).GetSkillFactor("Hunting"); if (m_pinData == null && ((Vector2)(ref val)).magnitude < m_trackRange.x && Plugin._tier4MountainsLevel.Value > 0 && skillFactor >= (float)Plugin._tier4MountainsLevel.Value / 100f) { m_pinData = Minimap.instance.AddPin(((Component)this).transform.position, (PinType)8, m_preyName, false, false, 0L, ""); m_pinData.m_icon = m_pinIcon; m_pinData.m_worldSize = 0f; } else if (m_pinData != null && ((Vector2)(ref val)).magnitude > m_trackRange.y) { Minimap.instance.RemovePin(m_pinData); m_pinData = null; } else if (m_pinData != null && (Plugin._tier4MountainsLevel.Value <= 0 || (float)Plugin._tier4MountainsLevel.Value / 100f > skillFactor)) { Minimap.instance.RemovePin(m_pinData); m_pinData = null; } else if (m_pinData != null && !Plugin._CreatureList.Contains(((Object)((Component)this).gameObject).name.Replace("(Clone)", ""))) { Minimap.instance.RemovePin(m_pinData); m_pinData = null; } if (m_pinData != null) { m_pinData.m_pos = ((Component)this).transform.position; } } } private void OnDestroy() { if (m_pinData == null) { return; } try { Minimap.instance.RemovePin(m_pinData); m_pinData = null; } catch { } } } public class Tier5Tracker : MonoBehaviour { private string m_preyName; private Vector2 m_trackRange; private Sprite m_pinIcon; private PinData m_pinData; public void Create(string preyName, float trackRange, Sprite icon) { //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) m_preyName = preyName; m_trackRange = new Vector2(trackRange, trackRange + 10f); m_pinIcon = icon; m_pinData = null; } private void Update() { //IL_0015: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if (Object.op_Implicit((Object)(object)localPlayer)) { Vector2 val = Vector2.op_Implicit(((Component)localPlayer).transform.position - ((Component)this).transform.position); float skillFactor = ((Character)(object)localPlayer).GetSkillFactor("Hunting"); if (m_pinData == null && ((Vector2)(ref val)).magnitude < m_trackRange.x && Plugin._tier5PlainsLevel.Value > 0 && skillFactor >= (float)Plugin._tier5PlainsLevel.Value / 100f) { m_pinData = Minimap.instance.AddPin(((Component)this).transform.position, (PinType)8, m_preyName, false, false, 0L, ""); m_pinData.m_icon = m_pinIcon; m_pinData.m_worldSize = 0f; } else if (m_pinData != null && ((Vector2)(ref val)).magnitude > m_trackRange.y) { Minimap.instance.RemovePin(m_pinData); m_pinData = null; } else if (m_pinData != null && (Plugin._tier5PlainsLevel.Value <= 0 || (float)Plugin._tier5PlainsLevel.Value / 100f > skillFactor)) { Minimap.instance.RemovePin(m_pinData); m_pinData = null; } else if (m_pinData != null && !Plugin._CreatureList.Contains(((Object)((Component)this).gameObject).name.Replace("(Clone)", ""))) { Minimap.instance.RemovePin(m_pinData); m_pinData = null; } if (m_pinData != null) { m_pinData.m_pos = ((Component)this).transform.position; } } } private void OnDestroy() { if (m_pinData == null) { return; } try { Minimap.instance.RemovePin(m_pinData); m_pinData = null; } catch { } } } public class Tier6Tracker : MonoBehaviour { private string m_preyName; private Vector2 m_trackRange; private Sprite m_pinIcon; private PinData m_pinData; public void Create(string preyName, float trackRange, Sprite icon) { //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) m_preyName = preyName; m_trackRange = new Vector2(trackRange, trackRange + 10f); m_pinIcon = icon; m_pinData = null; } private void Update() { //IL_0015: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if (Object.op_Implicit((Object)(object)localPlayer)) { Vector2 val = Vector2.op_Implicit(((Component)localPlayer).transform.position - ((Component)this).transform.position); float skillFactor = ((Character)(object)localPlayer).GetSkillFactor("Hunting"); if (m_pinData == null && ((Vector2)(ref val)).magnitude < m_trackRange.x && Plugin._tier6MistlandsLevel.Value > 0 && skillFactor >= (float)Plugin._tier6MistlandsLevel.Value / 100f) { m_pinData = Minimap.instance.AddPin(((Component)this).transform.position, (PinType)8, m_preyName, false, false, 0L, ""); m_pinData.m_icon = m_pinIcon; m_pinData.m_worldSize = 0f; } else if (m_pinData != null && ((Vector2)(ref val)).magnitude > m_trackRange.y) { Minimap.instance.RemovePin(m_pinData); m_pinData = null; } else if (m_pinData != null && (Plugin._tier6MistlandsLevel.Value <= 0 || (float)Plugin._tier6MistlandsLevel.Value / 100f > skillFactor)) { Minimap.instance.RemovePin(m_pinData); m_pinData = null; } else if (m_pinData != null && !Plugin._CreatureList.Contains(((Object)((Component)this).gameObject).name.Replace("(Clone)", ""))) { Minimap.instance.RemovePin(m_pinData); m_pinData = null; } if (m_pinData != null) { m_pinData.m_pos = ((Component)this).transform.position; } } } private void OnDestroy() { if (m_pinData == null) { return; } try { Minimap.instance.RemovePin(m_pinData); m_pinData = null; } catch { } } } public class Tier7Tracker : MonoBehaviour { private string m_preyName; private Vector2 m_trackRange; private Sprite m_pinIcon; private PinData m_pinData; public void Create(string preyName, float trackRange, Sprite icon) { //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) m_preyName = preyName; m_trackRange = new Vector2(trackRange, trackRange + 10f); m_pinIcon = icon; m_pinData = null; } private void Update() { //IL_0015: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if (Object.op_Implicit((Object)(object)localPlayer)) { Vector2 val = Vector2.op_Implicit(((Component)localPlayer).transform.position - ((Component)this).transform.position); float skillFactor = ((Character)(object)localPlayer).GetSkillFactor("Hunting"); if (m_pinData == null && ((Vector2)(ref val)).magnitude < m_trackRange.x && Plugin._tier7AshlandsLevel.Value > 0 && skillFactor >= (float)Plugin._tier7AshlandsLevel.Value / 100f) { m_pinData = Minimap.instance.AddPin(((Component)this).transform.position, (PinType)8, m_preyName, false, false, 0L, ""); m_pinData.m_icon = m_pinIcon; m_pinData.m_worldSize = 0f; } else if (m_pinData != null && ((Vector2)(ref val)).magnitude > m_trackRange.y) { Minimap.instance.RemovePin(m_pinData); m_pinData = null; } else if (m_pinData != null && (Plugin._tier7AshlandsLevel.Value <= 0 || (float)Plugin._tier7AshlandsLevel.Value / 100f > skillFactor)) { Minimap.instance.RemovePin(m_pinData); m_pinData = null; } else if (m_pinData != null && !Plugin._CreatureList.Contains(((Object)((Component)this).gameObject).name.Replace("(Clone)", ""))) { Minimap.instance.RemovePin(m_pinData); m_pinData = null; } if (m_pinData != null) { m_pinData.m_pos = ((Component)this).transform.position; } } } private void OnDestroy() { if (m_pinData == null) { return; } try { Minimap.instance.RemovePin(m_pinData); m_pinData = null; } catch { } } } public class Tier8Tracker : MonoBehaviour { private string m_preyName; private Vector2 m_trackRange; private Sprite m_pinIcon; private PinData m_pinData; public void Create(string preyName, float trackRange, Sprite icon) { //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) m_preyName = preyName; m_trackRange = new Vector2(trackRange, trackRange + 10f); m_pinIcon = icon; m_pinData = null; } private void Update() { //IL_0015: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if (Object.op_Implicit((Object)(object)localPlayer)) { Vector2 val = Vector2.op_Implicit(((Component)localPlayer).transform.position - ((Component)this).transform.position); float skillFactor = ((Character)(object)localPlayer).GetSkillFactor("Hunting"); if (m_pinData == null && ((Vector2)(ref val)).magnitude < m_trackRange.x && Plugin._tier8DeepNorthLevel.Value > 0 && skillFactor >= (float)Plugin._tier8DeepNorthLevel.Value / 100f) { m_pinData = Minimap.instance.AddPin(((Component)this).transform.position, (PinType)8, m_preyName, false, false, 0L, ""); m_pinData.m_icon = m_pinIcon; m_pinData.m_worldSize = 0f; } else if (m_pinData != null && ((Vector2)(ref val)).magnitude > m_trackRange.y) { Minimap.instance.RemovePin(m_pinData); m_pinData = null; } else if (m_pinData != null && (Plugin._tier8DeepNorthLevel.Value <= 0 || (float)Plugin._tier8DeepNorthLevel.Value / 100f > skillFactor)) { Minimap.instance.RemovePin(m_pinData); m_pinData = null; } else if (m_pinData != null && !Plugin._CreatureList.Contains(((Object)((Component)this).gameObject).name.Replace("(Clone)", ""))) { Minimap.instance.RemovePin(m_pinData); m_pinData = null; } if (m_pinData != null) { m_pinData.m_pos = ((Component)this).transform.position; } } } private void OnDestroy() { if (m_pinData == null) { return; } try { Minimap.instance.RemovePin(m_pinData); m_pinData = null; } catch { } } } public enum Toggle { On = 1, Off = 0 } public class Tier1Tracker : MonoBehaviour { private string m_preyName; private Vector2 m_trackRange; private Sprite m_pinIcon; private PinData m_pinData; public void Create(string preyName, float trackRange, Sprite icon) { //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) m_preyName = preyName; m_trackRange = new Vector2(trackRange, trackRange + 10f); m_pinIcon = icon; m_pinData = null; } private void Update() { //IL_0015: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if (Object.op_Implicit((Object)(object)localPlayer)) { Vector2 val = Vector2.op_Implicit(((Component)localPlayer).transform.position - ((Component)this).transform.position); float skillFactor = ((Character)(object)localPlayer).GetSkillFactor("Hunting"); if (m_pinData == null && ((Vector2)(ref val)).magnitude < m_trackRange.x && Plugin._tier1MeadowsLevel.Value > 0 && skillFactor >= (float)Plugin._tier1MeadowsLevel.Value / 100f) { m_pinData = Minimap.instance.AddPin(((Component)this).transform.position, (PinType)8, m_preyName, false, false, 0L, ""); m_pinData.m_icon = m_pinIcon; m_pinData.m_worldSize = 0f; } else if (m_pinData != null && ((Vector2)(ref val)).magnitude > m_trackRange.y) { Minimap.instance.RemovePin(m_pinData); m_pinData = null; } else if (m_pinData != null && (Plugin._tier1MeadowsLevel.Value <= 0 || (float)Plugin._tier1MeadowsLevel.Value / 100f > skillFactor)) { Minimap.instance.RemovePin(m_pinData); m_pinData = null; } else if (m_pinData != null && !Plugin._CreatureList.Contains(((Object)((Component)this).gameObject).name.Replace("(Clone)", ""))) { Minimap.instance.RemovePin(m_pinData); m_pinData = null; } if (m_pinData != null) { m_pinData.m_pos = ((Component)this).transform.position; } } } private void OnDestroy() { if (m_pinData == null) { return; } try { Minimap.instance.RemovePin(m_pinData); m_pinData = null; } catch { } } } } namespace Hunting.Patches { [HarmonyPatch(typeof(CharacterDrop), "GenerateDropList")] public class CharacterDropPatch { [HarmonyPriority(100)] [UsedImplicitly] private static void Postfix(CharacterDrop __instance, ref List<KeyValuePair<GameObject, int>> __result) { if (!CharacterPatch._isHunting || (Object)(object)__instance.m_character == (Object)null || (Object)(object)Player.m_localPlayer == (Object)null || !CharacterPatch.IsPrey(__instance.m_character)) { return; } List<KeyValuePair<GameObject, int>> list = new List<KeyValuePair<GameObject, int>>(); int num = ((!Object.op_Implicit((Object)(object)__instance.m_character)) ? 1 : Mathf.Max(1, (int)Mathf.Pow(2f, (float)(__instance.m_character.GetLevel() - 1)))); foreach (Drop drop in __instance.m_drops) { if ((Object)(object)drop.m_prefab == (Object)null) { continue; } float num2 = drop.m_chance; if (drop.m_levelMultiplier) { num2 *= (float)num; } if (Random.value <= num2) { int num3 = Random.Range(drop.m_amountMin, drop.m_amountMax); if (drop.m_levelMultiplier) { num3 *= num; } if (drop.m_onePerPlayer) { num3 = ZNet.instance.GetNrOfPlayers(); } if (num3 > 0) { int num4 = new Random().Next(1, 100); ((Character)Player.m_localPlayer).GetSkills().m_skillData.TryGetValue((SkillType)Mathf.Abs(StringExtensionMethods.GetStableHashCode("Hunting")), out var value); if ((float)num4 <= value?.m_level) { float num5 = Plugin._huntingYieldFactor.Value + Plugin._huntingYieldFactor.Value * ((Character)(object)Player.m_localPlayer).GetSkillFactor("Hunting"); float num6 = (float)num3 * num5 - Random.Range(0f, 1f); list.Add(new KeyValuePair<GameObject, int>(drop.m_prefab, (int)((num6 >= 25f) ? 25f : num6))); } else { list.Add(new KeyValuePair<GameObject, int>(drop.m_prefab, num3)); } } } __result = list; } } } [HarmonyPatch] public class CharacterPatch { public static bool _isHunting; [HarmonyPatch(typeof(Character), "RPC_Damage")] [HarmonyPrefix] private static void RpcDamage_Prefix(Character __instance, HitData hit) { //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) Character attacker = hit.GetAttacker(); Player val = (Player)(object)((attacker is Player) ? attacker : null); if (val != null && ((Humanoid)val).GetCurrentWeapon() != null && ((Humanoid)val).GetCurrentWeapon() != ((Humanoid)val).m_unarmedWeapon.m_itemData && IsUsingHuntingWeapon(val) && IsPrey(__instance)) { _isHunting = true; ((Character)val).GetSkills().m_skillData.TryGetValue((SkillType)Mathf.Abs(StringExtensionMethods.GetStableHashCode("Hunting")), out var value); string value2 = ((Object)((Component)__instance).gameObject).name.Replace("(Clone)", ""); string[] source = Plugin._tier1Meadows.Value.Split(',', ' '); if (value != null && value.m_level > 10f) { ((Character)val).RaiseSkill(Skill.fromName("Hunting"), source.Contains(value2) ? 0.8f : 1f); } else if (value != null && value.m_level > 20f) { ((Character)val).RaiseSkill(Skill.fromName("Hunting"), source.Contains(value2) ? 0.5f : 1f); } else if (value != null && value.m_level > 30f) { ((Character)val).RaiseSkill(Skill.fromName("Hunting"), source.Contains(value2) ? 0.2f : 1f); } else { ((Character)val).RaiseSkill(Skill.fromName("Hunting"), 1f); } } } [HarmonyPatch(typeof(Character), "Awake")] [HarmonyPostfix] private static void Awake_Postfix(Character __instance) { AddTier1Tracker(((Component)__instance).gameObject); AddTier2Tracker(((Component)__instance).gameObject); AddTier3Tracker(((Component)__instance).gameObject); AddTier4Tracker(((Component)__instance).gameObject); AddTier5Tracker(((Component)__instance).gameObject); AddTier6Tracker(((Component)__instance).gameObject); AddTier7Tracker(((Component)__instance).gameObject); AddTier8Tracker(((Component)__instance).gameObject); } private static void AddTier1Tracker(GameObject gameObject) { string name = ((Object)gameObject).name; string preyName = Localization.instance.Localize(gameObject.GetComponent<Character>().m_name); Helper.GetTier1PinIcons(name); if (Helper._Tier1Icons.TryGetValue(name, out var value)) { gameObject.AddComponent<Tier1Tracker>().Create(preyName, Plugin._detectionRadius.Value, value); } } private static void AddTier2Tracker(GameObject gameObject) { string name = ((Object)gameObject).name; string preyName = Localization.instance.Localize(gameObject.GetComponent<Character>().m_name); Helper.GetTier2PinIcons(name); if (Helper._Tier2Icons.TryGetValue(name, out var value)) { gameObject.AddComponent<Tier2Tracker>().Create(preyName, Plugin._detectionRadius.Value, value); } } private static void AddTier3Tracker(GameObject gameObject) { string name = ((Object)gameObject).name; string preyName = Localization.instance.Localize(gameObject.GetComponent<Character>().m_name); Helper.GetTier3PinIcons(name); if (Helper._Tier3Icons.TryGetValue(name, out var value)) { gameObject.AddComponent<Tier3Tracker>().Create(preyName, Plugin._detectionRadius.Value, value); } } private static void AddTier4Tracker(GameObject gameObject) { string name = ((Object)gameObject).name; string preyName = Localization.instance.Localize(gameObject.GetComponent<Character>().m_name); Helper.GetTier4PinIcons(name); if (Helper._Tier4Icons.TryGetValue(name, out var value)) { gameObject.AddComponent<Tier4Tracker>().Create(preyName, Plugin._detectionRadius.Value, value); } } private static void AddTier5Tracker(GameObject gameObject) { string name = ((Object)gameObject).name; string preyName = Localization.instance.Localize(gameObject.GetComponent<Character>().m_name); Helper.GetTier5PinIcons(name); if (Helper._Tier5Icons.TryGetValue(name, out var value)) { gameObject.AddComponent<Tier5Tracker>().Create(preyName, Plugin._detectionRadius.Value, value); } } private static void AddTier6Tracker(GameObject gameObject) { string name = ((Object)gameObject).name; string preyName = Localization.instance.Localize(gameObject.GetComponent<Character>().m_name); Helper.GetTier6PinIcons(name); if (Helper._Tier6Icons.TryGetValue(name, out var value)) { gameObject.AddComponent<Tier6Tracker>().Create(preyName, Plugin._detectionRadius.Value, value); } } private static void AddTier7Tracker(GameObject gameObject) { string name = ((Object)gameObject).name; string preyName = Localization.instance.Localize(gameObject.GetComponent<Character>().m_name); Helper.GetTier7PinIcons(name); if (Helper._Tier7Icons.TryGetValue(name, out var value)) { gameObject.AddComponent<Tier7Tracker>().Create(preyName, Plugin._detectionRadius.Value, value); } } private static void AddTier8Tracker(GameObject gameObject) { string name = ((Object)gameObject).name; string preyName = Localization.instance.Localize(gameObject.GetComponent<Character>().m_name); Helper.GetTier8PinIcons(name); if (Helper._Tier8Icons.TryGetValue(name, out var value)) { gameObject.AddComponent<Tier8Tracker>().Create(preyName, Plugin._detectionRadius.Value, value); } } public static bool IsPrey(Character character) { string[] source = Plugin._CreatureList.ToArray(); string text = ((Object)character).name.Replace("(Clone)", ""); return source.Any((string name) => text == name); } private static bool IsUsingHuntingWeapon(Player player) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Invalid comparison between Unknown and I4 //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Invalid comparison between Unknown and I4 //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Invalid comparison between Unknown and I4 //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Invalid comparison between Unknown and I4 //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Invalid comparison between Unknown and I4 SkillType skillType = ((Humanoid)player).GetCurrentWeapon().m_shared.m_skillType; if ((int)skillType <= 5) { if ((int)skillType == 2 || (int)skillType == 5) { goto IL_0028; } } else if ((int)skillType == 8 || (int)skillType == 14) { goto IL_0028; } return false; IL_0028: return true; } } [HarmonyPatch] public class EnemyHudPatch { private static readonly ConditionalWeakTable<HudData, TMP_Text> HpText = new ConditionalWeakTable<HudData, TMP_Text>(); [HarmonyPrefix] [HarmonyPatch(typeof(EnemyHud), "ShowHud")] private static void ShowHud_Prefix(ref EnemyHud __instance, ref Character c, ref bool __state) { __state = __instance.m_huds.ContainsKey(c); } [HarmonyPostfix] [HarmonyPatch(typeof(EnemyHud), "ShowHud")] private static void ShowHud_Postfix(ref EnemyHud __instance, ref Character c, ref bool __state) { //IL_0125: 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_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) if (!__state && __instance.m_huds.TryGetValue(c, out var value) && !c.IsPlayer() && !((Object)(object)c == (Object)null) && !((Object)(object)Player.m_localPlayer == (Object)null) && !((Object)(object)c == (Object)(object)Player.m_localPlayer) && Plugin._displayEnemyHPEnable.Value != 0 && Plugin._displayEnemyHPLevel.Value > 0 && ((Character)(object)Player.m_localPlayer).GetSkillFactor("Hunting") >= (float)Plugin._displayEnemyHPLevel.Value / 100f) { TMP_Text val = (TMP_Text)(object)Object.Instantiate<TextMeshProUGUI>(value.m_name, ((TMP_Text)value.m_name).transform.parent); ((Object)val).name = "enemyHPText"; switch (Plugin._displayEnemyHPOptions.Value) { case Plugin.DisplayOptions.Numerical: { float health = value.m_character.GetHealth(); float maxHealth = value.m_character.GetMaxHealth(); val.text = $"{health:0}/{maxHealth:0}"; break; } case Plugin.DisplayOptions.Percentage: { float healthPercentage = value.m_character.GetHealthPercentage(); val.text = $"{Mathf.FloorToInt(healthPercentage * 100f)}%"; break; } } ((Graphic)val).color = Color.white; if (c.IsBoss()) { val.rectTransform.anchoredPosition = new Vector2(val.rectTransform.anchoredPosition.x, -7f); val.fontSizeMax = 17f; val.fontSizeMin = 10f; } else { val.rectTransform.anchoredPosition = new Vector2(val.rectTransform.anchoredPosition.x, 6f); val.fontSizeMax = 13f; val.fontSizeMin = 7f; } HpText.Add(value, val); } } [HarmonyPatch(typeof(EnemyHud), "UpdateHuds")] [HarmonyPostfix] private static void UpdateHuds_Postfix(ref EnemyHud __instance) { Character val = null; foreach (HudData item in __instance.m_huds.Select((KeyValuePair<Character, HudData> hud) => hud.Value)) { if (!Object.op_Implicit((Object)(object)item.m_character) || !__instance.TestShow(item.m_character, true)) { if ((Object)(object)val == (Object)null) { val = item.m_character; Object.Destroy((Object)(object)item.m_gui); } continue; } if (item.m_character.IsPlayer()) { return; } if (!HpText.TryGetValue(item, out var value)) { continue; } if ((Object)(object)item.m_character == (Object)null || (Object)(object)Player.m_localPlayer == (Object)null || (Object)(object)item.m_character == (Object)(object)Player.m_localPlayer) { return; } if (Plugin._displayEnemyHPEnable.Value == Toggle.On && Plugin._displayEnemyHPLevel.Value > 0 && ((Character)(object)Player.m_localPlayer).GetSkillFactor("Hunting") >= (float)Plugin._displayEnemyHPLevel.Value / 100f) { switch (Plugin._displayEnemyHPOptions.Value) { case Plugin.DisplayOptions.Numerical: { float health = item.m_character.GetHealth(); float maxHealth = item.m_character.GetMaxHealth(); value.text = $"{health:0}/{maxHealth:0}"; break; } case Plugin.DisplayOptions.Percentage: { float healthPercentage = item.m_character.GetHealthPercentage(); value.text = $"{Mathf.FloorToInt(healthPercentage * 100f)}%"; break; } } } else if (Plugin._displayEnemyHPEnable.Value == Toggle.Off || Plugin._displayEnemyHPLevel.Value <= 0 || !(((Character)(object)Player.m_localPlayer).GetSkillFactor("Hunting") >= (float)Plugin._displayEnemyHPLevel.Value / 100f)) { value.text = ""; } } if ((Object)(object)val != (Object)null) { __instance.m_huds.Remove(val); } } } [HarmonyPatch(typeof(ObjectDB), "UpdateItemHashes")] public class ObjectDBPatch { public static readonly IDictionary<string, Sprite> _SpritesDictTier1 = new Dictionary<string, Sprite>(); public static readonly IDictionary<string, Sprite> _SpritesDictTier2 = new Dictionary<string, Sprite>(); public static readonly IDictionary<string, Sprite> _SpritesDictTier3 = new Dictionary<string, Sprite>(); public static readonly IDictionary<string, Sprite> _SpritesDictTier4 = new Dictionary<string, Sprite>(); public static readonly IDictionary<string, Sprite> _SpritesDictTier5 = new Dictionary<string, Sprite>(); public static readonly IDictionary<string, Sprite> _SpritesDictTier6 = new Dictionary<string, Sprite>(); public static readonly IDictionary<string, Sprite> _SpritesDictTier7 = new Dictionary<string, Sprite>(); public static readonly IDictionary<string, Sprite> _SpritesDictTier8 = new Dictionary<string, Sprite>(); private static void Postfix(ObjectDB __instance) { GetTier1Sprites(__instance); GetTier2Sprites(__instance); GetTier3Sprites(__instance); GetTier4Sprites(__instance); GetTier5Sprites(__instance); GetTier6Sprites(__instance); GetTier7Sprites(__instance); GetTier8Sprites(__instance); } private static void GetTier1Sprites(ObjectDB objectDB) { _SpritesDictTier1.Clear(); string[] array = Plugin._tier1Meadows.Value.Split(',', ' '); ZNetScene instance = ZNetScene.instance; if (!Object.op_Implicit((Object)(object)instance) || instance.m_prefabs.Count <= 0) { return; } string[] array2 = array; foreach (string text in array2) { string text2 = text; GameObject prefab = instance.GetPrefab(StringExtensionMethods.GetStableHashCode(text)); if ((Object)(object)prefab == (Object)null) { continue; } CharacterDrop component = prefab.GetComponent<CharacterDrop>(); if ((Object)(object)component != (Object)null) { foreach (Drop drop in component.m_drops) { text2 = (((Object)drop.m_prefab).name.ToLower().Contains("trophy") ? ((Object)drop.m_prefab).name : ((Object)component.m_drops[0].m_prefab).name); } } GameObject itemPrefab = objectDB.GetItemPrefab(StringExtensionMethods.GetStableHashCode(text2)); if ((Object)(object)itemPrefab == (Object)null) { continue; } ItemDrop component2 = itemPrefab.GetComponent<ItemDrop>(); if ((Object)(object)component2 != (Object)null) { _SpritesDictTier1.Add(text, component2.m_itemData.GetIcon()); continue; } Sprite value = ((IEnumerable<Sprite>)Resources.FindObjectsOfTypeAll<Sprite>()).SingleOrDefault((Func<Sprite, bool>)((Sprite x) => ((Object)x).name == "mapicon_pin")); _SpritesDictTier1.Add(text, value); } } private static void GetTier2Sprites(ObjectDB objectDB) { _SpritesDictTier2.Clear(); string[] array = Plugin._tier2BlackForest.Value.Split(',', ' '); ZNetScene instance = ZNetScene.instance; if (!Object.op_Implicit((Object)(object)instance) || instance.m_prefabs.Count <= 0) { return; } string[] array2 = array; foreach (string text in array2) { string text2 = text; GameObject prefab = instance.GetPrefab(StringExtensionMethods.GetStableHashCode(text)); if ((Object)(object)prefab == (Object)null) { continue; } CharacterDrop component = prefab.GetComponent<CharacterDrop>(); if ((Object)(object)component != (Object)null) { foreach (Drop drop in component.m_drops) { text2 = (((Object)drop.m_prefab).name.ToLower().Contains("trophy") ? ((Object)drop.m_prefab).name : ((Object)component.m_drops[0].m_prefab).name); } } GameObject itemPrefab = objectDB.GetItemPrefab(StringExtensionMethods.GetStableHashCode(text2)); if ((Object)(object)itemPrefab == (Object)null) { continue; } ItemDrop component2 = itemPrefab.GetComponent<ItemDrop>(); if ((Object)(object)component2 != (Object)null) { _SpritesDictTier2.Add(text, component2.m_itemData.GetIcon()); continue; } Sprite value = ((IEnumerable<Sprite>)Resources.FindObjectsOfTypeAll<Sprite>()).SingleOrDefault((Func<Sprite, bool>)((Sprite x) => ((Object)x).name == "mapicon_pin")); _SpritesDictTier2.Add(text, value); } } private static void GetTier3Sprites(ObjectDB objectDB) { _SpritesDictTier3.Clear(); string[] array = Plugin._tier3Swamps.Value.Split(',', ' '); ZNetScene instance = ZNetScene.instance; if (!Object.op_Implicit((Object)(object)instance) || instance.m_prefabs.Count <= 0) { return; } string[] array2 = array; foreach (string text in array2) { string text2 = text; GameObject prefab = instance.GetPrefab(StringExtensionMethods.GetStableHashCode(text)); if ((Object)(object)prefab == (Object)null) { continue; } CharacterDrop component = prefab.GetComponent<CharacterDrop>(); if ((Object)(object)component != (Object)null) { foreach (Drop drop in component.m_drops) { text2 = (((Object)drop.m_prefab).name.ToLower().Contains("trophy") ? ((Object)drop.m_prefab).name : ((Object)component.m_drops[0].m_prefab).name); } } GameObject itemPrefab = objectDB.GetItemPrefab(StringExtensionMethods.GetStableHashCode(text2)); if ((Object)(object)itemPrefab == (Object)null) { continue; } ItemDrop component2 = itemPrefab.GetComponent<ItemDrop>(); if ((Object)(object)component2 != (Object)null) { _SpritesDictTier3.Add(text, component2.m_itemData.GetIcon()); continue; } Sprite value = ((IEnumerable<Sprite>)Resources.FindObjectsOfTypeAll<Sprite>()).SingleOrDefault((Func<Sprite, bool>)((Sprite x) => ((Object)x).name == "mapicon_pin")); _SpritesDictTier3.Add(text, value); } } private static void GetTier4Sprites(ObjectDB objectDB) { _SpritesDictTier4.Clear(); string[] array = Plugin._tier4Mountains.Value.Split(',', ' '); ZNetScene instance = ZNetScene.instance; if (!Object.op_Implicit((Object)(object)instance) || instance.m_prefabs.Count <= 0) { return; } string[] array2 = array; foreach (string text in array2) { string text2 = text; GameObject prefab = instance.GetPrefab(StringExtensionMethods.GetStableHashCode(text)); if ((Object)(object)prefab == (Object)null) { continue; } CharacterDrop component = prefab.GetComponent<CharacterDrop>(); if ((Object)(object)component != (Object)null) { foreach (Drop drop in component.m_drops) { text2 = (((Object)drop.m_prefab).name.ToLower().Contains("trophy") ? ((Object)drop.m_prefab).name : ((Object)component.m_drops[0].m_prefab).name); } } GameObject itemPrefab = objectDB.GetItemPrefab(StringExtensionMethods.GetStableHashCode(text2)); if ((Object)(object)itemPrefab == (Object)null) { continue; } ItemDrop component2 = itemPrefab.GetComponent<ItemDrop>(); if ((Object)(object)component2 != (Object)null) { _SpritesDictTier4.Add(text, component2.m_itemData.GetIcon()); continue; } Sprite value = ((IEnumerable<Sprite>)Resources.FindObjectsOfTypeAll<Sprite>()).SingleOrDefault((Func<Sprite, bool>)((Sprite x) => ((Object)x).name == "mapicon_pin")); _SpritesDictTier4.Add(text, value); } } private static void GetTier5Sprites(ObjectDB objectDB) { _SpritesDictTier5.Clear(); string[] array = Plugin._tier5Plains.Value.Split(',', ' '); ZNetScene instance = ZNetScene.instance; if (!Object.op_Implicit((Object)(object)instance) || instance.m_prefabs.Count <= 0) { return; } string[] array2 = array; foreach (string text in array2) { string text2 = text; GameObject prefab = instance.GetPrefab(StringExtensionMethods.GetStableHashCode(text)); if ((Object)(object)prefab == (Object)null) { continue; } CharacterDrop component = prefab.GetComponent<CharacterDrop>(); if ((Object)(object)component != (Object)null) { foreach (Drop drop in component.m_drops) { text2 = (((Object)drop.m_prefab).name.ToLower().Contains("trophy") ? ((Object)drop.m_prefab).name : ((Object)component.m_drops[0].m_prefab).name); } } GameObject itemPrefab = objectDB.GetItemPrefab(StringExtensionMethods.GetStableHashCode(text2)); if ((Object)(object)itemPrefab == (Object)null) { continue; } ItemDrop component2 = itemPrefab.GetComponent<ItemDrop>(); if ((Object)(object)component2 != (Object)null) { _SpritesDictTier5.Add(text, component2.m_itemData.GetIcon()); continue; } Sprite value = ((IEnumerable<Sprite>)Resources.FindObjectsOfTypeAll<Sprite>()).SingleOrDefault((Func<Sprite, bool>)((Sprite x) => ((Object)x).name == "mapicon_pin")); _SpritesDictTier5.Add(text, value); } } private static void GetTier6Sprites(ObjectDB objectDB) { _SpritesDictTier6.Clear(); string[] array = Plugin._tier6Mistlands.Value.Split(',', ' '); ZNetScene instance = ZNetScene.instance; if (!Object.op_Implicit((Object)(object)instance) || instance.m_prefabs.Count <= 0) { return; } string[] array2 = array; foreach (string text in array2) { string text2 = text; GameObject prefab = instance.GetPrefab(StringExtensionMethods.GetStableHashCode(text)); if ((Object)(object)prefab == (Object)null) { continue; } CharacterDrop component = prefab.GetComponent<CharacterDrop>(); if ((Object)(object)component != (Object)null) { foreach (Drop drop in component.m_drops) { text2 = (((Object)drop.m_prefab).name.ToLower().Contains("trophy") ? ((Object)drop.m_prefab).name : ((Object)component.m_drops[0].m_prefab).name); } } GameObject itemPrefab = objectDB.GetItemPrefab(StringExtensionMethods.GetStableHashCode(text2)); if ((Object)(object)itemPrefab == (Object)null) { continue; } ItemDrop component2 = itemPrefab.GetComponent<ItemDrop>(); if ((Object)(object)component2 != (Object)null) { _SpritesDictTier6.Add(text, component2.m_itemData.GetIcon()); continue; } Sprite value = ((IEnumerable<Sprite>)Resources.FindObjectsOfTypeAll<Sprite>()).SingleOrDefault((Func<Sprite, bool>)((Sprite x) => ((Object)x).name == "mapicon_pin")); _SpritesDictTier6.Add(text, value); } } private static void GetTier7Sprites(ObjectDB objectDB) { _SpritesDictTier7.Clear(); string[] array = Plugin._tier7Ashlands.Value.Split(',', ' '); ZNetScene instance = ZNetScene.instance; if (!Object.op_Implicit((Object)(object)instance) || instance.m_prefabs.Count <= 0) { return; } string[] array2 = array; foreach (string text in array2) { string text2 = text; GameObject prefab = instance.GetPrefab(StringExtensionMethods.GetStableHashCode(text)); if ((Object)(object)prefab == (Object)null) { continue; } CharacterDrop component = prefab.GetComponent<CharacterDrop>(); if ((Object)(object)component != (Object)null) { foreach (Drop drop in component.m_drops) { text2 = (((Object)drop.m_prefab).name.ToLower().Contains("trophy") ? ((Object)drop.m_prefab).name : ((Object)component.m_drops[0].m_prefab).name); } } GameObject itemPrefab = objectDB.GetItemPrefab(StringExtensionMethods.GetStableHashCode(text2)); if ((Object)(object)itemPrefab == (Object)null) { continue; } ItemDrop component2 = itemPrefab.GetComponent<ItemDrop>(); if ((Object)(object)component2 != (Object)null) { _SpritesDictTier7.Add(text, component2.m_itemDa