Decompiled source of RiverMonsters v1.0.3

RiverMonsters.dll

Decompiled a day ago
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: AssemblyVersion("0.0.0.0")]
namespace MonstrosDoRio;

[BepInPlugin("yuri.RiverMonsters", "River Monsters", "1.0.3")]
public class Plugin : BaseUnityPlugin
{
	private enum Fase
	{
		Nada,
		Forca,
		Espera,
		Fisgou,
		Barra,
		Aviso
	}

	[HarmonyPatch(typeof(Player), "GetAvailableRecipes")]
	private static class NoTopo
	{
		private static void Postfix(Player __instance, ref List<Recipe> available)
		{
			if (!((Object)(object)Inst == (Object)null) && Inst.Ligado.Value && available != null && !((Object)(object)__instance != (Object)(object)Player.m_localPlayer))
			{
				ColocarNaLista(available);
			}
		}
	}

	[HarmonyPatch(typeof(InventoryGui), "UpdateRecipeList")]
	private static class NaAba
	{
		private static void Prefix(List<Recipe> recipes)
		{
			ColocarNaLista(recipes);
		}
	}

	[HarmonyPatch(typeof(ObjectDB), "Awake")]
	private static class AoAcordar
	{
		private static void Postfix(ObjectDB __instance)
		{
			Registrar(__instance);
		}
	}

	[HarmonyPatch(typeof(ObjectDB), "CopyOtherDB")]
	private static class AoCopiar
	{
		private static void Postfix(ObjectDB __instance)
		{
			Registrar(__instance);
		}
	}

	[HarmonyPatch(typeof(Attack), "Start")]
	private static class SemAtaqueDaVara
	{
		private static bool Prefix(Humanoid ___m_character)
		{
			if ((Object)(object)Inst == (Object)null || !Inst.Ligado.Value)
			{
				return true;
			}
			if ((Object)(object)___m_character != (Object)(object)Player.m_localPlayer)
			{
				return true;
			}
			if (!ComVara(Player.m_localPlayer))
			{
				return true;
			}
			return false;
		}
	}

	[HarmonyPatch(typeof(Attack), "HaveAmmo")]
	private static class SemAvisoDeIsca
	{
		private static bool Prefix(Humanoid ___m_character, ref bool __result)
		{
			if ((Object)(object)Inst == (Object)null || !Inst.Ligado.Value)
			{
				return true;
			}
			if ((Object)(object)___m_character != (Object)(object)Player.m_localPlayer)
			{
				return true;
			}
			if (!ComVara(Player.m_localPlayer))
			{
				return true;
			}
			__result = false;
			return false;
		}
	}

	[HarmonyPatch(typeof(Humanoid), "StartAttack")]
	private static class SemAtaqueVanilla
	{
		private static bool Prefix(Humanoid __instance, ref bool __result)
		{
			if ((Object)(object)Inst == (Object)null || !Inst.Ligado.Value)
			{
				return true;
			}
			Player val = (Player)(object)((__instance is Player) ? __instance : null);
			if ((Object)(object)val == (Object)null || (Object)(object)Player.m_localPlayer != (Object)(object)val)
			{
				return true;
			}
			if (!ComVara(val))
			{
				return true;
			}
			__result = false;
			return false;
		}
	}

	private const string NomeVara = "VaraMonstrosDoRio";

	private const float Pista = 568f;

	public static Plugin Inst;

	public static Recipe Receita;

	private ConfigEntry<bool> Ligado;

	private Fase fase;

	private bool esperandoSoltar;

	private float forca;

	private float espera;

	private float janela;

	private float aviso;

	private float habilidade;

	private float dificuldade;

	private int jeito;

	private float barraY;

	private float barraH;

	private float velBarra;

	private float peixeY;

	private float peixeAlvo;

	private float peixeVel;

	private float peixeAcel;

	private float peixeTempo;

	private float tickAcum;

	private float progresso;

	private string nomePremio = "";

	private string itemA;

	private string itemB;

	private string itemC;

	private int qtdA;

	private float chanceB;

	private float chanceC;

	private string textoAviso = "";

	private Vector3 boia;

	private Texture2D pixel;

	private GUIStyle estilo;

	private GUIStyle estiloGrande;

	private bool listaPronta;

	private bool receitaPronta;

	private bool falouOnde;

	private bool viuVara;

	private bool entrouNaLista;

	private GameObject boiaVisivel;

	private GameObject peixePulo;

	private LineRenderer linha;

	private Transform pontaVara;

	private Transform ossoVara;

	private Quaternion ossoOriginal;

	private bool ossoGuardado;

	private List<string> peixes = new List<string>();

	private List<string> monstros = new List<string>();

	private void Awake()
	{
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Expected O, but got Unknown
		Inst = this;
		Ligado = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Turns on the River Monsters rod in this game. Only your own game needs this mod.");
		Harmony val = new Harmony("yuri.RiverMonsters");
		val.PatchAll(typeof(Plugin).Assembly);
		if ((Object)(object)ObjectDB.instance != (Object)null)
		{
			Registrar(ObjectDB.instance);
		}
		((BaseUnityPlugin)this).Logger.LogInfo((object)"River Monsters 1.0.3");
	}

