using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace HowToFish.BaitIndex
{
public enum VariantNamingMode
{
Drip,
Super
}
public enum JournalViewMode
{
Regular,
DripCreatures
}
[BepInPlugin("com.howToFish.baitindex", "BaitIndex", "1.0.10")]
[BepInProcess("How to Fish.exe")]
public sealed class BaitIndexPlugin : BaseUnityPlugin
{
public const string PluginGuid = "com.howToFish.baitindex";
public const string PluginName = "BaitIndex";
public const string PluginVersion = "1.0.10";
public static JournalViewMode CurrentViewMode;
private static readonly Dictionary<string, string> _guideBaitMap;
public static BaitIndexPlugin Instance { get; private set; }
public static ManualLogSource Log { get; private set; }
public static ConfigEntry<bool> ModEnabled { get; private set; }
public static ConfigEntry<bool> RevealUndiscovered { get; private set; }
public static ConfigEntry<VariantNamingMode> VariantNaming { get; private set; }
public static ConfigEntry<float> ArrowSpreadDistance { get; private set; }
public static ConfigEntry<float> ArrowVerticalOffset { get; private set; }
public static ConfigEntry<float> ArrowScale { get; private set; }
public static string VariantName
{
get
{
if (VariantNaming == null || VariantNaming.Value != VariantNamingMode.Super)
{
return "Drip";
}
return "Super";
}
}
public static string VariantNameUpper => VariantName.ToUpperInvariant();
private static void Reg(string key, string bait)
{
if (!string.IsNullOrEmpty(key))
{
_guideBaitMap[key.Trim()] = bait;
}
}
static BaitIndexPlugin()
{
CurrentViewMode = JournalViewMode.Regular;
_guideBaitMap = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
Reg("Brown Crab", "French Fry");
Reg("BrownCrab", "French Fry");
Reg("Овальный Краб", "French Fry");
Reg("Shrimp", "French Fry");
Reg("Креветка", "French Fry");
Reg("Mackerel", "French Fry");
Reg("Скумбрия", "French Fry");
Reg("Gar", "French Fry");
Reg("Гар", "French Fry");
Reg("Сарган", "French Fry");
Reg("Pike", "French Fry");
Reg("Щука", "French Fry");
Reg("Rock Crab", "Hotdog");
Reg("RockCrab", "Hotdog");
Reg("Каменный Краб", "Hotdog");
Reg("Lobster", "Hotdog");
Reg("Лобстер", "Hotdog");
Reg("Омар", "Hotdog");
Reg("Piranha", "Hotdog");
Reg("Пиранья", "Hotdog");
Reg("Salmon", "Beginner Lure");
Reg("Лосось", "Beginner Lure");
Reg("Perch", "Beginner Lure");
Reg("Окунь", "Beginner Lure");
Reg("Triggerfish", "Beginner Lure");
Reg("Спинорог", "Beginner Lure");
Reg("Goldfish", "Beginner Lure");
Reg("Золотая рыбка", "Beginner Lure");
Reg("Cod", "Beginner Lure");
Reg("Треска", "Beginner Lure");
Reg("Goby", "Beginner Lure");
Reg("Бычок", "Beginner Lure");
Reg("Catfish", "Standard Lure");
Reg("Сом", "Standard Lure");
Reg("Clownfish", "Standard Lure");
Reg("Рыба-клоун", "Standard Lure");
Reg("Sea Urchin", "Standard Lure");
Reg("SeaUrchin", "Standard Lure");
Reg("Морской еж", "Standard Lure");
Reg("Yellow Boxfish", "Standard Lure");
Reg("YellowBoxfish", "Standard Lure");
Reg("Желтый кузовок", "Standard Lure");
Reg("Needlefish", "Standard Lure");
Reg("Рыба-игла", "Standard Lure");
Reg("Angelfish", "Standard Lure");
Reg("Рыба-ангел", "Standard Lure");
Reg("Bluegill", "Standard Lure");
Reg("Синежаберник", "Standard Lure");
Reg("Bowlfish", "Standard Lure");
Reg("BowlAndFish", "Standard Lure");
Reg("Рыба-шар", "Standard Lure");
Reg("Seahorse", "Standard Lure");
Reg("Морской конек", "Standard Lure");
Reg("Bass", "Professional Lure");
Reg("Басс", "Professional Lure");
Reg("Eel", "Professional Lure");
Reg("Угорь", "Professional Lure");
Reg("Red Snapper", "Professional Lure");
Reg("RedSnapper", "Professional Lure");
Reg("Красный луциан", "Professional Lure");
Reg("Sengarat", "Professional Lure");
Reg("Сенгарат", "Professional Lure");
Reg("Halibut", "Professional Lure");
Reg("Палтус", "Professional Lure");
Reg("Flying Fish", "Professional Lure");
Reg("FlyingFish", "Professional Lure");
Reg("Летучая рыба", "Professional Lure");
Reg("Voxelfish", "Professional Lure");
Reg("VoxelFish", "Professional Lure");
Reg("Воксельная рыба", "Professional Lure");
Reg("Parrotfish", "Professional Lure");
Reg("Рыба-попугай", "Professional Lure");
Reg("Dripper", "Professional Lure");
Reg("DripFish", "Professional Lure");
Reg("Дриппер", "Professional Lure");
Reg("Tigerfish", "Professional Lure");
Reg("Тигровая рыба", "Professional Lure");
Reg("Sunfish", "Beginner Boss Lure");
Reg("Рыба-луна", "Beginner Boss Lure");
Reg("The Old Pike", "Beginner Boss Lure");
Reg("TheOldPike", "Beginner Boss Lure");
Reg("Старый пайк", "Beginner Boss Lure");
Reg("Blue Shark", "Standard Boss Lure");
Reg("BlueShark", "Standard Boss Lure");
Reg("Голубая акула", "Standard Boss Lure");
Reg("Tuna", "Professional Boss Lure");
Reg("Тунец", "Professional Boss Lure");
Reg("Pufferfish", "Carrot (NPC Quest)");
Reg("Иглобрюх", "Carrot (NPC Quest)");
Reg("Spider Crab", "Empty Beer Can");
Reg("SpiderCrab", "Empty Beer Can");
Reg("Краб-паук", "Empty Beer Can");
Reg("Giant Piranha", "Modified Leech");
Reg("GiantPiranha", "Modified Leech");
Reg("Гигантская пиранья", "Modified Leech");
Reg("Albatross", "Tuna (Meat)");
Reg("Альбатрос", "Tuna (Meat)");
Reg("Bowhead Whale", "Lava Event Boss");
Reg("BowheadWhale", "Lava Event Boss");
Reg("Гренландский кит", "Lava Event Boss");
Reg("FootSnail", "Wild Fauna (Catch)");
Reg("Улитка", "Wild Fauna (Catch)");
}
private void Awake()
{
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
Instance = this;
Log = ((BaseUnityPlugin)this).Logger;
ModEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("1. General", "Enabled", true, "Enable BaitIndex integration in the native Tab Journal.");
RevealUndiscovered = ((BaseUnityPlugin)this).Config.Bind<bool>("2. Display & Layout", "RevealUndiscovered", true, "Reveal required baits even for undiscovered fish.");
VariantNaming = ((BaseUnityPlugin)this).Config.Bind<VariantNamingMode>("2. Display & Layout", "VariantNaming", VariantNamingMode.Drip, "Naming style for special rare creatures in the journal: Drip (default) or Super.");
ArrowSpreadDistance = ((BaseUnityPlugin)this).Config.Bind<float>("3. Arrow Customization", "ArrowSpreadDistance", 60f, "Horizontal spread offset for pagination arrows (-60px left / +60px right by default).");
ArrowVerticalOffset = ((BaseUnityPlugin)this).Config.Bind<float>("3. Arrow Customization", "ArrowVerticalOffset", -22f, "Vertical height offset for pagination arrows (-22px lower by default).");
ArrowScale = ((BaseUnityPlugin)this).Config.Bind<float>("3. Arrow Customization", "ArrowScale", 1f, "Size multiplier for pagination arrow buttons (0.5x to 2.0x).");
try
{
new Harmony("com.howToFish.baitindex").PatchAll();
Log.LogInfo((object)"BaitIndex v1.0.10 initialized! Official Guide Bait Index active.");
}
catch (Exception ex)
{
Log.LogError((object)("BaitIndex Harmony error: " + ex));
}
}
public static void AdjustArrowsAndLayout(ThinkingUI ui)
{
}
public static string GetOfficialBaitString(Creature creature)
{
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)creature == (Object)null)
{
return null;
}
string name = ((Object)creature).name;
if (!string.IsNullOrEmpty(name) && _guideBaitMap.ContainsKey(name))
{
return _guideBaitMap[name];
}
try
{
string name2 = ((Item)creature).GetName();
if (!string.IsNullOrEmpty(name2) && _guideBaitMap.ContainsKey(name2))
{
return _guideBaitMap[name2];
}
}
catch
{
}
if ((int)creature.BossType != 0 || creature.BossHpMultiplier > 1f)
{
string text = ((Object)creature).name.ToLower();
if (text.Contains("crab"))
{
return "Empty Beer Can";
}
if (text.Contains("pike") || text.Contains("sunfish"))
{
return "Beginner Boss Lure";
}
if (text.Contains("shark"))
{
return "Standard Boss Lure";
}
if (text.Contains("tuna"))
{
return "Professional Boss Lure";
}
if (text.Contains("whale"))
{
return "Lava Event Boss";
}
if (text.Contains("piranha"))
{
return "Modified Leech";
}
}
return "Standard Lure";
}
}
[HarmonyPatch(typeof(JournalSlot), "SetCreature")]
public static class JournalSlot_SetCreature_Patch
{
private static FieldInfo _nameTextField = typeof(JournalSlot).GetField("_nameText", BindingFlags.Instance | BindingFlags.NonPublic);
private static FieldInfo _worthTextField = typeof(JournalSlot).GetField("_worthText", BindingFlags.Instance | BindingFlags.NonPublic);
private static FieldInfo _imageField = typeof(JournalSlot).GetField("_image", BindingFlags.Instance | BindingFlags.NonPublic);
private static FieldInfo _filterField = typeof(JournalSlot).GetField("_filter", BindingFlags.Instance | BindingFlags.NonPublic);
private static FieldInfo _dripTextField = typeof(JournalSlot).GetField("_dripText", BindingFlags.Instance | BindingFlags.NonPublic);
public static void Postfix(JournalSlot __instance, Creature creature)
{
//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
//IL_048d: Unknown result type (might be due to invalid IL or missing references)
//IL_0413: Unknown result type (might be due to invalid IL or missing references)
//IL_03a4: Unknown result type (might be due to invalid IL or missing references)
//IL_030e: Unknown result type (might be due to invalid IL or missing references)
//IL_029c: Unknown result type (might be due to invalid IL or missing references)
//IL_021c: Unknown result type (might be due to invalid IL or missing references)
//IL_04f8: Unknown result type (might be due to invalid IL or missing references)
//IL_04fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0668: Unknown result type (might be due to invalid IL or missing references)
//IL_067f: Unknown result type (might be due to invalid IL or missing references)
//IL_068f: Unknown result type (might be due to invalid IL or missing references)
//IL_069f: Unknown result type (might be due to invalid IL or missing references)
//IL_0582: Unknown result type (might be due to invalid IL or missing references)
//IL_0598: Unknown result type (might be due to invalid IL or missing references)
//IL_05ae: Unknown result type (might be due to invalid IL or missing references)
//IL_05c4: Unknown result type (might be due to invalid IL or missing references)
//IL_061a: Unknown result type (might be due to invalid IL or missing references)
//IL_05df: Unknown result type (might be due to invalid IL or missing references)
//IL_05ef: Unknown result type (might be due to invalid IL or missing references)
//IL_05ff: Unknown result type (might be due to invalid IL or missing references)
if (!BaitIndexPlugin.ModEnabled.Value || (Object)(object)__instance == (Object)null || (Object)(object)creature == (Object)null)
{
return;
}
try
{
if (_nameTextField == null)
{
_nameTextField = typeof(JournalSlot).GetField("_nameText", BindingFlags.Instance | BindingFlags.NonPublic);
}
if (_worthTextField == null)
{
_worthTextField = typeof(JournalSlot).GetField("_worthText", BindingFlags.Instance | BindingFlags.NonPublic);
}
if (_imageField == null)
{
_imageField = typeof(JournalSlot).GetField("_image", BindingFlags.Instance | BindingFlags.NonPublic);
}
if (_filterField == null)
{
_filterField = typeof(JournalSlot).GetField("_filter", BindingFlags.Instance | BindingFlags.NonPublic);
}
if (_dripTextField == null)
{
_dripTextField = typeof(JournalSlot).GetField("_dripText", BindingFlags.Instance | BindingFlags.NonPublic);
}
TextMeshProUGUI val = (TextMeshProUGUI)((_nameTextField != null) ? /*isinst with value type is only supported in some contexts*/: null);
TextMeshProUGUI val2 = (TextMeshProUGUI)((_worthTextField != null) ? /*isinst with value type is only supported in some contexts*/: null);
RawImage val3 = (RawImage)((_imageField != null) ? /*isinst with value type is only supported in some contexts*/: null);
MeshFilter val4 = (MeshFilter)((_filterField != null) ? /*isinst with value type is only supported in some contexts*/: null);
DripText val5 = (DripText)((_dripTextField != null) ? /*isinst with value type is only supported in some contexts*/: null);
bool flag = BaitIndexPlugin.CurrentViewMode == JournalViewMode.DripCreatures;
bool flag2 = SaveManager.HasKilledCreature(((Item)creature).ID, false);
bool flag3 = SaveManager.HasKilledCreature(((Item)creature).ID, true);
bool flag4 = (int)creature.BossType != 0 || creature.BossHpMultiplier > 1f;
Transform val6 = (((Object)(object)val2 != (Object)null) ? ((TMP_Text)val2).transform.parent : ((Component)__instance).transform);
Transform val7 = val6.Find("BaitIndexText");
TextMeshProUGUI val8 = null;
if (flag)
{
if (flag4)
{
if (flag2)
{
if ((Object)(object)val3 != (Object)null)
{
((Graphic)val3).color = Color.white;
}
if ((Object)(object)val != (Object)null)
{
((TMP_Text)val).text = ((Item)creature).GetName();
}
if ((Object)(object)val2 != (Object)null)
{
((TMP_Text)val2).text = "$" + ((Item)creature).DefaultWorth;
}
if ((Object)(object)val4 != (Object)null)
{
val4.mesh = ((Item)creature).Mesh;
}
if ((Object)(object)val5 != (Object)null)
{
val5.SetDrip(false);
}
}
else
{
if ((Object)(object)val3 != (Object)null)
{
((Graphic)val3).color = Color.black;
}
if ((Object)(object)val != (Object)null)
{
((TMP_Text)val).text = "???";
}
if ((Object)(object)val2 != (Object)null)
{
((TMP_Text)val2).text = "-";
}
if ((Object)(object)val4 != (Object)null)
{
val4.mesh = ((Item)creature).Mesh;
}
if ((Object)(object)val5 != (Object)null)
{
val5.SetDrip(false);
}
}
}
else if (flag3)
{
if ((Object)(object)val3 != (Object)null)
{
((Graphic)val3).color = Color.white;
}
if ((Object)(object)val != (Object)null)
{
((TMP_Text)val).text = ((Item)creature).GetName();
}
if ((Object)(object)val2 != (Object)null)
{
((TMP_Text)val2).text = "$" + ((Item)creature).DefaultWorth;
}
if ((Object)(object)val4 != (Object)null)
{
val4.mesh = (((Object)(object)((Item)creature).DripMesh != (Object)null) ? ((Item)creature).DripMesh : ((Item)creature).Mesh);
}
if ((Object)(object)val5 != (Object)null)
{
val5.SetDrip(true);
}
}
else
{
if ((Object)(object)val3 != (Object)null)
{
((Graphic)val3).color = Color.black;
}
if ((Object)(object)val != (Object)null)
{
((TMP_Text)val).text = "???";
}
if ((Object)(object)val2 != (Object)null)
{
((TMP_Text)val2).text = "-";
}
if ((Object)(object)val4 != (Object)null)
{
val4.mesh = ((Item)creature).Mesh;
}
if ((Object)(object)val5 != (Object)null)
{
val5.SetDrip(false);
}
}
}
else if (flag2)
{
if ((Object)(object)val3 != (Object)null)
{
((Graphic)val3).color = Color.white;
}
if ((Object)(object)val != (Object)null)
{
((TMP_Text)val).text = ((Item)creature).GetName();
}
if ((Object)(object)val2 != (Object)null)
{
((TMP_Text)val2).text = "$" + ((Item)creature).DefaultWorth;
}
if ((Object)(object)val4 != (Object)null)
{
val4.mesh = ((Item)creature).Mesh;
}
if ((Object)(object)val5 != (Object)null)
{
val5.SetDrip(false);
}
}
else
{
if ((Object)(object)val3 != (Object)null)
{
((Graphic)val3).color = Color.black;
}
if ((Object)(object)val != (Object)null)
{
((TMP_Text)val).text = "???";
}
if ((Object)(object)val2 != (Object)null)
{
((TMP_Text)val2).text = "-";
}
if ((Object)(object)val4 != (Object)null)
{
val4.mesh = ((Item)creature).Mesh;
}
if ((Object)(object)val5 != (Object)null)
{
val5.SetDrip(false);
}
}
if ((Object)(object)val7 == (Object)null)
{
GameObject val9 = new GameObject("BaitIndexText");
val9.transform.SetParent(val6, false);
val8 = val9.AddComponent<TextMeshProUGUI>();
if ((Object)(object)val2 != (Object)null)
{
((TMP_Text)val8).font = ((TMP_Text)val2).font;
((TMP_Text)val8).fontSharedMaterial = ((TMP_Text)val2).fontSharedMaterial;
}
((Graphic)val8).raycastTarget = false;
((TMP_Text)val8).fontSize = 14.5f;
((TMP_Text)val8).fontStyle = (FontStyles)1;
((TMP_Text)val8).alignment = (TextAlignmentOptions)514;
((TMP_Text)val8).overflowMode = (TextOverflowModes)0;
((TMP_Text)val8).richText = true;
RectTransform rectTransform = ((TMP_Text)val8).rectTransform;
rectTransform.anchorMin = new Vector2(0.5f, 0f);
rectTransform.anchorMax = new Vector2(0.5f, 0f);
rectTransform.pivot = new Vector2(0.5f, 1f);
rectTransform.sizeDelta = new Vector2(220f, 26f);
if ((Object)(object)val2 != (Object)null)
{
rectTransform.anchoredPosition = new Vector2(((TMP_Text)val2).rectTransform.anchoredPosition.x, ((TMP_Text)val2).rectTransform.anchoredPosition.y - 2f);
}
else
{
rectTransform.anchoredPosition = new Vector2(0f, -2f);
}
}
else
{
val8 = ((Component)val7).GetComponent<TextMeshProUGUI>();
((Graphic)val8).raycastTarget = false;
((TMP_Text)val8).fontSize = 14.5f;
((TMP_Text)val8).fontStyle = (FontStyles)1;
if ((Object)(object)val2 != (Object)null)
{
((TMP_Text)val8).rectTransform.pivot = new Vector2(0.5f, 1f);
((TMP_Text)val8).rectTransform.anchoredPosition = new Vector2(((TMP_Text)val2).rectTransform.anchoredPosition.x, ((TMP_Text)val2).rectTransform.anchoredPosition.y - 2f);
}
((Component)val7).gameObject.SetActive(true);
}
bool num = ((!flag) ? flag2 : (flag4 ? flag2 : flag3));
string officialBaitString = BaitIndexPlugin.GetOfficialBaitString(creature);
if (!num)
{
if (BaitIndexPlugin.RevealUndiscovered.Value)
{
string arg = ((flag && !flag4) ? (BaitIndexPlugin.VariantName + ": ") : "Bait: ");
((TMP_Text)val8).text = $"<color=#888899><i>{arg}{officialBaitString}</i></color>";
}
else
{
((TMP_Text)val8).text = ((flag && !flag4) ? $"<color=#777788>{BaitIndexPlugin.VariantName}: ???</color>" : "<color=#777788>Bait: ???</color>");
}
}
else if (flag4)
{
((TMP_Text)val8).text = $"<color=#FF5555><b>Boss: {officialBaitString}</b></color>";
}
else if (flag)
{
((TMP_Text)val8).text = $"<color=#FFD700><b>{BaitIndexPlugin.VariantName}: {officialBaitString}</b></color>";
}
else if (officialBaitString == "French Fry" || officialBaitString == "Hotdog")
{
((TMP_Text)val8).text = $"<color=#FFD700><b>Bait: {officialBaitString}</b></color>";
}
else
{
((TMP_Text)val8).text = $"<color=#8CD4FF><b>Lure: {officialBaitString}</b></color>";
}
}
catch (Exception ex)
{
BaitIndexPlugin.Log.LogError((object)("JournalSlot.SetCreature error: " + ex.Message));
}
}
}
[HarmonyPatch(typeof(ThinkingUI), "Update")]
public static class ThinkingUI_Update_Patch
{
private static MethodInfo _updateJournalMethod = typeof(ThinkingUI).GetMethod("UpdateJournal", BindingFlags.Instance | BindingFlags.NonPublic);
private static MethodInfo _setProgressTextsMethod = typeof(ThinkingUI).GetMethod("SetProgressTexts", BindingFlags.Instance | BindingFlags.NonPublic);
public static void Postfix(ThinkingUI __instance)
{
if (BaitIndexPlugin.ModEnabled.Value && !((Object)(object)__instance == (Object)null) && (Input.GetKeyDown((KeyCode)113) || Input.GetKeyDown((KeyCode)32)))
{
ToggleJournalMode(__instance);
}
}
public static void ToggleJournalMode(ThinkingUI ui)
{
BaitIndexPlugin.CurrentViewMode = ((BaitIndexPlugin.CurrentViewMode == JournalViewMode.Regular) ? JournalViewMode.DripCreatures : JournalViewMode.Regular);
if (!((Object)(object)ui != (Object)null))
{
return;
}
if (_updateJournalMethod == null)
{
_updateJournalMethod = typeof(ThinkingUI).GetMethod("UpdateJournal", BindingFlags.Instance | BindingFlags.NonPublic);
}
if (_setProgressTextsMethod == null)
{
_setProgressTextsMethod = typeof(ThinkingUI).GetMethod("SetProgressTexts", BindingFlags.Instance | BindingFlags.NonPublic);
}
try
{
if (_updateJournalMethod != null && _updateJournalMethod.Invoke(ui, null) is IEnumerator enumerator)
{
((MonoBehaviour)ui).StartCoroutine(enumerator);
}
if (_setProgressTextsMethod != null)
{
_setProgressTextsMethod.Invoke(ui, null);
}
}
catch
{
}
}
}
[HarmonyPatch(typeof(ThinkingUI), "SetProgressTexts")]
public static class ThinkingUI_SetProgressTexts_Patch
{
private static FieldInfo _progressTextField = typeof(ThinkingUI).GetField("_progressText", BindingFlags.Instance | BindingFlags.NonPublic);
private static FieldInfo _dripProgressTextField = typeof(ThinkingUI).GetField("_dripProgressText", BindingFlags.Instance | BindingFlags.NonPublic);
private static float _basePosY = -9999f;
public static void Postfix(ThinkingUI __instance)
{
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_0137: 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)
if (!BaitIndexPlugin.ModEnabled.Value || (Object)(object)__instance == (Object)null)
{
return;
}
try
{
if (_progressTextField == null)
{
_progressTextField = typeof(ThinkingUI).GetField("_progressText", BindingFlags.Instance | BindingFlags.NonPublic);
}
if (_dripProgressTextField == null)
{
_dripProgressTextField = typeof(ThinkingUI).GetField("_dripProgressText", BindingFlags.Instance | BindingFlags.NonPublic);
}
TextMeshProUGUI val = (TextMeshProUGUI)((_progressTextField != null) ? /*isinst with value type is only supported in some contexts*/: null);
TextMeshProUGUI val2 = (TextMeshProUGUI)((_dripProgressTextField != null) ? /*isinst with value type is only supported in some contexts*/: null);
bool flag = BaitIndexPlugin.CurrentViewMode == JournalViewMode.DripCreatures;
int num = GameInfo.KilledCreaturesCount(false);
int num2 = GameInfo.KilledCreaturesCount(true);
int allCreatureCount = GameInfo.AllCreatureCount;
if ((Object)(object)val != (Object)null)
{
if (_basePosY < -9000f)
{
_basePosY = ((TMP_Text)val).rectTransform.anchoredPosition.y;
}
((Graphic)val).raycastTarget = false;
((TMP_Text)val).alignment = (TextAlignmentOptions)514;
((TMP_Text)val).rectTransform.sizeDelta = new Vector2(980f, 56f);
((TMP_Text)val).rectTransform.anchoredPosition = new Vector2(50f, _basePosY - 5f);
((TMP_Text)val).fontSize = 20.5f;
((TMP_Text)val).fontStyle = (FontStyles)1;
((TMP_Text)val).overflowMode = (TextOverflowModes)0;
string text = ((!flag) ? "<color=#FFD700><b>[▶ REGULAR FISH]</b></color>" : "<color=#888888>[REGULAR FISH]</color>");
string text2 = (flag ? $"<color=#FFD700><b>[▶ {BaitIndexPlugin.VariantNameUpper} CREATURES]</b></color>" : $"<color=#888888>[{BaitIndexPlugin.VariantNameUpper} CREATURES]</color>");
((TMP_Text)val).text = $"{text} <color=#FFD700><b>{num} / {allCreatureCount}</b></color> <color=#8CD4FF><b>[Q ⇄]</b></color> {text2} <color=#FFD700><b>{num2} / {allCreatureCount}</b></color>";
}
if ((Object)(object)val2 != (Object)null)
{
((TMP_Text)val2).text = "";
}
}
catch
{
}
}
}
[HarmonyPatch(typeof(ThinkingUI), "CloudyAnimations")]
public static class ThinkingUI_CloudyAnimations_Patch
{
private static FieldInfo _cloudlyField = typeof(ThinkingUI).GetField("_cloudlyTransforms", BindingFlags.Instance | BindingFlags.NonPublic);
private static HashSet<int> _shiftedParents = new HashSet<int>();
public static void Postfix(ThinkingUI __instance)
{
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Unknown result type (might be due to invalid IL or missing references)
//IL_0268: Unknown result type (might be due to invalid IL or missing references)
//IL_0279: Unknown result type (might be due to invalid IL or missing references)
//IL_028a: Unknown result type (might be due to invalid IL or missing references)
//IL_0294: Unknown result type (might be due to invalid IL or missing references)
//IL_0189: Unknown result type (might be due to invalid IL or missing references)
//IL_019b: Unknown result type (might be due to invalid IL or missing references)
//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
//IL_02d9: Unknown result type (might be due to invalid IL or missing references)
//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0305: Unknown result type (might be due to invalid IL or missing references)
//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
//IL_0204: Unknown result type (might be due to invalid IL or missing references)
//IL_0214: Unknown result type (might be due to invalid IL or missing references)
if (!BaitIndexPlugin.ModEnabled.Value || (Object)(object)__instance == (Object)null)
{
return;
}
try
{
if (_cloudlyField == null)
{
_cloudlyField = typeof(ThinkingUI).GetField("_cloudlyTransforms", BindingFlags.Instance | BindingFlags.NonPublic);
}
List<Transform> list = ((_cloudlyField != null) ? (_cloudlyField.GetValue(__instance) as List<Transform>) : null);
if (list == null)
{
return;
}
foreach (Transform item in list)
{
if ((Object)(object)item == (Object)null || (Object)(object)((Component)item).GetComponent<JournalSlot>() != (Object)null || (Object)(object)((Component)item).GetComponentInParent<JournalSlot>() != (Object)null || (Object)(object)((Component)item).GetComponent<TextMeshProUGUI>() != (Object)null || (Object)(object)((Component)item).GetComponentInParent<TextMeshProUGUI>() != (Object)null)
{
continue;
}
Transform parent = item.parent;
float num = (((Object)(object)parent != (Object)null) ? parent.localPosition.x : item.localPosition.x);
RectTransform val = (((Object)(object)parent != (Object)null) ? ((Component)parent).GetComponent<RectTransform>() : null);
if ((Object)(object)val != (Object)null)
{
num = val.anchoredPosition.x;
}
if ((Object)(object)parent != (Object)null && !_shiftedParents.Contains(((Object)parent).GetInstanceID()))
{
if ((Object)(object)val != (Object)null)
{
if (num < -0.01f || ((Object)item).name.ToLower().Contains("left") || ((Object)item).name.ToLower().Contains("prev"))
{
val.anchoredPosition = new Vector2(val.anchoredPosition.x - 60f, val.anchoredPosition.y - 22f);
}
else if (num > 0.01f || ((Object)item).name.ToLower().Contains("right") || ((Object)item).name.ToLower().Contains("next"))
{
val.anchoredPosition = new Vector2(val.anchoredPosition.x + 60f, val.anchoredPosition.y - 22f);
}
}
_shiftedParents.Add(((Object)parent).GetInstanceID());
}
if (num < -0.01f || ((Object)item).name.ToLower().Contains("left") || ((Object)item).name.ToLower().Contains("prev"))
{
item.localPosition = new Vector3(item.localPosition.x - 60f, item.localPosition.y - 22f, item.localPosition.z);
}
else if (num > 0.01f || ((Object)item).name.ToLower().Contains("right") || ((Object)item).name.ToLower().Contains("next"))
{
item.localPosition = new Vector3(item.localPosition.x + 60f, item.localPosition.y - 22f, item.localPosition.z);
}
}
}
catch
{
}
}
}
[HarmonyPatch(typeof(SaveManager), "IsNewFish")]
public static class SaveManager_IsNewFish_Patch
{
private static FieldInfo _curLocalSaveField = typeof(SaveManager).GetField("_curLocalSave", BindingFlags.Static | BindingFlags.NonPublic);
public static bool Prefix(byte id, bool to, bool drip, ref bool __result)
{
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Expected O, but got Unknown
bool flag = to;
bool flag2 = drip;
try
{
if (_curLocalSaveField == null)
{
_curLocalSaveField = typeof(SaveManager).GetField("_curLocalSave", BindingFlags.Static | BindingFlags.NonPublic);
}
if (_curLocalSaveField == null)
{
return true;
}
object value = _curLocalSaveField.GetValue(null);
if (value == null)
{
return true;
}
FieldInfo field = value.GetType().GetField("Creatures", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
FieldInfo field2 = value.GetType().GetField("CreaturesToList", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
if (field != null)
{
Dictionary<byte, SavedCreature> dictionary = field.GetValue(value) as Dictionary<byte, SavedCreature>;
List<SavedCreature> list = ((field2 != null) ? (field2.GetValue(value) as List<SavedCreature>) : null);
if (dictionary != null)
{
bool flag3 = false;
SavedCreature value2 = null;
if (dictionary.TryGetValue(id, out value2))
{
if (flag && !value2.BeenKilled)
{
value2.BeenKilled = true;
flag3 = true;
}
if (flag2 && !value2.KilledDrip)
{
value2.KilledDrip = true;
flag3 = true;
}
}
else
{
value2 = (dictionary[id] = new SavedCreature
{
ID = id,
BeenKilled = flag,
KilledDrip = flag2
});
list?.Add(value2);
flag3 = true;
}
__result = flag3;
return false;
}
}
}
catch (Exception ex)
{
BaitIndexPlugin.Log.LogError((object)("SaveManager.IsNewFish patch error: " + ex));
}
return true;
}
}
}