	private void Update()
	{
		if ((Object)(object)Inst != (Object)(object)this)
		{
			return;
		}
		if (!Ligado.Value)
		{
			if (fase != Fase.Nada)
			{
				Encerrar("", mostrar: false);
			}
			return;
		}
		if (!receitaPronta && (Object)(object)ObjectDB.instance != (Object)null)
		{
			Registrar(ObjectDB.instance);
		}
		if (!falouOnde && receitaPronta && (Object)(object)Player.m_localPlayer != (Object)null)
		{
			falouOnde = true;
			Avisar("Fishing rod at the top of Crafting. Left click casts. Hold and the bar rises, release and it falls.", guardar: true);
		}
		Player localPlayer = Player.m_localPlayer;
		if ((Object)(object)localPlayer == (Object)null || ((Character)localPlayer).IsDead())
		{
			if (fase != Fase.Nada)
			{
				Encerrar("", mostrar: false);
			}
			return;
		}
		if (!ComVara(localPlayer))
		{
			viuVara = false;
			if (fase != Fase.Nada)
			{
				Encerrar("Put the rod away.", mostrar: true);
			}
			return;
		}
		if (!viuVara)
		{
			viuVara = true;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Rod equipped");
		}
		if (Console.IsVisible() || InventoryGui.IsVisible())
		{
			if (fase == Fase.Forca)
			{
				fase = Fase.Nada;
			}
			if (fase == Fase.Espera || fase == Fase.Fisgou || fase == Fase.Barra)
			{
				Encerrar("The line went slack.", mostrar: true);
			}
			return;
		}
		bool flag = Segurando();
		bool flag2 = Apertou();
		Soltou();
		float deltaTime = Time.deltaTime;
		if (fase == Fase.Nada)
		{
			if (esperandoSoltar)
			{
				if (!flag)
				{
					esperandoSoltar = false;
				}
			}
			else if (flag2)
			{
				forca = 0.7f;
				Soltar(localPlayer);
			}
		}
		else if (ZInput.GetKeyDown((KeyCode)27, true))
		{
			Encerrar("You reeled the line in.", mostrar: true);
			esperandoSoltar = true;
		}
		else if (fase == Fase.Espera)
		{
			if (esperandoSoltar && !flag)
			{
				esperandoSoltar = false;
			}
			espera -= deltaTime;
			if (espera <= 0f)
			{
				fase = Fase.Fisgou;
				janela = 1.35f + habilidade * 0.7f;
				Avisar("Bite! Hold the left button.", guardar: false);
				PularPeixe();
			}
			AtualizarCena(localPlayer, 0.16f);
		}
		else if (fase == Fase.Fisgou)
		{
			if (esperandoSoltar)
			{
				if (!flag)
				{
					esperandoSoltar = false;
				}
			}
			else if (flag || flag2)
			{
				ComecarBarra();
			}
			janela -= deltaTime;
			if (fase == Fase.Barra)
			{
				AtualizarBarra(localPlayer, deltaTime, Segurando());
				if (fase == Fase.Barra)
				{
					AtualizarCena(localPlayer, Segurando() ? 0.9f : 0.25f);
				}
			}
			else if (janela <= 0f)
			{
				Encerrar("Too slow. It got away.", mostrar: true);
				esperandoSoltar = true;
			}
			else
			{
				AtualizarCena(localPlayer, 0.7f + Mathf.Abs(Mathf.Sin(Time.time * 16f)) * 0.3f);
			}
		}
		else if (fase == Fase.Barra)
		{
			AtualizarBarra(localPlayer, deltaTime, flag);
			if (fase == Fase.Barra)
			{
				bool flag3 = PeixeNaBarra();
				AtualizarCena(localPlayer, flag3 ? 0.32f : 0.92f);
			}
		}
		else if (fase == Fase.Aviso)
		{
			aviso -= deltaTime;
			if (aviso <= 0f || flag2)
			{
				fase = Fase.Nada;
				esperandoSoltar = flag;
			}
		}
	}

	private void Soltar(Player jogador)
	{
		fase = Fase.Nada;
		if (!TemAgua(jogador, forca, out boia))
		{
			Avisar("There is no water there. Look at the water and release the attack.", guardar: true);
			esperandoSoltar = true;
			return;
		}
		if (!((Character)jogador).HaveStamina(5f))
		{
			Avisar("Not enough stamina to cast.", guardar: true);
			esperandoSoltar = true;
			return;
		}
		MontarLista();
		if (!Sortear(jogador))
		{
			Avisar("Nothing bit.", guardar: true);
			esperandoSoltar = true;
			return;
		}
		((Character)jogador).UseStamina(5f);
		habilidade = ((Character)jogador).GetSkillFactor((SkillType)104);
		if (habilidade < 0f)
		{
			habilidade = 0f;
		}
		if (habilidade > 1f)
		{
			habilidade = 1f;
		}
		float num = 0.7f - habilidade * 0.25f;
		float num2 = 2.6f - habilidade * 0.7f;
		if (num < 0.35f)
		{
			num = 0.35f;
		}
		if (num2 < num + 0.3f)
		{
			num2 = num + 0.3f;
		}
		espera = Random.Range(num, num2);
		fase = Fase.Espera;
		esperandoSoltar = true;
		CriarCena(jogador);
		((BaseUnityPlugin)this).Logger.LogInfo((object)("Cast " + nomePremio));
	}

	private bool Sortear(Player jogador)
	{
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Invalid comparison between Unknown and I4
		itemA = null;
		itemB = null;
		itemC = null;
		qtdA = 1;
		chanceB = 0f;
		chanceC = 0f;
		Biome val = Heightmap.FindBiome(boia);
		bool flag = (int)val == 256;
		float num = (flag ? 0.16f : 0.05f) + forca * 0.08f;
		float num2 = (flag ? (0.06f + forca * 0.04f) : 0.01f);
		float num3 = 0.22f + forca * 0.06f;
		float value = Random.value;
		if (value < num && Existe("SerpentMeat"))
		{
			nomePremio = "Sea serpent";
			itemA = "SerpentMeat";
			qtdA = 1;
			if (Existe("SerpentScale"))
			{
				itemB = "SerpentScale";
				chanceB = 0.55f;
			}
			if (Existe("TrophySerpent"))
			{
				itemC = "TrophySerpent";
				chanceC = 0.1f;
			}
			dificuldade = 110f;
			jeito = 1;
			return true;
		}
		if (value < num + num2 && Existe("Chitin"))
		{
			itemA = "Chitin";
			nomePremio = NomeDe(itemA);
			dificuldade = 95f;
			jeito = 3;
			return true;
		}
		if (value < num + num2 + num3 && monstros.Count > 0)
		{
			itemA = monstros[Random.Range(0, monstros.Count)];
			nomePremio = NomeDe(itemA);
			if (itemA == "Bloodbag" || itemA == "Leech")
			{
				dificuldade = 85f;
				jeito = 1;
			}
			else
			{
				dificuldade = 65f;
				jeito = 0;
			}
			return true;
		}
		if (peixes.Count == 0)
		{
			if (!Existe("SerpentMeat"))
			{
				return false;
			}
			nomePremio = "Sea serpent";
			itemA = "SerpentMeat";
			dificuldade = 110f;
			jeito = 1;
			return true;
		}
		itemA = peixes[Random.Range(0, peixes.Count)];
		nomePremio = NomeDe(itemA);
		dificuldade = Random.Range(35f, 90f);
		jeito = Random.Range(0, 5);
		return true;
	}

	private void ComecarBarra()
	{
		float num = habilidade * 10f;
		if (num < 0f)
		{
			num = 0f;
		}
		if (num > 10f)
		{
			num = 10f;
		}
		barraH = 168f + num * 14f;
		if (barraH > 320f)
		{
			barraH = 320f;
		}
		barraY = 568f - barraH;
		velBarra = 0f;
		peixeY = 508f;
		peixeVel = 0f;
		peixeAcel = 0f;
		peixeTempo = 0f;
		peixeAlvo = (100f - dificuldade) / 100f * 548f;
		progresso = 0.3f;
		tickAcum = 0f;
		fase = Fase.Barra;
	}

	private void AtualizarBarra(Player jogador, float dt, bool segura)
	{
		tickAcum += dt;
		if (tickAcum > 0.05f)
		{
			tickAcum = 0.05f;
		}
		while (tickAcum >= 1f / 60f)
		{
			tickAcum -= 1f / 60f;
			PassoPesca(jogador, segura);
			if (fase != Fase.Barra)
			{
				break;
			}
		}
	}

	private void PassoPesca(Player jogador, bool segura)
	{
		MoverPeixe();
		bool flag = PeixeNaBarra();
		float num = (segura ? (-0.25f) : 0.25f);
		float num2 = 568f - barraH;
		if (segura && (barraY <= 0f || barraY >= num2))
		{
			velBarra = 0f;
		}
		if (flag)
		{
			num *= 0.6f;
		}
		velBarra += num;
		barraY += velBarra;
		if (barraY > num2)
		{
			barraY = num2;
			velBarra = (0f - velBarra) * (2f / 3f);
		}
		else if (barraY < 0f)
		{
			barraY = 0f;
			velBarra = (0f - velBarra) * (2f / 3f);
		}
		if (flag)
		{
			progresso += 0.002f;
		}
		else
		{
			progresso -= 0.003f;
		}
		if (progresso > 1f)
		{
			progresso = 1f;
		}
		if (progresso >= 1f)
		{
			Entregar(jogador);
		}
		else if (progresso <= 0f)
		{
			((Character)jogador).RaiseSkill((SkillType)104, 0.15f);
			Encerrar(nomePremio + " got away.", mostrar: true);
			esperandoSoltar = true;
		}
	}

	private void MoverPeixe()
	{
		float num = ((jeito == 2) ? 20f : 1f);
		if (Random.value < dificuldade * num / 4000f && (jeito != 2 || peixeAlvo < 0f))
		{
			float num2 = 548f - peixeY;
			float num3 = Mathf.Min(99f, dificuldade + (float)Random.Range(10, 45)) / 100f;
			int num4 = (int)Mathf.Min(0f - peixeY, num2);
			int num5 = (int)num2;
			if (num4 < num5)
			{
				peixeAlvo = peixeY + (float)Random.Range(num4, num5) * num3;
			}
			else
			{
				peixeAlvo = peixeY;
			}
		}
		if (jeito == 4)
		{
			peixeTempo = Mathf.Max(peixeTempo - 0.01f, -1.5f);
		}
		else if (jeito == 3)
		{
			peixeTempo = Mathf.Min(peixeTempo + 0.01f, 1.5f);
		}
		if (Mathf.Abs(peixeY - peixeAlvo) > 3f && peixeAlvo >= 0f)
		{
			float num6 = (float)Random.Range(10, 30) + (100f - Mathf.Min(100f, dificuldade));
			peixeAcel = (peixeAlvo - peixeY) / num6;
			peixeVel += (peixeAcel - peixeVel) / 5f;
		}
		else if (jeito != 2 && Random.value < dificuldade / 2000f)
		{
			float num7 = ((Random.value < 0.5f) ? Random.Range(-100, -50) : Random.Range(50, 101));
			peixeAlvo = peixeY + num7;
		}
		else
		{
			peixeAlvo = -1f;
		}
		if (jeito == 1 && Random.value < dificuldade / 1000f)
		{
			int num8 = (int)dificuldade;
			int num9 = ((Random.value < 0.5f) ? Proximo(-100 - num8 * 2, -50) : Proximo(50, 101 + num8 * 2));
			peixeAlvo = peixeY + (float)num9;
		}
		if (peixeAlvo < -1f)
		{
			peixeAlvo = -1f;
		}
		if (peixeAlvo > 548f)
		{
			peixeAlvo = 548f;
		}
		peixeY += peixeVel + peixeTempo;
		if (peixeY > 532f)
		{
			peixeY = 532f;
		}
		else if (peixeY < 0f)
		{
			peixeY = 0f;
		}
	}

	private static int Proximo(int menor, int maior)
	{
		if (menor >= maior)
		{
			return maior;
		}
		return Random.Range(menor, maior);
	}

	private bool PeixeNaBarra()
	{
		bool flag = peixeY + 12f <= barraY - 32f + barraH && peixeY - 16f >= barraY - 32f;
		bool result = peixeY >= 548f - barraH && barraY >= 568f - barraH - 4f;
		if (!flag)
		{
			return result;
		}
		return true;
	}

	private void Entregar(Player jogador)
	{
		string ganhos = "";
		bool flag = Colocar(jogador, itemA, qtdA, ref ganhos);
		if (flag && itemB != null && Random.value < chanceB)
		{
			Colocar(jogador, itemB, 1, ref ganhos);
		}
		if (flag && itemC != null && Random.value < chanceC)
		{
			Colocar(jogador, itemC, 1, ref ganhos);
		}
		if (!flag)
		{
			Encerrar("Bag is full. It got away with the catch.", mostrar: true);
			esperandoSoltar = true;
			return;
		}
		((Character)jogador).RaiseSkill((SkillType)104, 1.15f);
		textoAviso = "You caught: " + ganhos + ".";
		Avisar(textoAviso, guardar: true);
		fase = Fase.Aviso;
		aviso = 2.4f;
		esperandoSoltar = true;
	}

	private bool Colocar(Player jogador, string prefab, int qtd, ref string ganhos)
	{
		if (string.IsNullOrEmpty(prefab) || qtd <= 0)
		{
			return false;
		}
		GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(prefab);
		if ((Object)(object)itemPrefab == (Object)null)
		{
			return false;
		}
		Inventory inventory = ((Humanoid)jogador).GetInventory();
		if (inventory == null || !inventory.CanAddItem(itemPrefab, qtd))
		{
			return false;
		}
		if (!inventory.AddItem(itemPrefab, qtd))
		{
			return false;
		}
		string text = NomeDe(prefab);
		if (qtd > 1)
		{
			text = text + " x" + qtd;
		}
		if (ganhos.Length == 0)
		{
			ganhos = text;
		}
		else
		{
			ganhos = ganhos + " e " + text;
		}
		return true;
	}

	private void Encerrar(string texto, bool mostrar)
	{
		fase = Fase.Nada;
		LimparCena();
		if (mostrar && !string.IsNullOrEmpty(texto))
		{
			Avisar(texto, guardar: true);
		}
	}

	private void Avisar(string texto, bool guardar)
	{
		if (string.IsNullOrEmpty(texto))
		{
			return;
		}
		((BaseUnityPlugin)this).Logger.LogInfo((object)texto);
		if (!((Object)(object)MessageHud.instance == (Object)null))
		{
			MessageHud.instance.ShowMessage((MessageType)2, texto, 0, (Sprite)null, true, guardar);
			if (guardar)
			{
				MessageHud.instance.ShowMessage((MessageType)1, texto, 0, (Sprite)null, true, true);
			}
		}
	}

	private void CriarCena(Player jogador)
	{
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b6: Expected O, but got Unknown
		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_013c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0152: Unknown result type (might be due to invalid IL or missing references)
		//IL_011d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0127: Expected O, but got Unknown
		LimparCena();
		boiaVisivel = GameObject.CreatePrimitive((PrimitiveType)0);
		((Object)boiaVisivel).name = "BoiaMonstros";
		boiaVisivel.transform.position = boia;
		boiaVisivel.transform.localScale = new Vector3(0.22f, 0.16f, 0.22f);
		Collider component = boiaVisivel.GetComponent<Collider>();
		if ((Object)(object)component != (Object)null)
		{
			Object.Destroy((Object)(object)component);
		}
		Renderer component2 = boiaVisivel.GetComponent<Renderer>();
		if ((Object)(object)component2 != (Object)null)
		{
			component2.material.color = new Color(0.82f, 0.12f, 0.1f);
		}
		GameObject val = new GameObject("LinhaMonstros");
		linha = val.AddComponent<LineRenderer>();
		linha.positionCount = 8;
		linha.startWidth = 0.012f;
		linha.endWidth = 0.008f;
		Shader val2 = Shader.Find("Sprites/Default");
		if ((Object)(object)val2 == (Object)null)
		{
			val2 = Shader.Find("Legacy Shaders/Particles/Alpha Blended");
		}
		if ((Object)(object)val2 != (Object)null)
		{
			((Renderer)linha).material = new Material(val2);
		}
		linha.startColor = new Color(0.9f, 0.9f, 0.82f);
		linha.endColor = linha.startColor;
		AcharVara(jogador);
	}

	private void PularPeixe()
	{
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)peixePulo != (Object)null)
		{
			Object.Destroy((Object)(object)peixePulo);
		}
		peixePulo = GameObject.CreatePrimitive((PrimitiveType)1);
		((Object)peixePulo).name = "PuloMonstros";
		peixePulo.transform.localScale = new Vector3(0.16f, 0.34f, 0.16f);
		peixePulo.transform.rotation = Quaternion.Euler(70f, 0f, 0f);
		Collider component = peixePulo.GetComponent<Collider>();
		if ((Object)(object)component != (Object)null)
		{
			Object.Destroy((Object)(object)component);
		}
		Renderer component2 = peixePulo.GetComponent<Renderer>();
		if ((Object)(object)component2 != (Object)null)
		{
			component2.material.color = new Color(0.95f, 0.45f, 0.12f);
		}
	}

	private void AcharVara(Player jogador)
	{
		//IL_0112: Unknown result type (might be due to invalid IL or missing references)
		//IL_0117: Unknown result type (might be due to invalid IL or missing references)
		pontaVara = null;
		ossoVara = null;
		ossoGuardado = false;
		if ((Object)(object)jogador == (Object)null)
		{
			return;
		}
		Transform[] componentsInChildren = ((Component)jogador).GetComponentsInChildren<Transform>(true);
		for (int i = 0; i < componentsInChildren.Length; i++)
		{
			if (((Object)componentsInChildren[i]).name == "_RodTop")
			{
				pontaVara = componentsInChildren[i];
				break;
			}
		}
		if ((Object)(object)pontaVara == (Object)null)
		{
			return;
		}
		Transform parent = pontaVara.parent;
		while ((Object)(object)parent != (Object)null && (Object)(object)parent != (Object)(object)((Component)jogador).transform)
		{
			string text = ((Object)parent).name.ToLowerInvariant();
			if (text.Contains("rod") || text.Contains("fishing") || text.Contains("vara"))
			{
				ossoVara = parent;
				break;
			}
			parent = parent.parent;
		}
		if ((Object)(object)ossoVara == (Object)null)
		{
			ossoVara = pontaVara.parent;
		}
		if ((Object)(object)ossoVara != (Object)null && (Object)(object)ossoVara != (Object)(object)((Component)jogador).transform)
		{
			ossoOriginal = ossoVara.localRotation;
			ossoGuardado = true;
		}
	}

	private void AtualizarCena(Player jogador, float tencao)
	{
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		//IL_013f: 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_014e: 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)
		//IL_0158: Unknown result type (might be due to invalid IL or missing references)
		//IL_016e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0173: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0101: Unknown result type (might be due to invalid IL or missing references)
		//IL_012f: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0235: Unknown result type (might be due to invalid IL or missing references)
		//IL_0249: Unknown result type (might be due to invalid IL or missing references)
		//IL_024e: Unknown result type (might be due to invalid IL or missing references)
		if (tencao < 0f)
		{
			tencao = 0f;
		}
		if (tencao > 1f)
		{
			tencao = 1f;
		}
		if ((Object)(object)boiaVisivel == (Object)null)
		{
			CriarCena(jogador);
		}
		if ((Object)(object)pontaVara == (Object)null)
		{
			AcharVara(jogador);
		}
		float num = Mathf.Sin(Time.time * 3f) * 0.05f;
		Vector3 val = boia;
		val.y += num - tencao * 0.62f;
		if ((Object)(object)boiaVisivel != (Object)null)
		{
			boiaVisivel.transform.position = val;
		}
		if ((Object)(object)peixePulo != (Object)null)
		{
			float num2 = Mathf.Sin(Time.time * 9f);
			if (num2 < 0f)
			{
				num2 = 0f;
			}
			Vector3 position = boia;
			position.y += 0.25f + num2 * (0.35f + tencao * 1.1f);
			peixePulo.transform.position = position;
			peixePulo.transform.rotation = Quaternion.Euler(70f - tencao * 40f, Time.time * 40f, 0f);
		}
		Vector3 val2 = ((Component)jogador).transform.position + Vector3.up * 1.4f;
		if ((Object)(object)pontaVara != (Object)null)
		{
			val2 = pontaVara.position;
		}
		if ((Object)(object)linha != (Object)null)
		{
			float num3 = (1f - tencao) * 0.85f;
			for (int i = 0; i < 8; i++)
			{
				float num4 = (float)i / 7f;
				Vector3 val3 = Vector3.Lerp(val2, val, num4);
				val3.y -= Mathf.Sin(num4 * 3.14159f) * num3;
				linha.SetPosition(i, val3);
			}
		}
		if (ossoGuardado && (Object)(object)ossoVara != (Object)null)
		{
			float num5 = tencao * 38f;
			float num6 = 0f;
			if (tencao > 0.5f)
			{
				num6 = Mathf.Sin(Time.time * 22f) * 6f * tencao;
			}
			ossoVara.localRotation = ossoOriginal * Quaternion.Euler(num5 + num6, 0f, 0f);
		}
	}

	private void LimparCena()
	{
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		if (ossoGuardado && (Object)(object)ossoVara != (Object)null)
		{
			ossoVara.localRotation = ossoOriginal;
		}
		ossoGuardado = false;
		ossoVara = null;
		pontaVara = null;
		if ((Object)(object)boiaVisivel != (Object)null)
		{
			Object.Destroy((Object)(object)boiaVisivel);
		}
		boiaVisivel = null;
		if ((Object)(object)peixePulo != (Object)null)
		{
			Object.Destroy((Object)(object)peixePulo);
		}
		peixePulo = null;
		if ((Object)(object)linha != (Object)null)
		{
			Object.Destroy((Object)(object)((Component)linha).gameObject);
		}
		linha = null;
	}

	private bool TemAgua(Player jogador, float potencia, out Vector3 ponto)
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: 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_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_012b: Unknown result type (might be due to invalid IL or missing references)
		//IL_012d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0108: 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)
		ponto = ((Component)jogador).transform.position;
		Vector3 val = ((Character)jogador).GetLookDir();
		if ((Object)(object)GameCamera.instance != (Object)null)
		{
			val = ((Component)GameCamera.instance).transform.forward;
		}
		val.y = 0f;
		if (((Vector3)(ref val)).sqrMagnitude < 0.01f)
		{
			val = ((Component)jogador).transform.forward;
		}
		((Vector3)(ref val)).Normalize();
		if (((Character)jogador).InWater())
		{
			Vector3 position = ((Component)jogador).transform.position;
			if (Superficie(position, out var superficie))
			{
				ponto = superficie;
				return true;
			}
		}
		float num = 2f + potencia * 18f;
		float num2 = -1f;
		Vector3 val2 = ponto;
		for (float num3 = num; num3 >= 1.2f; num3 -= 1.2f)
		{
			Vector3 teste = ((Component)jogador).transform.position + val * num3;
			if (Superficie(teste, out var superficie2))
			{
				float num4 = ((Component)jogador).transform.position.y - superficie2.y;
				if (num4 < 18f && num4 > -6f && num3 > num2)
				{
					num2 = num3;
					val2 = superficie2;
				}
			}
		}
		if (num2 < 0f)
		{
			return false;
		}
		ponto = val2;
		return true;
	}

	private bool Superficie(Vector3 teste, out Vector3 superficie)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0009: 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_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		superficie = teste;
		WaterVolume val = null;
		float waterLevel = Floating.GetWaterLevel(teste, ref val);
		if ((Object)(object)val != (Object)null && (int)val.GetLiquidType() != 0)
		{
			return false;
		}
		float num = teste.y;
		if ((Object)(object)ZoneSystem.instance != (Object)null)
		{
			num = ZoneSystem.instance.GetGroundHeight(teste);
		}
		if (waterLevel < num - 0.05f)
		{
			return false;
		}
		superficie = new Vector3(teste.x, waterLevel, teste.z);
		return true;
	}

	private void MontarLista()
	{
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_008d: Invalid comparison between Unknown and I4
		if (listaPronta || (Object)(object)ObjectDB.instance == (Object)null)
		{
			return;
		}
		peixes.Clear();
		monstros.Clear();
		foreach (GameObject item in ObjectDB.instance.m_items)
		{
			if ((Object)(object)item == (Object)null)
			{
				continue;
			}
			ItemDrop component = item.GetComponent<ItemDrop>();
			if (!((Object)(object)component == (Object)null) && component.m_itemData != null && component.m_itemData.m_shared != null && (int)component.m_itemData.m_shared.m_itemType == 21)
			{
				string text = ((Object)item).name.ToLowerInvariant();
				if (!text.Contains("bait") && !text.Contains("rod") && !text.Contains("cooked") && !text.Contains("grilled"))
				{
					peixes.Add(((Object)item).name);
				}
			}
		}
		if (peixes.Count == 0)
		{
			string[] array = new string[13]
			{
				"FishRaw", "Fish1", "Fish2", "Fish3", "Fish4_cave", "Fish5", "Fish6", "Fish7", "Fish8", "Fish9",
				"Fish10", "Fish11", "Fish12"
			};
			for (int i = 0; i < array.Length; i++)
			{
				if (Existe(array[i]))
				{
					peixes.Add(array[i]);
				}
			}
		}
		string[] array2 = new string[3] { "NeckTail", "Bloodbag", "Leech" };
		for (int j = 0; j < array2.Length; j++)
		{
			if (Existe(array2[j]))
			{
				monstros.Add(array2[j]);
			}
		}
		listaPronta = true;
		((BaseUnityPlugin)this).Logger.LogInfo((object)("Fish " + peixes.Count + ", monsters " + monstros.Count));
	}

	private bool Existe(string nome)
	{
		if ((Object)(object)ObjectDB.instance != (Object)null)
		{
			return (Object)(object)ObjectDB.instance.GetItemPrefab(nome) != (Object)null;
		}
		return false;
	}

	private string NomeDe(string prefab)
	{
		if ((Object)(object)ObjectDB.instance == (Object)null)
		{
			return prefab;
		}
		GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(prefab);
		if ((Object)(object)itemPrefab == (Object)null)
		{
			return prefab;
		}
		ItemDrop component = itemPrefab.GetComponent<ItemDrop>();
		if ((Object)(object)component == (Object)null || component.m_itemData == null || component.m_itemData.m_shared == null)
		{
			return prefab;
		}
		string text = component.m_itemData.m_shared.m_name;
		if (Localization.instance != null)
		{
			text = Localization.instance.Localize(text);
		}
		return text;
	}

	public static bool ComVara(Player jogador)
	{
		if ((Object)(object)jogador == (Object)null)
		{
			return false;
		}
		ItemData rightItem = ((Humanoid)jogador).RightItem;
		if (rightItem == null || rightItem.m_shared == null)
		{
			return false;
		}
		if (rightItem.m_shared.m_name == "River Monsters Rod" || rightItem.m_shared.m_name == "Vara Monstros do Rio")
		{
			return true;
		}
		if (rightItem.m_shared.m_name == "$item_fishingrod")
		{
			return true;
		}
		if ((Object)(object)rightItem.m_dropPrefab == (Object)null)
		{
			return false;
		}
		string name = ((Object)rightItem.m_dropPrefab).name;
		if (!(name == "VaraMonstrosDoRio"))
		{
			return name == "FishingRod";
		}
		return true;
	}

	private static bool Segurando()
	{
		if (Input.GetMouseButton(0))
		{
			return true;
		}
		if (ZInput.GetMouseButton(0))
		{
			return true;
		}
		return ZInput.GetButton("Attack");
	}

	private static bool Apertou()
	{
		if (!ZInput.GetButtonDown("Attack"))
		{
			return ZInput.GetMouseButtonDown(0);
		}
		return true;
	}

	private static bool Soltou()
	{
		if (!ZInput.GetButtonUp("Attack"))
		{
			return ZInput.GetMouseButtonUp(0);
		}
		return true;
	}

	public static void Registrar(ObjectDB db)
	{
		if ((Object)(object)Inst == (Object)null || (Object)(object)db == (Object)null || db.m_recipes == null)
		{
			return;
		}
		Recipe val = null;
		for (int i = 0; i < db.m_recipes.Count; i++)
		{
			Recipe val2 = db.m_recipes[i];
			if (!((Object)(object)val2 == (Object)null) && !((Object)(object)val2.m_item == (Object)null) && !((Object)(object)((Component)val2.m_item).gameObject == (Object)null) && ((Object)((Component)val2.m_item).gameObject).name == "FishingRod")
			{
				val = val2;
				break;
			}
		}
		if ((Object)(object)val == (Object)null)
		{
			GameObject itemPrefab = db.GetItemPrefab("FishingRod");
			if ((Object)(object)itemPrefab == (Object)null)
			{
				return;
			}
			ItemDrop component = itemPrefab.GetComponent<ItemDrop>();
			if ((Object)(object)component == (Object)null)
			{
				return;
			}
			val = ScriptableObject.CreateInstance<Recipe>();
			((Object)val).name = "Recipe_VaraMonstrosDoRio";
			val.m_item = component;
			val.m_amount = 1;
			val.m_craftingStation = AcharBancada(db);
			val.m_minStationLevel = 1;
			List<Requirement> list = new List<Requirement>();
			Requirement val3 = Custo(db, "Wood", 8);
			if (val3 != null)
			{
				list.Add(val3);
			}
			Requirement val4 = Custo(db, "Resin", 4);
			if (val4 != null)
			{
				list.Add(val4);
			}
			val.m_resources = list.ToArray();
			db.m_recipes.Add(val);
			MethodInfo method = typeof(ObjectDB).GetMethod("UpdateRegisters", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			if (method != null)
			{
				method.Invoke(db, null);
			}
		}
		val.m_enabled = true;
		Receita = val;
		Inst.receitaPronta = true;
		string text = "no station";
		if ((Object)(object)val.m_craftingStation != (Object)null && (Object)(object)((Component)val.m_craftingStation).gameObject != (Object)null)
		{
			text = ((Object)((Component)val.m_craftingStation).gameObject).name;
		}
		((BaseUnityPlugin)Inst).Logger.LogInfo((object)("Rod ready at station " + text));
	}

	private static CraftingStation AcharBancada(ObjectDB db)
	{
		for (int i = 0; i < db.m_recipes.Count; i++)
		{
			Recipe val = db.m_recipes[i];
			if (!((Object)(object)val == (Object)null) && !((Object)(object)val.m_craftingStation == (Object)null))
			{
				string text = ((Object)((Component)val.m_craftingStation).gameObject).name.ToLowerInvariant();
				if (text.Contains("workbench"))
				{
					return val.m_craftingStation;
				}
			}
		}
		return null;
	}

	private static Requirement Custo(ObjectDB db, string prefab, int qtd)
	{
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Expected O, but got Unknown
		GameObject itemPrefab = db.GetItemPrefab(prefab);
		if ((Object)(object)itemPrefab == (Object)null)
		{
			return null;
		}
		ItemDrop component = itemPrefab.GetComponent<ItemDrop>();
		if ((Object)(object)component == (Object)null)
		{
			return null;
		}
		Requirement val = new Requirement();
		val.m_resItem = component;
		val.m_amount = qtd;
		return val;
	}

	private void OnGUI()
	{
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: Expected O, but got Unknown
		//IL_0039: 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_006e: Expected O, but got Unknown
		//IL_0092: Unknown result type (might be due to invalid IL or missing references)
		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b9: Expected O, but got Unknown
		//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_0152: Unknown result type (might be due to invalid IL or missing references)
		//IL_016b: Unknown result type (might be due to invalid IL or missing references)
		//IL_019a: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_020b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0246: Unknown result type (might be due to invalid IL or missing references)
		//IL_027d: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0351: Unknown result type (might be due to invalid IL or missing references)
		//IL_036a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0388: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_03de: Unknown result type (might be due to invalid IL or missing references)
		//IL_0405: Unknown result type (might be due to invalid IL or missing references)
		//IL_040a: Unknown result type (might be due to invalid IL or missing references)
		//IL_041a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0433: Unknown result type (might be due to invalid IL or missing references)
		//IL_04c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0505: Unknown result type (might be due to invalid IL or missing references)
		//IL_051e: Unknown result type (might be due to invalid IL or missing references)
		//IL_057c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0566: Unknown result type (might be due to invalid IL or missing references)
		//IL_0581: Unknown result type (might be due to invalid IL or missing references)
		//IL_05a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_05a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_05d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0610: Unknown result type (might be due to invalid IL or missing references)
		if (fase == Fase.Nada || !Ligado.Value)
		{
			return;
		}
		if ((Object)(object)pixel == (Object)null)
		{
			pixel = new Texture2D(1, 1);
			pixel.SetPixel(0, 0, Color.white);
			pixel.Apply();
		}
		if (estilo == null)
		{
			estilo = new GUIStyle(GUI.skin.label);
			estilo.alignment = (TextAnchor)4;
			estilo.fontSize = 18;
			estilo.normal.textColor = Color.white;
			estilo.wordWrap = true;
			estiloGrande = new GUIStyle(estilo);
			estiloGrande.fontSize = 64;
			estiloGrande.fontStyle = (FontStyle)1;
			estiloGrande.normal.textColor = new Color(1f, 0.86f, 0.2f);
		}
		float num = (float)Screen.height / 1080f;
		if (num < 0.7f)
		{
			num = 0.7f;
		}
		if (fase == Fase.Forca)
		{
			float num2 = 280f * num;
			float num3 = 28f * num;
			float num4 = ((float)Screen.width - num2) * 0.5f;
			float num5 = (float)Screen.height - 160f * num;
			Caixa(new Rect(num4, num5, num2, num3), new Color(0.05f, 0.08f, 0.1f, 0.85f));
			Caixa(new Rect(num4 + 3f, num5 + 3f, (num2 - 6f) * forca, num3 - 6f), new Color(0.35f, 0.75f, 0.28f, 0.95f));
			GUI.Label(new Rect(num4, num5 - 28f * num, num2, 24f * num), "Cast strength", estilo);
		}
		else if (fase == Fase.Espera)
		{
			GUI.Label(new Rect(0f, (float)Screen.height * 0.72f, (float)Screen.width, 40f), "The bobber is in the water. Wait for a bite.", estilo);
		}
		else if (fase == Fase.Fisgou)
		{
			GUI.Label(new Rect(0f, (float)Screen.height * 0.38f, (float)Screen.width, 80f), "!", estiloGrande);
			GUI.Label(new Rect(0f, (float)Screen.height * 0.38f + 70f, (float)Screen.width, 36f), "Hold the left button", estilo);
		}
		else if (fase == Fase.Aviso)
		{
			GUI.Label(new Rect((float)Screen.width * 0.2f, (float)Screen.height * 0.4f, (float)Screen.width * 0.6f, 80f), textoAviso, estilo);
		}
		else if (fase == Fase.Barra)
		{
			float num6 = 520f * num;
			float num7 = 46f * num;
			float num8 = (float)Screen.width - num7 - 110f * num;
			float num9 = ((float)Screen.height - num6) * 0.5f;
			float num10 = 18f * num;
			Caixa(new Rect(num8 - 16f * num, num9 - 36f * num, num7 + num10 + 40f * num, num6 + 78f * num), new Color(0.08f, 0.12f, 0.1f, 0.55f));
			Caixa(new Rect(num8 - num10 - 8f * num, num9, num10, num6), new Color(0.04f, 0.05f, 0.06f, 0.9f));
			Color c = Color.Lerp(new Color(0.75f, 0.22f, 0.16f), new Color(0.32f, 0.78f, 0.28f), progresso);
			float num11 = num6 * progresso;
			Caixa(new Rect(num8 - num10 - 8f * num, num9 + num6 - num11, num10, num11), c);
			Caixa(new Rect(num8, num9, num7, num6), new Color(0.05f, 0.16f, 0.22f, 0.94f));
			float num12 = barraY - 16f;
			float num13 = barraH - 28f;
			if (num12 < 0f)
			{
				num13 += num12;
				num12 = 0f;
			}
			if (num12 + num13 > 568f)
			{
				num13 = 568f - num12;
			}
			if (num13 < 8f)
			{
				num13 = 8f;
			}
			float num14 = num13 / 568f * num6;
			float num15 = num9 + num12 / 568f * num6;
			Caixa(new Rect(num8 + 3f, num15, num7 - 6f, num14), new Color(0.45f, 0.78f, 0.28f, 0.92f));
			Caixa(new Rect(num8 + 3f, num15, num7 - 6f, 4f * num), new Color(0.75f, 0.95f, 0.55f, 0.95f));
			float num16 = num9 + peixeY / 568f * num6;
			float num17 = 16f * num;
			Color c2 = ((nomePremio == "Sea serpent") ? new Color(0.15f, 0.72f, 0.32f) : new Color(0.95f, 0.55f, 0.16f));
			Caixa(new Rect(num8 + (num7 - num17) * 0.5f, num16 - num17 * 0.5f, num17, num17), c2);
			GUI.Label(new Rect(num8 - 80f * num, num9 - 32f * num, num7 + 120f * num, 28f * num), nomePremio, estilo);
			GUI.Label(new Rect(num8 - 180f * num, num9 + num6 + 8f * num, num7 + 280f * num, 48f * num), "Hold the left button to rise. Release to fall.", estilo);
		}
	}

	private void Caixa(Rect r, Color c)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		Color color = GUI.color;
		GUI.color = c;
		GUI.DrawTexture(r, (Texture)(object)pixel);
		GUI.color = color;
	}

	private static bool EhBancada(string nome)
	{
		switch (nome)
		{
		default:
			return nome == "ArrowFlint";
		case "Hammer":
		case "Torch":
		case "Bow":
		case "Club":
		case "ArrowWood":
		case "ArrowFire":
			return true;
		}
	}

	public static void ColocarNaLista(List<Recipe> lista)
	{
		if ((Object)(object)Inst == (Object)null || !Inst.Ligado.Value || lista == null)
		{
			return;
		}
		CraftingStation val = null;
		int num = -1;
		for (int i = 0; i < lista.Count; i++)
		{
			Recipe val2 = lista[i];
			if (!((Object)(object)val2 == (Object)null) && !((Object)(object)val2.m_item == (Object)null) && !((Object)(object)((Component)val2.m_item).gameObject == (Object)null))
			{
				string name = ((Object)((Component)val2.m_item).gameObject).name;
				if (name == "FishingRod")
				{
					num = i;
				}
				if ((Object)(object)val == (Object)null && EhBancada(name) && (Object)(object)val2.m_craftingStation != (Object)null)
				{
					val = val2.m_craftingStation;
				}
			}
		}
		if ((Object)(object)val == (Object)null)
		{
			return;
		}
		if (num > 0)
		{
			Recipe item = lista[num];
			lista.RemoveAt(num);
			lista.Insert(0, item);
			AvisarLista();
			return;
		}
		if (num == 0)
		{
			AvisarLista();
			return;
		}
		Recipe val3 = ReceitaDaBancada(val);
		if (!((Object)(object)val3 == (Object)null))
		{
			lista.Insert(0, val3);
			AvisarLista();
		}
	}

	private static void AvisarLista()
	{
		if (!((Object)(object)Inst == (Object)null) && !Inst.entrouNaLista)
		{
			Inst.entrouNaLista = true;
			((BaseUnityPlugin)Inst).Logger.LogInfo((object)"Fishing rod placed at the top of crafting");
		}
	}

	private static Recipe ReceitaDaBancada(CraftingStation bancada)
	{
		if ((Object)(object)Receita != (Object)null)
		{
			Receita.m_craftingStation = bancada;
			Receita.m_enabled = true;
			Receita.m_minStationLevel = 1;
			return Receita;
		}
		if ((Object)(object)ObjectDB.instance == (Object)null)
		{
			return null;
		}
		Registrar(ObjectDB.instance);
		if ((Object)(object)Receita == (Object)null)
		{
			return null;
		}
		Receita.m_craftingStation = bancada;
		Receita.m_enabled = true;
		Receita.m_minStationLevel = 1;
		return Receita;
	}
}