Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of JarvisCompanion v0.29.4
plugins/JarvisCompanion/JarvisCompanion.dll
Decompiled an hour 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.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using JarvisCompanion.Core; using Microsoft.CodeAnalysis; using Splatform; using TMPro; using UnityEngine; using UnityEngine.Audio; using UnityEngine.Networking; using UnityEngine.UI; using Valheim.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("assembly_utils")] [assembly: IgnoresAccessChecksTo("assembly_valheim")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("JarvisCompanion")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.29.4.0")] [assembly: AssemblyInformationalVersion("0.29.4+c3725e6e9e4e4ba4bfdbefa71458ba712ea5e82f")] [assembly: AssemblyProduct("JarvisCompanion")] [assembly: AssemblyTitle("JarvisCompanion")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.29.4.0")] [module: UnverifiableCode] [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 JarvisCompanion { public static class ArmaduraBot { [HarmonyPatch(typeof(Character), "GetBodyArmor")] private static class Character_GetBodyArmor { private static void Postfix(Character __instance, ref float __result) { if (BotBody.EhBot(__instance)) { Humanoid val = (Humanoid)(object)((__instance is Humanoid) ? __instance : null); if (val != null) { __result = Total(val); } } } } [HarmonyPatch(typeof(Character), "ApplyArmorDamageMods")] private static class Character_ApplyArmorDamageMods { private static void Postfix(Character __instance, ref DamageModifiers mods) { if (!BotBody.EhBot(__instance)) { return; } Humanoid val = (Humanoid)(object)((__instance is Humanoid) ? __instance : null); if (val == null) { return; } foreach (ItemData item in Pecas(val)) { ((DamageModifiers)(ref mods)).Apply(item.m_shared.m_damageModifiers); } } } [HarmonyPatch(typeof(Character), "DamageArmorDurability")] private static class Character_DamageArmorDurability { private static void Postfix(Character __instance, HitData hit) { if (!BotBody.EhBot(__instance)) { return; } Humanoid val = (Humanoid)(object)((__instance is Humanoid) ? __instance : null); if (val == null || hit == null) { return; } List<ItemData> list = new List<ItemData>(Pecas(val)); if (list.Count != 0) { float num = hit.GetTotalPhysicalDamage() + hit.GetTotalElementalDamage(); if (!(num <= 0f)) { ItemData val2 = list[Random.Range(0, list.Count)]; val2.m_durability = Mathf.Max(0f, val2.m_durability - num); } } } } [HarmonyPatch(typeof(Character), "RPC_Damage")] private static class Character_RPC_Damage { private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instrucoes) { List<CodeInstruction> list = new List<CodeInstruction>(instrucoes); MethodInfo methodInfo = AccessTools.Method(typeof(Character), "IsPlayer", (Type[])null, (Type[])null); MethodInfo armadura = AccessTools.Method(typeof(Character), "GetBodyArmor", (Type[])null, (Type[])null); int num = list.FindIndex((CodeInstruction c) => CodeInstructionExtensions.Calls(c, armadura)); int num2 = -1; int num3 = num - 1; while (num3 >= 0 && num3 >= num - 12) { if (CodeInstructionExtensions.Calls(list[num3], methodInfo)) { num2 = num3; break; } num3--; } if (num < 0 || num2 < 0) { Plugin.Log.LogError((object)"Armadura do bot: não achei o lugar no RPC_Damage (o jogo mudou?). O bot vai ficar sem armadura."); return list; } list[num2].opcode = OpCodes.Call; list[num2].operand = AccessTools.Method(typeof(ArmaduraBot), "ArmaduraVale", (Type[])null, (Type[])null); return list; } } private static IEnumerable<ItemData> Pecas(Humanoid h) { if (h.m_chestItem != null) { yield return h.m_chestItem; } if (h.m_legItem != null) { yield return h.m_legItem; } if (h.m_helmetItem != null) { yield return h.m_helmetItem; } if (h.m_shoulderItem != null) { yield return h.m_shoulderItem; } } public static bool ArmaduraVale(Character c) { if (!c.IsPlayer()) { return BotBody.EhBot(c); } return true; } public static float Total(Humanoid h) { float num = 0f; foreach (ItemData item in Pecas(h)) { num += item.GetArmor(); } SEMan sEMan = ((Character)h).GetSEMan(); if (sEMan != null) { sEMan.ApplyArmorMods(ref num); } return num; } } public class BotBody : MonoBehaviour, Interactable { public static readonly List<BotBody> Todos = new List<BotBody>(); private static readonly HashSet<Character> s_personagens = new HashSet<Character>(); private static readonly HashSet<Container> s_mochilas = new HashSet<Container>(); public static readonly int ChaveDono = StringExtensionMethods.GetStableHashCode("JarvisCompanion_dono"); public static readonly int ChaveNomeDono = StringExtensionMethods.GetStableHashCode("JarvisCompanion_nomeDono"); public static readonly int ChaveCaido = StringExtensionMethods.GetStableHashCode("JarvisCompanion_caido"); public static readonly int ChaveCaidoAte = StringExtensionMethods.GetStableHashCode("JarvisCompanion_caidoAte"); private const string RpcLevantar = "JarvisCompanion_Levantar"; private const string RpcFalar = "JarvisCompanion_Falar"; private static BotBody s_revivendo; private static float s_progressoReviver; private static float s_ultimoSegurar; public const int Modelo = 0; public const string Cabelo = "Hair3"; public const string Barba = "Beard3"; public static readonly Vector3 CorCabelo = new Vector3(0.55f, 0.38f, 0.22f); public static readonly Vector3 CorPele = Vector3.one; private static readonly Dictionary<Inventory, BotBody> s_porInventario = new Dictionary<Inventory, BotBody>(); public static bool MovendoDoPainel; private bool _revisarEquipamento; private readonly HashSet<ItemData> _fotoMochila = new HashSet<ItemData>(); private readonly List<ItemData> _novosNaMochila = new List<ItemData>(); private bool _arrumandoMochila; private Animator _animador; private bool _ajoelhado; public float SegundosCaido { get { if (!Caido || (Object)(object)ZNet.instance == (Object)null) { return 0f; } long num = NView.GetZDO().GetLong(ChaveCaidoAte, 0L); return Mathf.Max(0f, (float)((double)(num - ZNet.instance.GetTime().Ticks) / 10000000.0)); } } public bool Caido { get { if (Object.op_Implicit((Object)(object)NView) && NView.IsValid()) { return NView.GetZDO().GetBool(ChaveCaido, false); } return false; } } public float ProgressoReviver { get { if (!((Object)(object)s_revivendo == (Object)(object)this) || !(Time.time - s_ultimoSegurar < 0.5f)) { return 0f; } return Mathf.Clamp01(s_progressoReviver / Mathf.Max(0.1f, Plugin.TempoReviver.Value)); } } public ZNetView NView { get; private set; } public Humanoid Humanoid { get; private set; } public Container Mochila { get; private set; } public BotStatus Status { get; private set; } public Inventory Inventario { get { if (!Object.op_Implicit((Object)(object)Humanoid)) { return null; } return Humanoid.m_inventory; } } public Inventory MochilaInv { get { if (!Object.op_Implicit((Object)(object)Mochila)) { return null; } return Mochila.GetInventory(); } } public long DonoId { get { if (!Object.op_Implicit((Object)(object)NView) || !NView.IsValid()) { return 0L; } return NView.GetZDO().GetLong(ChaveDono, 0L); } } public string NomeDono { get { if (!Object.op_Implicit((Object)(object)NView) || !NView.IsValid()) { return ""; } return NView.GetZDO().GetString(ChaveNomeDono, ""); } } public bool EhDoJogadorLocal { get { if ((Object)(object)Player.m_localPlayer != (Object)null && DonoId != 0L) { return DonoId == Player.m_localPlayer.GetPlayerID(); } return false; } } public bool InventarioAberto { get { if ((Object)(object)Mochila != (Object)null && (Object)(object)InventoryGui.instance != (Object)null && InventoryGui.IsVisible()) { return (Object)(object)InventoryGui.instance.m_currentContainer == (Object)(object)Mochila; } return false; } } public static string Relogio(float segundos) { int num = Mathf.CeilToInt(Mathf.Max(0f, segundos)); return $"{num / 60}:{num % 60:00}"; } public static bool EstaCaido(Character c) { BotBody botBody = (Object.op_Implicit((Object)(object)c) ? ((Component)c).GetComponent<BotBody>() : null); if (Object.op_Implicit((Object)(object)botBody)) { return botBody.Caido; } return false; } public static bool EhBot(Character c) { if ((Object)(object)c != (Object)null) { return s_personagens.Contains(c); } return false; } public static bool EhMochilaDeBot(Container c) { if ((Object)(object)c != (Object)null) { return s_mochilas.Contains(c); } return false; } public static bool EhInventarioDeBot(Inventory inv) { if (inv != null) { return s_porInventario.ContainsKey(inv); } return false; } public static bool EhPainel(Humanoid h) { if ((Object)(object)h != (Object)null) { return EhInventarioDeBot(h.m_inventory); } return false; } public static void AntesDeTirarDaMochila(Inventory de, ItemData item) { if (de != null && item != null && s_porInventario.TryGetValue(de, out var value) && Object.op_Implicit((Object)(object)value.Humanoid)) { bool num = BotEquipamento.EhUtilitarioExtra(value.Humanoid, item); if (value.Humanoid.IsItemEquiped(item)) { value.Humanoid.UnequipItem(item, false); } item.m_equipped = false; if (num) { value._revisarEquipamento = true; } } } public static void AntesDeEsvaziarAMochila(Inventory de) { if (de == null || !s_porInventario.TryGetValue(de, out var value) || !Object.op_Implicit((Object)(object)value.Humanoid)) { return; } value.Humanoid.UnequipAllItems(); foreach (ItemData allItem in de.GetAllItems()) { allItem.m_equipped = false; } } private void Awake() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) NView = ((Component)this).GetComponent<ZNetView>(); Humanoid = ((Component)this).GetComponent<Humanoid>(); Mochila = ((Component)this).GetComponentInChildren<Container>(true); Status = ((Component)this).GetComponent<BotStatus>(); ((Component)this).transform.localScale = Vector3.one; Todos.Add(this); if (Object.op_Implicit((Object)(object)Humanoid)) { s_personagens.Add((Character)(object)Humanoid); } if (Inventario != null) { Inventario.m_width = 5; Inventario.m_height = 5; Inventario.m_name = Tr.T("Equipamento"); s_porInventario[Inventario] = this; } if (Object.op_Implicit((Object)(object)Mochila)) { s_mochilas.Add(Mochila); } if (Object.op_Implicit((Object)(object)NView) && NView.GetZDO() != null) { NView.Register("JarvisCompanion_Levantar", (Action<long>)RPC_Levantar); NView.Register<string, float, bool>("JarvisCompanion_Falar", (Action<long, string, float, bool>)RPC_Falar); } ((Component)this).gameObject.AddComponent<MusicaDosOutros>(); } private void Start() { if (Object.op_Implicit((Object)(object)NView) && NView.IsValid() && NView.IsOwner()) { AplicarAparencia(); Inventory inventario = Inventario; if (inventario != null) { inventario.m_onChanged = (Action)Delegate.Combine(inventario.m_onChanged, new Action(AoMudarPainel)); } Inventory mochilaInv = MochilaInv; if (mochilaInv != null) { mochilaInv.m_onChanged = (Action)Delegate.Combine(mochilaInv.m_onChanged, new Action(AoMudarMochila)); } TirarFotoDaMochila(); _revisarEquipamento = true; } } private void TirarFotoDaMochila() { _fotoMochila.Clear(); Inventory mochilaInv = MochilaInv; if (mochilaInv != null) { _fotoMochila.UnionWith(mochilaInv.GetAllItems()); } } private void AoMudarMochila() { Inventory mochilaInv = MochilaInv; if (mochilaInv == null) { return; } if (!_arrumandoMochila && !MovendoDoPainel) { foreach (ItemData allItem in mochilaInv.GetAllItems()) { if (!_fotoMochila.Contains(allItem) && !_novosNaMochila.Contains(allItem)) { _novosNaMochila.Add(allItem); } } } TirarFotoDaMochila(); } private void VestirNovosDaMochila() { Inventory mochilaInv = MochilaInv; if (mochilaInv == null || _novosNaMochila.Count == 0) { return; } _arrumandoMochila = true; try { ItemData[] array = _novosNaMochila.ToArray(); foreach (ItemData item in array) { BotEquipamento.TentarVestirDaMochila(Humanoid, mochilaInv, item); } } finally { _arrumandoMochila = false; _novosNaMochila.Clear(); TirarFotoDaMochila(); } } private void AoMudarPainel() { if (Object.op_Implicit((Object)(object)Humanoid)) { BotEquipamento.DesvestirOQueSaiu(Humanoid); _revisarEquipamento = true; } } private void AtualizarAnimacaoCaido() { bool caido = Caido; if (caido == _ajoelhado) { return; } if ((Object)(object)_animador == (Object)null) { _animador = ((Component)this).GetComponentInChildren<Animator>(); } if (!((Object)(object)_animador == (Object)null)) { _ajoelhado = caido; if (caido) { _animador.ResetTrigger("emote_stop"); _animador.SetBool("emote_kneel", true); } else { _animador.SetBool("emote_kneel", false); _animador.SetTrigger("emote_stop"); } } } private void Update() { AtualizarAnimacaoCaido(); if (!Object.op_Implicit((Object)(object)Humanoid) || !Object.op_Implicit((Object)(object)NView) || !NView.IsValid() || !NView.IsOwner()) { return; } if (_novosNaMochila.Count > 0) { try { VestirNovosDaMochila(); } catch (Exception ex) { Plugin.Log.LogError((object)("Erro ao vestir o que chegou na mochila: " + ex)); } } if (!_revisarEquipamento) { return; } _revisarEquipamento = false; try { BotEquipamento.Sincronizar(Humanoid); } catch (Exception ex2) { Plugin.Log.LogError((object)("Erro ao vestir o bot: " + ex2)); } } private void OnDestroy() { Todos.Remove(this); if (Object.op_Implicit((Object)(object)Humanoid)) { s_personagens.Remove((Character)(object)Humanoid); } if (Object.op_Implicit((Object)(object)Mochila)) { s_mochilas.Remove(Mochila); } if (Inventario != null) { s_porInventario.Remove(Inventario); } BotManager.AoDestruirCorpo(this); } private void AplicarAparencia() { //IL_006d: 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) VisEquipment val = (Object.op_Implicit((Object)(object)Humanoid) ? Humanoid.m_visEquipment : null); if (Object.op_Implicit((Object)(object)val)) { Humanoid.SetHair("Hair3"); Humanoid.SetBeard("Beard3"); val.SetHairItem(StringExtensionMethods.GetStableHashCode("Hair3")); val.SetBeardItem(StringExtensionMethods.GetStableHashCode("Beard3")); val.SetModel(0); val.SetHairColor(CorCabelo); val.SetSkinColor(CorPele); } } public void Falar(string texto, float segundos = 6f, bool resmungar = true) { MostrarBalao(texto, segundos); if (resmungar) { SonsBot.Tocar(((Component)this).transform); } if (Object.op_Implicit((Object)(object)NView) && NView.IsValid() && NView.IsOwner() && (Object)(object)ZNet.instance != (Object)null && ZRoutedRpc.instance != null) { NView.InvokeRPC(ZNetView.Everybody, "JarvisCompanion_Falar", new object[3] { texto ?? "", segundos, resmungar }); } } private void MostrarBalao(string texto, float segundos) { //IL_0018: 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) if ((Object)(object)Chat.instance != (Object)null) { Chat.instance.SetNpcText(((Component)this).gameObject, Vector3.up * 2.2f, 20f, segundos, "", texto, false); } } private void RPC_Falar(long remetente, string texto, float segundos, bool resmungar) { if ((ZRoutedRpc.instance == null || remetente != ZRoutedRpc.instance.m_id) && !EhDoJogadorLocal) { if (Plugin.BaloesDosOutros.Value) { MostrarBalao(texto, segundos); } if (resmungar && Plugin.ResmungoDosOutros.Value) { SonsBot.Tocar(((Component)this).transform); } } } private void RPC_Levantar(long remetente) { if (NView.IsOwner() && (Object)(object)Status != (Object)null && Caido) { Status.Levantar(revivido: true); } } public string TextoHover() { string text = (Object.op_Implicit((Object)(object)Humanoid) ? ((Character)Humanoid).GetHoverName() : "Bot"); if (Caido) { int num = Mathf.RoundToInt(ProgressoReviver * 100f); return Localization.instance.Localize(Tr.T("{0}\n[<color=yellow><b>$KEY_Use</b></color>] Segure pra reviver", text) + ((num > 0) ? $" <color=yellow>{num}%</color>" : "")); } if (EhDoJogadorLocal) { return Localization.instance.Localize(text + Tr.T("\n[<color=yellow><b>$KEY_Use</b></color>] Abrir mochila")); } string nomeDono = NomeDono; if (!string.IsNullOrEmpty(nomeDono)) { return Tr.T("{0}\n<color=#aaaaaa>Bot de {1}</color>", text, nomeDono); } return text; } public bool Interact(Humanoid user, bool hold, bool alt) { Player val = (Player)(object)((user is Player) ? user : null); if ((Object)(object)val == (Object)null || (Object)(object)val != (Object)(object)Player.m_localPlayer) { return false; } float time; int num; float num2; if (Caido) { if (!hold) { s_progressoReviver = 0f; s_revivendo = this; s_ultimoSegurar = Time.time; return false; } time = Time.time; if ((Object)(object)s_revivendo == (Object)(object)this) { num = ((time - s_ultimoSegurar < 0.5f) ? 1 : 0); if (num != 0) { num2 = time - s_ultimoSegurar; goto IL_007e; } } else { num = 0; } num2 = 0f; goto IL_007e; } if (hold) { return false; } if (!EhDoJogadorLocal) { ((Character)val).Message((MessageType)2, Tr.T("Esse é o bot de {0}.", NomeDono), 0, (Sprite)null, false); return false; } if (!NView.IsOwner() || (Object)(object)Mochila == (Object)null) { ((Character)val).Message((MessageType)2, Tr.T("Espera um pouco, o bot ainda tá carregando."), 0, (Sprite)null, false); return false; } InventoryGui.instance.Show(Mochila, 1); return true; IL_007e: float num3 = num2; if (num == 0) { s_progressoReviver = 0f; } s_revivendo = this; s_ultimoSegurar = time; s_progressoReviver += num3; if (s_progressoReviver >= Plugin.TempoReviver.Value) { s_progressoReviver = 0f; s_revivendo = null; NView.InvokeRPC("JarvisCompanion_Levantar", Array.Empty<object>()); } return false; } public bool UseItem(Humanoid user, ItemData item) { return false; } } internal static class BotEquipamento { private class Extras { public readonly HashSet<StatusEffect> Efeitos = new HashSet<StatusEffect>(); } public static readonly HashSet<ItemData> FerramentasNaMao = new HashSet<ItemData>(); private static readonly ConditionalWeakTable<Humanoid, Extras> s_extras = new ConditionalWeakTable<Humanoid, Extras>(); public static bool Permitido(int x, int y, ItemData item) { if (item == null) { return true; } return EspacoDoItem(item, PainelLayout.EspacoEm(x, y)); } private static bool EspacoDoItem(ItemData item, Espaco espaco) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Invalid comparison between Unknown and I4 //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Invalid comparison between Unknown and I4 //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Invalid comparison between Unknown and I4 //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Invalid comparison between Unknown and I4 //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Invalid comparison between Unknown and I4 //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Invalid comparison between Unknown and I4 //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Invalid comparison between Unknown and I4 //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Invalid comparison between Unknown and I4 //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Invalid comparison between Unknown and I4 SharedData shared = item.m_shared; switch (espaco) { case Espaco.Capacete: return (int)shared.m_itemType == 6; case Espaco.Peito: return (int)shared.m_itemType == 7; case Espaco.Pernas: return (int)shared.m_itemType == 11; case Espaco.Capa: return (int)shared.m_itemType == 17; case Espaco.Arma: return EhArmaCorpoACorpo(item); case Espaco.Escudo: return (int)shared.m_itemType == 5; case Espaco.Utilitario: return (int)shared.m_itemType == 18; case Espaco.Amuleto: return (int)shared.m_itemType == 24; case Espaco.Comida: if ((int)shared.m_itemType == 2) { return EhComida(shared); } return false; case Espaco.Pocao: if ((int)shared.m_itemType == 2) { return !EhComida(shared); } return false; case Espaco.Picareta: return EhFerramenta(item, Espaco.Picareta); case Espaco.Machado: return EhFerramenta(item, Espaco.Machado); case Espaco.Arco: return EhArco(item); case Espaco.Flechas: return (int)shared.m_itemType == 9; case Espaco.Tocha: return (int)shared.m_itemType == 15; default: return false; } } private static Espaco EspacoDeVestir(ItemData item) { Espaco[] array = new Espaco[8] { Espaco.Capacete, Espaco.Peito, Espaco.Pernas, Espaco.Capa, Espaco.Amuleto, Espaco.Arma, Espaco.Escudo, Espaco.Utilitario }; foreach (Espaco espaco in array) { if (EspacoDoItem(item, espaco)) { return espaco; } } return Espaco.Nenhum; } public static bool EhArco(ItemData i) { //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_0014: Invalid comparison between Unknown and I4 //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Invalid comparison between Unknown and I4 //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Invalid comparison between Unknown and I4 //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Invalid comparison between Unknown and I4 //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Invalid comparison between Unknown and I4 if (i == null) { return false; } ItemType itemType = i.m_shared.m_itemType; if ((int)itemType == 9 || (int)itemType == 23 || (int)itemType == 2) { return false; } if ((int)i.m_shared.m_skillType == 8 || (int)i.m_shared.m_skillType == 14) { return !string.IsNullOrEmpty(i.m_shared.m_ammoType); } return false; } public static bool EhFerramenta(ItemData i, Espaco tipo) { //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_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Invalid comparison between Unknown and I4 if (i == null) { return false; } DamageTypes damages = i.m_shared.m_damages; switch (tipo) { case Espaco.Picareta: return damages.m_pickaxe > 0f; case Espaco.Machado: if (damages.m_chop > 0f) { return (int)i.m_shared.m_skillType == 7; } return false; default: return false; } } public static bool FaltaArmaNaMao(Humanoid h) { //IL_0049: 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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Invalid comparison between Unknown and I4 if ((Object)(object)h == (Object)null || h.m_inventory == null) { return false; } if (ComFerramentaNaMao(h)) { return false; } ItemData[] array = (ItemData[])(object)new ItemData[2] { h.m_rightItem, h.m_leftItem }; foreach (ItemData val in array) { if (val != null) { Vector2i gridPos = val.m_gridPos; Espaco espaco = PainelLayout.EspacoEm(gridPos.x, gridPos.y); if (espaco == Espaco.Picareta || espaco == Espaco.Machado || espaco == Espaco.Arco) { return true; } } } (int x, int y) tuple = PainelLayout.Posicoes(Espaco.Arma)[0]; int item = tuple.x; int item2 = tuple.y; ItemData itemAt = h.m_inventory.GetItemAt(item, item2); if (itemAt != null && Permitido(item, item2, itemAt) && !Quebrado(itemAt) && !h.IsItemEquiped(itemAt)) { return true; } ItemData rightItem = h.m_rightItem; bool num = rightItem != null && (int)rightItem.m_shared.m_itemType != 3; (int x, int y) tuple2 = PainelLayout.Posicoes(Espaco.Escudo)[0]; int item3 = tuple2.x; int item4 = tuple2.y; ItemData itemAt2 = h.m_inventory.GetItemAt(item3, item4); if (!num && itemAt2 != null && Permitido(item3, item4, itemAt2) && !Quebrado(itemAt2)) { return !h.IsItemEquiped(itemAt2); } return false; } public static bool ComFerramentaNaMao(Humanoid h) { if (h.m_rightItem == null || !FerramentasNaMao.Contains(h.m_rightItem)) { if (h.m_leftItem != null) { return FerramentasNaMao.Contains(h.m_leftItem); } return false; } return true; } public static void VoltarArmas(Humanoid h) { ItemData[] array = (ItemData[])(object)new ItemData[2] { h.m_rightItem, h.m_leftItem }; foreach (ItemData val in array) { if (val != null && !FerramentasNaMao.Contains(val)) { Espaco espaco = PainelLayout.EspacoEm(val.m_gridPos.x, val.m_gridPos.y); if (espaco == Espaco.Picareta || espaco == Espaco.Machado || espaco == Espaco.Arco) { h.UnequipItem(val, false); val.m_equipped = false; } } } Sincronizar(h); } public static bool FerramentaMelhor(ItemData novo, ItemData atual, Espaco tipo) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) if (atual == null) { return true; } if (novo.m_shared.m_toolTier != atual.m_shared.m_toolTier) { return novo.m_shared.m_toolTier > atual.m_shared.m_toolTier; } DamageTypes damage = novo.GetDamage(); DamageTypes damage2 = atual.GetDamage(); if (tipo != Espaco.Picareta) { return damage.m_chop > damage2.m_chop; } return damage.m_pickaxe > damage2.m_pickaxe; } public static ItemData PorFerramentaNoPainel(Humanoid h, Inventory mochila, ItemData item, Espaco tipo) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_007f: Unknown result type (might be due to invalid IL or missing references) Inventory inventory = h.m_inventory; if (inventory.ContainsItem(item)) { return item; } if (mochila == null || !mochila.ContainsItem(item)) { return null; } (int x, int y) tuple = PainelLayout.Posicoes(tipo)[0]; int item2 = tuple.x; int item3 = tuple.y; ItemData itemAt = inventory.GetItemAt(item2, item3); if (itemAt == null) { inventory.MoveItemToThis(mochila, item, item.m_stack, item2, item3); } else { Vector2i gridPos = item.m_gridPos; BotBody.AntesDeTirarDaMochila(inventory, itemAt); mochila.RemoveItem(item); mochila.MoveItemToThis(inventory, itemAt, itemAt.m_stack, gridPos.x, gridPos.y); inventory.MoveItemToThis(mochila, item, item.m_stack, item2, item3); } ItemData itemAt2 = inventory.GetItemAt(item2, item3); if (itemAt2 == null || !EhFerramenta(itemAt2, tipo)) { return null; } return itemAt2; } private static bool EhComida(SharedData s) { if (!(s.m_food > 0f) && !(s.m_foodStamina > 0f)) { return s.m_foodEitr > 0f; } return true; } private static bool Quebrado(ItemData i) { if (i.m_shared.m_useDurability) { return i.m_durability <= 0f; } return false; } public static List<ItemData> UtilitariosExtras(Humanoid h) { List<ItemData> list = new List<ItemData>(); if ((Object)(object)h == (Object)null || !BotBody.EhPainel(h)) { return list; } (int, int)[] array = PainelLayout.Posicoes(Espaco.Utilitario); for (int i = 0; i < array.Length; i++) { (int, int) tuple = array[i]; int item = tuple.Item1; int item2 = tuple.Item2; ItemData itemAt = h.m_inventory.GetItemAt(item, item2); if (itemAt != null && itemAt != h.m_utilityItem && Permitido(item, item2, itemAt) && !Quebrado(itemAt)) { list.Add(itemAt); } } return list; } public static bool EhUtilitarioExtra(Humanoid h, ItemData item) { if (item != null) { return UtilitariosExtras(h).Contains(item); } return false; } public static void AtualizarEfeitosExtras(Humanoid h) { if ((Object)(object)h == (Object)null || ((Character)h).m_seman == null || !BotBody.EhPainel(h)) { return; } bool num = (Object)(object)((Character)h).m_nview != (Object)null && ((Character)h).m_nview.GetZDO() != null; Extras orCreateValue = s_extras.GetOrCreateValue(h); HashSet<StatusEffect> hashSet = new HashSet<StatusEffect>(); if (num) { foreach (ItemData item in UtilitariosExtras(h)) { if (Object.op_Implicit((Object)(object)item.m_shared.m_equipStatusEffect)) { hashSet.Add(item.m_shared.m_equipStatusEffect); } } } foreach (StatusEffect efeito in orCreateValue.Efeitos) { if (!hashSet.Contains(efeito) && !h.m_equipmentStatusEffects.Contains(efeito)) { ((Character)h).m_seman.RemoveStatusEffect(efeito.NameHash(), true); } } foreach (StatusEffect item2 in hashSet) { if (!((Character)h).m_seman.HaveStatusEffect(item2.NameHash())) { ((Character)h).m_seman.AddStatusEffect(item2, false, 0, 0f, (short)(-1)); } } orCreateValue.Efeitos.Clear(); orCreateValue.Efeitos.UnionWith(hashSet); } public static void DesvestirOQueSaiu(Humanoid h) { Inventory inventory = h.m_inventory; ItemData[] array = Vestidos(h); foreach (ItemData val in array) { if (val != null && !inventory.ContainsItem(val)) { h.UnequipItem(val, false); val.m_equipped = false; } } } public static void Sincronizar(Humanoid h) { //IL_0035: 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_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Invalid comparison between Unknown and I4 //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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) Inventory inventory = h.m_inventory; ItemData[] array = Vestidos(h); foreach (ItemData val in array) { if (val != null && (!FerramentasNaMao.Contains(val) || !inventory.ContainsItem(val))) { Vector2i gridPos = val.m_gridPos; if (!inventory.ContainsItem(val) || !PainelLayout.EhDeVestir(PainelLayout.EspacoEm(gridPos.x, gridPos.y)) || !Permitido(gridPos.x, gridPos.y, val)) { h.UnequipItem(val, false); val.m_equipped = false; } } } Vestir(h, Espaco.Capacete); Vestir(h, Espaco.Peito); Vestir(h, Espaco.Pernas); Vestir(h, Espaco.Capa); Vestir(h, Espaco.Amuleto); VestirPrimeiroUtilitario(h); if (!ComFerramentaNaMao(h)) { Vestir(h, Espaco.Arma); ItemData rightItem = h.m_rightItem; if (rightItem == null || (int)rightItem.m_shared.m_itemType == 3) { Vestir(h, Espaco.Escudo); } } List<ItemData> list = UtilitariosExtras(h); foreach (ItemData allItem in inventory.GetAllItems()) { allItem.m_equipped = h.IsItemEquiped(allItem) || list.Contains(allItem); } h.SetupEquipment(); AtualizarEfeitosExtras(h); } private static void Vestir(Humanoid h, Espaco espaco) { (int, int)[] array = PainelLayout.Posicoes(espaco); for (int i = 0; i < array.Length; i++) { (int, int) tuple = array[i]; int item = tuple.Item1; int item2 = tuple.Item2; ItemData itemAt = h.m_inventory.GetItemAt(item, item2); if (itemAt != null && !h.IsItemEquiped(itemAt) && Permitido(item, item2, itemAt) && !Quebrado(itemAt)) { h.EquipItem(itemAt, false); } } } private static void VestirPrimeiroUtilitario(Humanoid h) { ItemData val = null; (int, int)[] array = PainelLayout.Posicoes(Espaco.Utilitario); for (int i = 0; i < array.Length; i++) { (int, int) tuple = array[i]; int item = tuple.Item1; int item2 = tuple.Item2; ItemData itemAt = h.m_inventory.GetItemAt(item, item2); if (itemAt != null && Permitido(item, item2, itemAt) && !Quebrado(itemAt)) { val = itemAt; break; } } if (val == null) { if (h.m_utilityItem != null) { h.m_utilityItem.m_equipped = false; h.UnequipItem(h.m_utilityItem, false); } } else if (h.m_utilityItem != val) { h.EquipItem(val, false); } } private static ItemData[] Vestidos(Humanoid h) { return (ItemData[])(object)new ItemData[9] { h.m_rightItem, h.m_leftItem, h.m_helmetItem, h.m_chestItem, h.m_legItem, h.m_shoulderItem, h.m_utilityItem, h.m_trinketItem, h.m_ammoItem }; } public static void Arrumar(Inventory painel, Inventory mochila) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: 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) if (painel == null) { return; } List<ItemData> list = new List<ItemData>(); foreach (ItemData item in new List<ItemData>(painel.GetAllItems())) { Vector2i gridPos = item.m_gridPos; if (gridPos.x < 0 || gridPos.y < 0 || gridPos.x >= 5 || gridPos.y >= 5 || !Permitido(gridPos.x, gridPos.y, item)) { item.m_equipped = false; painel.m_inventory.Remove(item); list.Add(item); } } if (list.Count == 0) { return; } foreach (ItemData item2 in list) { bool flag = false; foreach (Espaco value in Enum.GetValues(typeof(Espaco))) { if (value == Espaco.Nenhum || !EspacoDoItem(item2, value)) { continue; } (int, int)[] array = PainelLayout.Posicoes(value); for (int i = 0; i < array.Length; i++) { var (num, num2) = array[i]; if (painel.GetItemAt(num, num2) == null) { item2.m_gridPos = new Vector2i(num, num2); painel.m_inventory.Add(item2); flag = true; break; } } if (flag) { break; } } if (!flag && mochila != null && mochila.HaveEmptySlot()) { flag = mochila.AddItem(item2); } if (!flag) { (int, int)[] array = PainelLayout.Posicoes(Espaco.Nenhum); for (int i = 0; i < array.Length; i++) { var (num3, num4) = array[i]; if (painel.GetItemAt(num3, num4) == null) { item2.m_gridPos = new Vector2i(num3, num4); painel.m_inventory.Add(item2); flag = true; break; } } } if (!flag) { painel.m_inventory.Add(item2); Plugin.Log.LogWarning((object)("Painel do bot: sem lugar pra " + item2.m_shared.m_name + ".")); } } painel.Changed(false, false); if (mochila != null) { mochila.Changed(false, false); } } public static bool TentarVestirDaMochila(Humanoid h, Inventory mochila, ItemData item) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Invalid comparison between Unknown and I4 //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Invalid comparison between Unknown and I4 _ = h.m_inventory; if (item == null || !mochila.ContainsItem(item) || Quebrado(item)) { return false; } if (EhArco(item)) { return TentarEspaco(h, mochila, item, Espaco.Arco); } if ((int)item.m_shared.m_itemType == 9) { return TentarEspaco(h, mochila, item, Espaco.Flechas); } if ((int)item.m_shared.m_itemType == 15) { return TentarEspaco(h, mochila, item, Espaco.Tocha); } if (EhFerramenta(item, Espaco.Picareta)) { return TentarEspaco(h, mochila, item, Espaco.Picareta); } if (EhFerramenta(item, Espaco.Machado)) { return TentarEspaco(h, mochila, item, Espaco.Machado); } Espaco espaco = EspacoDeVestir(item); if (espaco != Espaco.Nenhum) { return TentarEspaco(h, mochila, item, espaco); } return false; } private static bool TentarEspaco(Humanoid h, Inventory mochila, ItemData item, Espaco espaco) { //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) Inventory inventory = h.m_inventory; (int, int)[] array = PainelLayout.Posicoes(espaco); (int, int)[] array2 = array; for (int i = 0; i < array2.Length; i++) { var (num, num2) = array2[i]; if (inventory.GetItemAt(num, num2) == null) { return inventory.MoveItemToThis(mochila, item, item.m_stack, num, num2); } } if (array.Length != 1) { return false; } (int, int) tuple2 = array[0]; int item2 = tuple2.Item1; int item3 = tuple2.Item2; ItemData itemAt = inventory.GetItemAt(item2, item3); if (itemAt == null || !Melhor(item, itemAt, espaco)) { return false; } Vector2i gridPos = item.m_gridPos; BotBody.AntesDeTirarDaMochila(inventory, itemAt); mochila.RemoveItem(item); mochila.MoveItemToThis(inventory, itemAt, itemAt.m_stack, gridPos.x, gridPos.y); inventory.MoveItemToThis(mochila, item, item.m_stack, item2, item3); return true; } private static bool Melhor(ItemData novo, ItemData atual, Espaco espaco) { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0066: 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_008f: 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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) if (Quebrado(atual)) { return true; } DamageTypes damage; switch (espaco) { case Espaco.Capacete: case Espaco.Peito: case Espaco.Pernas: case Espaco.Capa: return novo.GetArmor() > atual.GetArmor(); case Espaco.Arma: { damage = novo.GetDamage(); float totalDamage2 = ((DamageTypes)(ref damage)).GetTotalDamage(); damage = atual.GetDamage(); return totalDamage2 > ((DamageTypes)(ref damage)).GetTotalDamage(); } case Espaco.Escudo: return novo.GetBaseBlockPower() > atual.GetBaseBlockPower(); case Espaco.Picareta: case Espaco.Machado: return FerramentaMelhor(novo, atual, espaco); case Espaco.Arco: { damage = novo.GetDamage(); float totalDamage = ((DamageTypes)(ref damage)).GetTotalDamage(); damage = atual.GetDamage(); return totalDamage > ((DamageTypes)(ref damage)).GetTotalDamage(); } default: return false; } } private static bool EhArmaCorpoACorpo(ItemData i) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: 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_000e: Invalid comparison between Unknown and I4 //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Invalid comparison between Unknown and I4 //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected I4, but got Unknown //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Invalid comparison between Unknown and I4 ItemType itemType = i.m_shared.m_itemType; bool result = (int)itemType == 3 || (int)itemType == 14 || (int)itemType == 22; SkillType skillType = i.m_shared.m_skillType; switch (skillType - 1) { case 0: case 1: case 2: case 3: case 4: case 6: case 10: return result; default: return false; } } } internal static class BotManager { private static BotState _estado = new BotState(); private static string _erroAoCarregar; private static ZNet _sessaoRede; private static long _sessaoJogadorId; private static BotBody _corpo; private static Vector3? _estacionadoEm; private static Vector3? _ficarEm; private static Vector3? _lapide; private static Vector3? _casa; private static bool _querBarco; private static float _naoAntesDe; private static float _proximoTick; private static readonly List<Container> _bausCarregados = new List<Container>(); private static readonly Dictionary<string, int> _bausSumidos = new Dictionary<string, int>(); private static float _proximaBuscaBaus; private static int _mascaraBau; private static int _mascaraObra; private static bool _vaiPeloPortal; private static float _portalAte; private static float _passarPelaPortaAte = -1f; private const float DistanciaPraPassarPelaPorta = 40f; private static bool _inventarioMudou; private static float _proximaGravacaoInventario; private static readonly Vector2[] LugaresEmVolta = (Vector2[])(object)new Vector2[14] { new Vector2(-2f, 0.7f), new Vector2(-2f, -0.7f), new Vector2(-1.5f, 1.5f), new Vector2(-1.5f, -1.5f), new Vector2(0f, 2f), new Vector2(0f, -2f), new Vector2(-1f, 0.6f), new Vector2(-1f, -0.6f), new Vector2(-1f, 3f), new Vector2(-1f, -3f), new Vector2(0f, 3f), new Vector2(0f, -3f), new Vector2(1.5f, 1.5f), new Vector2(1.5f, -1.5f) }; private static int _mascaraSolido; private static int _mascaraOcupado; private static int _mascaraPeca; private const float DistanciaDoPortal = 2.6f; public static BotBody Corpo => _corpo; public static ModoLuta Modo => _estado.Modo; public static EstiloLuta Estilo => _estado.Estilo; public static Vector3? PontoFixo => _lapide ?? _ficarEm ?? _casa; public static bool EmCasa { get { if (_casa.HasValue && !_lapide.HasValue) { return !_ficarEm.HasValue; } return false; } } public static ModoLuta ModoAgora { get { if ((!_lapide.HasValue && !EmCasa) || _estado.Modo != ModoLuta.Tranquilo) { return _estado.Modo; } return ModoLuta.Proteger; } } public static Vector3? Casa => _casa; public static bool QuerBarco => _querBarco; public static Vector3? EstacionadoEm => _estacionadoEm; private static Player Jogador => Player.m_localPlayer; internal static BotState Estado => _estado; internal static string Distancia { get { if (!_estado.Extras.TryGetValue("distancia", out var value)) { return "normal"; } return value; } } public static IReadOnlyList<Container> BausCarregados => _bausCarregados; public static void CancelarBarco() { _querBarco = false; } public static void AoNascer(Player p) { if (!((Object)(object)p == (Object)null) && !((Object)(object)p != (Object)(object)Jogador) && (!((Object)(object)_sessaoRede == (Object)(object)ZNet.instance) || _sessaoJogadorId != p.GetPlayerID())) { _sessaoRede = ZNet.instance; _sessaoJogadorId = p.GetPlayerID(); _corpo = null; _estacionadoEm = null; _ficarEm = null; _lapide = null; _vaiPeloPortal = false; _querBarco = false; CarregarCasa(); if (_casa.HasValue) { _estacionadoEm = _casa; } _estado = BotState.LerDe(p.m_customData, out _erroAoCarregar); if (_erroAoCarregar != null) { Plugin.Log.LogWarning((object)("Bot de " + p.GetPlayerName() + ": " + _erroAoCarregar + ". A cópia de backup continua em " + CaminhoBackup(p))); } VidaBot.AoEntrar(); _naoAntesDe = Time.time + 3f; Plugin.Log.LogInfo((object)$"Personagem {p.GetPlayerName()} entrou. Bot ativo: {_estado.Ativo}."); } } public static void AoSalvar(Player p) { if ((Object)(object)p == (Object)null || (Object)(object)p != (Object)(object)Jogador || _sessaoJogadorId != p.GetPlayerID() || (Object)(object)_sessaoRede != (Object)(object)ZNet.instance) { return; } try { AtualizarInventarioDoEstado(); if ((Object)(object)_corpo != (Object)null && (Object)(object)_corpo.Status != (Object)null) { _corpo.Status.Salvar(_estado); } VidaBot.AoSalvar(); _estado.EscreverEm(p.m_customData); BackupFile.Gravar(CaminhoBackup(p), _estado.ParaTexto()); } catch (Exception ex) { Plugin.Log.LogError((object)("Erro ao salvar o bot: " + ex)); } } public static void AoDestruirCorpo(BotBody corpo) { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)corpo == (Object)null) && !((Object)(object)corpo != (Object)(object)_corpo)) { AtualizarInventarioDoEstado(); if ((Object)(object)corpo.Status != (Object)null) { corpo.Status.Salvar(_estado); } _corpo = null; if (_vaiPeloPortal) { Plugin.Log.LogInfo((object)"Bot vai junto pelo portal."); } else if ((Object)(object)Jogador != (Object)null && (Object)(object)ZNet.instance != (Object)null && (Object)(object)ZNet.instance == (Object)(object)_sessaoRede) { _estacionadoEm = ((Component)corpo).transform.position; Plugin.Log.LogInfo((object)$"Bot ficou para trás em {_estacionadoEm.Value}."); } } } public static void Comando(ConsoleEventArgs args) { Executar(args.Args, args.Context); } internal static bool ExecutarAcaoDaIA(string id, Terminal ctx) { if (!AcoesIA.Lista.TryGetValue(id, out (string, string) value)) { return false; } if (id == "coletar_ligar" && Plugin.ColetaLigada.Value) { return true; } if (id == "coletar_desligar" && !Plugin.ColetaLigada.Value) { return true; } Executar(("bot " + value.Item1).Split(' '), ctx); return true; } internal static void Executar(string[] bruto, Terminal ctx) { string[] array = ComandosIngles.Normalizar(bruto); string text = ((array.Length >= 2) ? array[1].ToLowerInvariant() : ""); switch (text) { case "seguir": case "segue": case "ficar": case "fica": case "casa": case "barco": case "embarca": case "entra": case "guardar": case "guarda": case "consertar": case "conserta": case "reparar": case "repara": PararTrabalhoSeTiver(null); break; } switch (text) { case "paratrabalho": { bool flag = PararTrabalhoSeTiver(Tr.T("Beleza, parei.")); if (ctx != null) { ctx.AddString(flag ? Tr.T("Bot parou de trabalhar.") : Tr.T("Ele não está trabalhando.")); } if (!flag && (Object)(object)_corpo != (Object)null) { _corpo.Falar(Tr.T("Mas eu nem tô trabalhando!"), 5f); } return; } case "para": case "parar": if (array.Length < 3 && PararTrabalhoSeTiver(Tr.T("Beleza, parei."))) { if (ctx != null) { ctx.AddString(Tr.T("Bot parou de trabalhar.")); } return; } break; } switch (text) { case "help": case "ajuda": case "comandos": case "?": ComandoAjuda(ctx, (array.Length >= 3) ? array[2] : null); return; case "ia": case "ai": IABot.Comando(ctx, array); return; case "modo": ComandoModo(ctx, (array.Length >= 3) ? array[2] : null); return; case "estilo": ComandoEstilo(ctx, (array.Length >= 3) ? array[2] : null); return; case "habilidades": case "habilidade": ComandoHabilidades(ctx); return; case "ficar": case "fica": ComandoFicar(ctx); return; case "casa": ComandoCasa(ctx); return; case "coletar": case "coleta": case "pegar": ComandoColetar(ctx); return; case "bau": case "baú": ComandoBau(ctx); return; case "guardar": case "guarda": ComandoGuardar(ctx); return; case "consertar": case "conserta": case "reparar": case "repara": ComandoConsertar(ctx); return; case "barco": case "embarca": case "entra": ComandoBarco(ctx, entrar: true); return; case "sair": case "sai": case "desce": case "desembarca": ComandoBarco(ctx, entrar: false); return; } string text2 = ((array.Length >= 3) ? array[2].ToLowerInvariant() : ""); int num; switch (text2) { default: num = ((text2 == "músicas") ? 1 : 0); break; case "musica": case "música": case "musicas": num = 1; break; } bool flag2 = (byte)num != 0; switch (text) { case "toca": case "tocar": if (!flag2 && !(text2 == "")) { break; } goto case "musica"; case "musica": case "música": ComandoMusica(ctx); return; } switch (text) { case "proxima": case "próxima": case "pula": ComandoProxima(ctx); return; case "para": case "parar": if (flag2 || text2 == "") { ComandoPararMusica(ctx); return; } break; } switch (text) { case "seguir": case "segue": ComandoSeguir(ctx); return; case "status": ComandoStatus(ctx); return; case "diario": case "diário": ComandoDiario(ctx); return; case "pose": case "foto": ComandoPose(ctx); return; case "perto": case "longe": case "normal": ComandoDistancia(ctx, text); return; case "treinar": case "treino": ComandoTreinar(ctx); return; case "carroca": case "carroça": case "carro": case "puxar": case "solta": ComandoCarroca(ctx, text == "solta"); return; } if (bruto.Length >= 2) { IABot.Perguntar(ctx, string.Join(" ", bruto, 1, bruto.Length - 1)); } else { Chamar(ctx); } } private static CompanionAI IaDoBot(Terminal terminal) { if (!PodeMudar(terminal)) { return null; } CompanionAI obj = (Object.op_Implicit((Object)(object)_corpo) ? ((Component)_corpo).GetComponent<CompanionAI>() : null); if ((Object)(object)obj == (Object)null && terminal != null) { terminal.AddString(Tr.T("Seu bot não está aqui perto.")); } return obj; } private static void ComandoStatus(Terminal terminal) { if (PodeMudar(terminal)) { Dictionary<string, string> extras = _estado.Extras; string newLine = Environment.NewLine; string text = VidaBot.NomeComidaFavorita(); if (terminal != null) { terminal.AddString(Tr.T("Status do bot:") + newLine + Tr.T(" Bichos derrotados: {0} (chefes: {1})", Diario.Total(extras, "mortes"), Diario.Total(extras, "chefes")) + newLine + Tr.T(" Árvores derrubadas: {0}", Diario.Total(extras, "arvores")) + newLine + Tr.T(" Pedras e minérios quebrados: {0}", Diario.Total(extras, "pedras")) + newLine + Tr.T(" Coisas pegas do chão: {0}", Diario.Total(extras, "coletados")) + newLine + Tr.T(" Vezes que caiu: {0}", Diario.Total(extras, "quedas")) + newLine + Tr.T(" Dias com você: {0}", Mathf.Max(1, Diario.Total(extras, "dias"))) + newLine + ((text != null) ? (Tr.T(" Comida favorita: {0}", text) + newLine) : "") + Tr.T(" (habilidades: /bot habilidades)")); } if ((Object)(object)_corpo != (Object)null) { _corpo.Falar(Tr.T("Já derrubei {0} bichos e {1} árvores!", Diario.Total(extras, "mortes"), Diario.Total(extras, "arvores"))); } } } private static void ComandoDiario(Terminal terminal) { if (!PodeMudar(terminal)) { return; } Dictionary<string, string> e = _estado.Extras; string newLine = Environment.NewLine; int num = (Object.op_Implicit((Object)(object)EnvMan.instance) ? EnvMan.instance.GetDay() : 0); if (terminal != null) { terminal.AddString(Tr.T("Diário do bot (dia {0}):", num) + newLine + " " + Linha(Tr.T("Hoje"), (string k) => Diario.Hoje(e, k)) + newLine + " " + Linha(Tr.T("Ontem"), (string k) => Diario.Ontem(e, k))); } if ((Object)(object)_corpo != (Object)null) { int num2 = Diario.Hoje(e, "mortes"); int num3 = Diario.Hoje(e, "arvores"); int num4 = Diario.Hoje(e, "pedras"); _corpo.Falar((num2 + num3 + num4 == 0) ? Tr.T("Hoje foi tranquilo. Nada pra contar ainda!") : Tr.T("Hoje: {0} bichos, {1} árvores e {2} pedras. Dia bom!", num2, num3, num4), 7f); } static string Linha(string titulo, Func<string, int> ler) { return Tr.T("{0}: {1} bichos, {2} árvores, {3} pedras/minérios, ", titulo, ler("mortes"), ler("arvores"), ler("pedras")) + Tr.T("{0} coisas pegas, caiu {1} vez(es)", ler("coletados"), ler("quedas")); } } private static void ComandoPose(Terminal terminal) { CompanionAI companionAI = IaDoBot(terminal); if (!((Object)(object)companionAI == (Object)null)) { companionAI.ComecarPose(); if (terminal != null) { terminal.AddString(Tr.T("O bot vai posar do seu lado uns segundos. Tira o print!")); } } } private static void ComandoDistancia(Terminal terminal, string qual) { if (PodeMudar(terminal)) { _estado.Extras["distancia"] = qual; if (terminal != null) { terminal.AddString((qual == "perto") ? Tr.T("O bot vai ficar colado em você (bom pra caverna e cripta). /bot normal volta.") : ((qual == "longe") ? Tr.T("O bot vai ficar uns 8 m atrás (não entra na frente do arco). /bot normal volta.") : Tr.T("O bot voltou pra distância normal."))); } if ((Object)(object)_corpo != (Object)null) { FalasBot.Falar(_corpo, qual, 5f); } } } private static void ComandoTreinar(Terminal terminal) { if ((Object)(object)IaDoBot(terminal) == (Object)null) { return; } if (TreinoBot.Ativo) { TreinoBot.Terminar(_corpo, "treino_acabou"); if (terminal != null) { terminal.AddString(Tr.T("Treino encerrado.")); } return; } PararTrabalhoSeTiver(null); TreinoBot.Comecar(_corpo); if (terminal != null) { terminal.AddString(Tr.T("Treino! Luta de mentira, ninguém perde vida. Primeiro a acertar {0} golpes ganha. /bot treinar de novo para.", 10)); } } private static void ComandoCarroca(Terminal terminal, bool soltar) { CompanionAI companionAI = IaDoBot(terminal); if ((Object)(object)companionAI == (Object)null) { return; } if (soltar) { companionAI.SoltarCarroca(falar: true); if (terminal != null) { terminal.AddString(Tr.T("O bot soltou a carroça.")); } return; } bool temCarroca = companionAI.TemCarroca; string text = companionAI.PegarCarroca(Jogador); if (terminal != null) { terminal.AddString(text ?? (temCarroca ? Tr.T("O bot soltou a carroça.") : Tr.T("O bot vai engatar a carroça mais perto. /bot solta (ou /bot carroca de novo) solta."))); } } private static void ComandoAjuda(Terminal terminal, string pagina) { //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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)terminal == (Object)null) { return; } int result; int num = ((!int.TryParse(pagina, out result)) ? 1 : Mathf.Clamp(result, 1, 3)); string text = ((object)Plugin.TeclaRoda.Value/*cast due to .constrained prefix*/).ToString(); string text2 = ((object)Plugin.TeclaTrabalho.Value/*cast due to .constrained prefix*/).ToString(); List<string> list = new List<string>(); list.Add(Tr.T("<color=yellow>==== Comandos do bot ({0}/{1}) ====</color>", num, 3)); List<string> list2 = list; switch (num) { case 1: list2.Add(Tr.T("<color=orange>Básico</color>")); list2.Add(Tr.T(" /bot — chama o bot (ele aparece do seu lado)")); list2.Add(Tr.T(" /bot seguir · /bot ficar · /bot casa (cuida da base)")); list2.Add(Tr.T(" /bot perto · /bot longe · /bot normal — distância de seguir")); list2.Add(Tr.T(" /bot barco · /bot sair — sobe e desce do barco")); list2.Add(Tr.T(" Tecla {0} — roda de comandos · E no bot — mochila e equipamento", text)); list2.Add(Tr.T("<color=orange>Luta</color>")); list2.Add(Tr.T(" /bot modo tranquilo | proteger | caçar")); list2.Add(Tr.T(" /bot estilo agressivo | equilibrado | defensivo")); list2.Add(Tr.T(" /bot habilidades · /bot treinar (luta de mentira, até 10 pontos)")); break; case 2: list2.Add(Tr.T("<color=orange>Trabalho</color>")); list2.Add(Tr.T(" Tecla {0} olhando pra árvore/pedra/minério — corta ou minera ({1} no nada ou /bot para: para)", text2, text2)); list2.Add(Tr.T(" /bot coletar — liga/desliga pegar coisas do chão")); list2.Add(Tr.T(" /bot bau (olhando pro baú) — marca/desmarca baú dele · /bot guardar — guarda a mochila")); list2.Add(Tr.T(" /bot consertar — conserta tudo na bancada/forja")); list2.Add(Tr.T(" /bot carroca — engata/solta a carroça · /bot solta")); list2.Add(Tr.T("<color=orange>Diversão</color>")); list2.Add(Tr.T(" /bot toca musica · /bot proxima · /bot para musica")); list2.Add(Tr.T(" /bot pose — pose pra print · /bot status · /bot diario")); break; default: list2.Add(Tr.T("<color=orange>Conversa (IA, opcional)</color>")); list2.Add(Tr.T(" /bot ia — liga a IA (grátis, com a sua conta Google)")); list2.Add(Tr.T(" /bot ia help — passo a passo pra ligar a IA")); list2.Add(Tr.T(" /bot <pergunta> — conversa e tira dúvidas do Valheim (ex.: /bot como pego prata?)")); list2.Add(Tr.T(" /bot ia status · /bot ia esquecer · /bot ia desligar")); break; } list2.Add((num < 3) ? Tr.T("<color=#aaaaaa>/bot help {0} — próxima página</color>", num + 1) : Tr.T("<color=#aaaaaa>/bot help — volta pra primeira página</color>")); foreach (string item in list2) { terminal.AddString(item); } } private static bool PodeMudar(Terminal terminal) { Player jogador = Jogador; if ((Object)(object)jogador == (Object)null) { if (terminal != null) { terminal.AddString(Tr.T("Você precisa estar dentro do jogo.")); } return false; } if (_sessaoJogadorId != jogador.GetPlayerID()) { AoNascer(jogador); } return true; } private static void ComandoModo(Terminal terminal, string texto) { if (!PodeMudar(terminal)) { return; } if (string.IsNullOrEmpty(texto)) { if (terminal != null) { terminal.AddString(Tr.T("Modo do bot: {0}. Opções: tranquilo (só revida), proteger (monstros até 10 m de você), caçar (até 30 m, bichos também).", Luta.NaTela(_estado.Modo))); } return; } if (!Luta.LerModo(texto, out var modo)) { if (terminal != null) { terminal.AddString(Tr.T("Não conheço o modo \"{0}\". Use: tranquilo, proteger ou caçar.", texto)); } return; } _estado.Modo = modo; if (terminal != null) { terminal.AddString(Tr.T("Modo do bot: {0}.", Luta.NaTela(modo))); } if ((Object)(object)_corpo != (Object)null) { switch (modo) { case ModoLuta.Tranquilo: _corpo.Falar(Tr.T("Beleza, fico na minha. Só revido.")); break; case ModoLuta.Cacar: _corpo.Falar(Tr.T("Bora caçar!")); break; default: _corpo.Falar(Tr.T("Tô de olho em você. Ninguém chega perto.")); break; } } } private static void ComandoEstilo(Terminal terminal, string texto) { if (!PodeMudar(terminal)) { return; } if (string.IsNullOrEmpty(texto)) { if (terminal != null) { terminal.AddString(Tr.T("Estilo do bot: {0}. Opções: agressivo (bate mais), equilibrado (ataca e defende), defensivo (defende e contra-ataca).", Luta.NaTela(_estado.Estilo))); } return; } if (!Luta.LerEstilo(texto, out var estilo)) { if (terminal != null) { terminal.AddString(Tr.T("Não conheço o estilo \"{0}\". Use: agressivo, equilibrado ou defensivo.", texto)); } return; } _estado.Estilo = estilo; if (terminal != null) { terminal.AddString(Tr.T("Estilo do bot: {0}.", Luta.NaTela(estilo))); } if ((Object)(object)_corpo != (Object)null) { switch (estilo) { case EstiloLuta.Agressivo: _corpo.Falar(Tr.T("Pra cima deles!")); break; case EstiloLuta.Defensivo: _corpo.Falar(Tr.T("Escudo na frente. Espero e revido.")); break; default: _corpo.Falar(Tr.T("Defendo e ataco na hora certa.")); break; } } } private unsafe static void ComandoHabilidades(Terminal terminal) { //IL_00a7: Unknown result type (might be due to invalid IL or missing references) if (!PodeMudar(terminal)) { return; } HabilidadesBot obj = (((Object)(object)_corpo != (Object)null && (Object)(object)_corpo.Status != (Object)null && _corpo.Status.Ativo) ? _corpo.Status.Habilidades : HabilidadesBot.DeTexto(_estado.Habilidades)); List<string> list = new List<string>(); foreach (KeyValuePair<int, HabilidadesBot.Habilidade> listum in obj.Lista) { if (!(listum.Value.Nivel <= 0f) || !(listum.Value.Acumulado <= 0f)) { SkillType val = (SkillType)listum.Key; string text = Localization.instance.Localize("$skill_" + ((object)(*(SkillType*)(&val))/*cast due to .constrained prefix*/).ToString().ToLowerInvariant()); float num = HabilidadesBot.Requisito(listum.Value.Nivel); list.Add(Tr.T(" {0}: {1:0} ({2:0}% pro próximo)", text, listum.Value.Nivel, Mathf.Clamp01(listum.Value.Acumulado / num) * 100f)); } } if (terminal != null) { terminal.AddString((list.Count == 0) ? Tr.T("O bot ainda não tem habilidade nenhuma. Ela sobe lutando e defendendo, igual a sua.") : (Tr.T("Habilidades do bot:") + Environment.NewLine + string.Join(Environment.NewLine, list))); } } private static void ComandoFicar(Terminal terminal) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) if (!PodeMudar(terminal)) { return; } if ((Object)(object)_corpo == (Object)null) { if (terminal != null) { terminal.AddString(Tr.T("Seu bot não está aqui perto.")); } return; } _ficarEm = ((Component)_corpo).transform.position; _corpo.Falar(Tr.T("Beleza, fico aqui, {0}.", NomeDoDono(Jogador))); if (terminal != null) { terminal.AddString(Tr.T("Bot ficando aqui. Use /bot seguir pra ele voltar a te acompanhar.")); } } private static void ComandoMusica(Terminal terminal) { if (PodeMudar(terminal)) { string text = MusicaBot.Tocar(_corpo); if (terminal != null) { terminal.AddString(text ?? Tr.T("Bot tocando música. /bot proxima pula, /bot para musica para.")); } } } private static void ComandoProxima(Terminal terminal) { if (PodeMudar(terminal)) { if (!MusicaBot.Tocando) { ComandoMusica(terminal); } else { MusicaBot.Proxima(_corpo); } } } private static void ComandoPararMusica(Terminal terminal) { if (PodeMudar(terminal)) { bool tocando = MusicaBot.Tocando; MusicaBot.Parar(); if (tocando && (Object)(object)_corpo != (Object)null) { _corpo.Falar(Tr.T("Tá bom, parei."), 4f); } if (terminal != null) { terminal.AddString(tocando ? Tr.T("Música parada.") : Tr.T("Ele não estava tocando nada.")); } } } private static void ComandoBarco(Terminal terminal, bool entrar) { if (!PodeMudar(terminal)) { return; } if ((Object)(object)_corpo == (Object)null) { if (terminal != null) { terminal.AddString(Tr.T("Seu bot não está aqui perto.")); } } else if (entrar) { _querBarco = true; _ficarEm = null; if (terminal != null) { terminal.AddString(Tr.T("Bot subindo no barco. /bot sair faz ele descer (e ele desce junto quando você desembarca).")); } } else { bool querBarco = _querBarco; _querBarco = false; if (terminal != null) { terminal.AddString(querBarco ? Tr.T("Bot descendo do barco.") : Tr.T("Ele não está no barco.")); } } } public static void TrazerProLadoDoDono() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) Player jogador = Jogador; if (!((Object)(object)jogador == (Object)null) && !((Object)(object)_corpo == (Object)null)) { MoverCorpo(PosicaoDoLado(jogador)); } } private static void ComandoColetar(Terminal terminal) { if (PodeMudar(terminal)) { Plugin.ColetaLigada.Value = !Plugin.ColetaLigada.Value; bool value = Plugin.ColetaLigada.Value; if (terminal != null) { terminal.AddString(value ? Tr.T("Coleta ligada: o bot pega o que estiver no chão perto dele (sem passar do peso). /bot coletar desliga.") : Tr.T("Coleta desligada: o bot não pega mais nada do chão. /bot coletar liga de novo.")); } if ((Object)(object)_corpo != (Object)null) { _corpo.Falar(value ? Tr.T("Deixa que eu pego as coisas!") : Tr.T("Beleza, não pego mais nada do chão.")); } } } public static bool EhBauDoBot(Container c) { if ((Object)(object)c == (Object)null) { return false; } foreach (Container bausCarregado in _bausCarregados) { if ((Object)(object)bausCarregado == (Object)(object)c) { return true; } } return false; } private static void AtualizarBaus(bool agora = false) { //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: 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_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) if (!agora && Time.time < _proximaBuscaBaus) { return; } _proximaBuscaBaus = Time.time + 1f; _bausCarregados.Clear(); Player jogador = Jogador; long num = MundoAtual(); if ((Object)(object)jogador == (Object)null || num == 0L || string.IsNullOrEmpty(_estado.Baus)) { return; } if (_mascaraBau == 0) { _mascaraBau = LayerMask.GetMask(new string[3] { "piece", "piece_nonsolid", "Default" }); } BausBot bausBot = BausBot.DeTexto(_estado.Baus); bool flag = false; Vector3 val = default(Vector3); foreach (float[] item in bausBot.DoMundo(num)) { ((Vector3)(ref val))..ctor(item[0], item[1], item[2]); if (Vector3.Distance(val, ((Component)jogador).transform.position) > 80f) { continue; } Container val2 = null; Collider[] array = Physics.OverlapSphere(val, 0.8f, _mascaraBau, (QueryTriggerInteraction)2); for (int i = 0; i < array.Length; i++) { Container componentInParent = ((Component)array[i]).GetComponentInParent<Container>(); if ((Object)(object)componentInParent != (Object)null && Vector3.Distance(((Component)componentInParent).transform.position, val) <= 0.5f) { val2 = componentInParent; break; } } string key = $"{item[0]:0.##}:{item[1]:0.##}:{item[2]:0.##}"; if ((Object)(object)val2 != (Object)null) { _bausSumidos.Remove(key); if (!_bausCarregados.Contains(val2)) { _bausCarregados.Add(val2); } } else if (Vector3.Distance(val, ((Component)jogador).transform.position) < 30f && (Object)(object)ZoneSystem.instance != (Object)null && ZoneSystem.instance.IsZoneLoaded(val)) { _bausSumidos.TryGetValue(key, out var value); if (++value >= 5) { bausBot.Tirar(num, item[0], item[1], item[2]); _bausSumidos.Remove(key); flag = true; Plugin.Log.LogInfo((object)$"Baú do bot em {val} sumiu (desmontado?): desmarquei."); } else { _bausSumidos[key] = value; } } } if (flag) { _estado.Baus = bausBot.ParaTexto(); } } private static Container BauOlhado(Player p) { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0122: 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) GameObject hoverObject = ((Humanoid)p).GetHoverObject(); Container val = (Object.op_Implicit((Object)(object)hoverObject) ? hoverObject.GetComponentInParent<Container>() : null); if ((Object)(object)val != (Object)null) { return val; } Camera val2 = (Object.op_Implicit((Object)(object)GameCamera.instance) ? GameCamera.instance.m_camera : Camera.main); if ((Object)(object)val2 == (Object)null) { return null; } if (_mascaraBau == 0) { _mascaraBau = LayerMask.GetMask(new string[3] { "piece", "piece_nonsolid", "Default" }); } Ray val3 = new Ray(((Component)val2).transform.position, ((Component)val2).transform.forward); float num = Vector3.Distance(((Component)val2).transform.position, ((Component)p).transform.position) + p.m_maxInteractDistance + 1f; RaycastHit[] array = Physics.RaycastAll(val3, num, _mascaraBau, (QueryTriggerInteraction)2); Array.Sort(array, (RaycastHit a, RaycastHit b) => ((RaycastHit)(ref a)).distance.CompareTo(((RaycastHit)(ref b)).distance)); RaycastHit[] array2 = array; for (int num2 = 0; num2 < array2.Length; num2++) { RaycastHit val4 = array2[num2]; Container componentInParent = ((Component)((RaycastHit)(ref val4)).collider).GetComponentInParent<Container>(); if ((Object)(object)componentInParent != (Object)null && Vector3.Distance(((Component)componentInParent).transform.position, ((Component)p).transform.position) <= p.m_maxInteractDistance + 1.5f) { return componentInParent; } } return null; } private static void ComandoBau(Terminal terminal) { //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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010b: 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_01dd: Unknown result type (might be due to invalid IL or missing references) if (!PodeMudar(terminal)) { return; } Player jogador = Jogador; long num = MundoAtual(); if (num == 0L) { if (terminal != null) { terminal.AddString(Tr.T("Não deu pra saber qual mundo é este.")); } return; } Container val = BauOlhado(jogador); if ((Object)(object)val == (Object)null || BotBody.EhMochilaDeBot(val) || (Object)(object)((Component)val).GetComponentInParent<TombStone>() != (Object)null || (Object)(object)((Component)val).GetComponentInParent<Ship>() != (Object)null || (Object)(object)((Component)val).GetComponentInParent<Vagon>() != (Object)null || (Object)(object)val.m_piece == (Object)null) { if (terminal != null) { terminal.AddString(Tr.T("Olha pra um baú (a mira em cima dele) e usa /bot bau. Barco, carroça e lápide não valem.")); } return; } Vector3 position = ((Component)val).transform.position; if (((int)val.m_privacy == 0 && val.m_piece.GetCreator() != jogador.GetPlayerID()) || !PrivateArea.CheckAccess(position, 0f, true, false)) { if (terminal != null) { terminal.AddString(Tr.T("Esse baú não é seu (é privado ou está protegido).")); } return; } BausBot bausBot = BausBot.DeTexto(_estado.Baus); bool flag = bausBot.Alternar(num, position.x, position.y, position.z); _estado.Baus = bausBot.ParaTexto(); AtualizarBaus(agora: true); int num2 = bausBot.QuantosNoMundo(num); if (terminal != null) { terminal.AddString(flag ? Tr.T("Baú marcado pro bot ({0} neste mundo). /bot guardar manda ele guardar a mochila nos baús dele.", num2) : Tr.T("Baú desmarcado ({0} baú(s) do bot neste mundo).", num2)); } if ((Object)(object)_corpo != (Object)null) { _corpo.Falar(flag ? Tr.T("Esse baú é meu agora!") : Tr.T("Beleza, esse não é mais meu.")); } Plugin.Log.LogInfo((object)string.Format("Baú do bot {0} em {1} (mundo {2}).", flag ? "marcado" : "desmarcado", position, num)); } private static void ComandoGuardar(Terminal terminal) { if (!PodeMudar(terminal)) { return; } if ((Object)(object)_corpo == (Object)null) { if (terminal != null) { terminal.AddString(Tr.T("Seu bot não está aqui perto.")); } return; } if (BausBot.DeTexto(_estado.Baus).QuantosNoMundo(MundoAtual()) == 0) { if (terminal != null) { terminal.AddString(Tr.T("O bot ainda não tem baú neste mundo. Olha pra um baú e usa /bot bau.")); } return; } CompanionAI component = ((Component)_corpo).GetComponent<CompanionAI>(); string text = (((Object)(object)component != (Object)null) ? component.ComecarAGuardar(avisar: true) : Tr.T("O bot não está pronto.")); if (terminal != null) { terminal.AddString(text ?? Tr.T("Bot indo guardar a mochila nos baús dele (o que está no painel ele não guarda).")); } } private static void VerTeclaRoda() { //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) Player jogador = Jogador; if ((Object)(object)jogador == (Object)null) { return; } KeyboardShortcut value = Plugin.TeclaRoda.Value; if (((KeyboardShortcut)(ref value)).IsDown() && ((Character)jogador).TakeInput() && !Hud.InRadial()) { if (!_estado.Ativo) { Avisar(jogador, Tr.T("Você ainda não tem bot. Use /bot primeiro.")); } else { RodaBot.Abrir(); } } } private static void ComandoConsertar(Terminal terminal) { if (!PodeMudar(terminal)) { return; } if ((Object)(object)_corpo == (Object)null) { if (terminal != null) { terminal.AddString(Tr.T("Seu bot não está aqui perto.")); } return; } CompanionAI component = ((Component)_corpo).GetComponent<CompanionAI>(); string text = (((Object)(object)component != (Object)null) ? component.ComecarConserto() : Tr.T("Seu bot não está pronto.")); if (terminal != null) { terminal.AddString(text ?? Tr.T("Bot indo consertar as coisas dele na bancada/forja mais perto.")); } } private static bool PararTrabalhoSeTiver(string fala) { CompanionAI companionAI = (((Object)(object)_corpo != (Object)null) ? ((Component)_corpo).GetComponent<CompanionAI>() : null); if ((Object)(object)companionAI == (Object)null || !companionAI.Trabalhando) { return false; } companionAI.PararTrabalho(fala); return true; } private static void VerTeclaTrabalho() { //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_00c3: 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) Player jogador = Jogador; if ((Object)(object)jogador == (Object)null) { return; } KeyboardShortcut value = Plugin.TeclaTrabalho.Value; if (!((KeyboardShortcut)(ref value)).IsDown() || !((Character)jogador).TakeInput()) { return; } if ((Object)(object)_corpo == (Object)null) { Avisar(jogador, Tr.T("Seu bot não está aqui perto.")); return; } MonoBehaviour val = ObraOlhada(jogador); CompanionAI component = ((Component)_corpo).GetComponent<CompanionAI>(); if ((Object)(object)val == (Object)null) { if ((Object)(object)component != (Object)null && component.Trabalhando) { component.PararTrabalho(Tr.T("Beleza, parei.")); Avisar(jogador, Tr.T("Bot parou de trabalhar.")); } else { Avisar(jogador, Tr.T("Olha pra uma árvore, tronco, pedra ou minério e aperta a tecla de novo.")); } return; } if (Vector3.Distance(((Component)val).transform.position, ((Component)_corpo).transform.position) > 40f) { Avisar(jogador, Tr.T("Isso tá longe demais do seu bot.")); return; } CompanionAI component2 = ((Component)_corpo).GetComponent<CompanionAI>(); string text = (((Object)(object)component2 != (Object)null) ? component2.ComecarTrabalho(val) : Tr.T("Seu bot não está pronto.")); if (text != null) { Avisar(jogador, text); } } private static MonoBehaviour ObraOlhada(Player p) { //IL_0086: 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) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) Camera val = (Object.op_Implicit((Object)(object)GameCamera.instance) ? GameCamera.instance.m_camera : Camera.main); if ((Object)(object)val == (Object)null) { return null; } if (_mascaraObra == 0) { _mascaraObra = LayerMask.GetMask(new string[8] { "Default", "static_solid", "Default_small", "terrain", "piece", "piece_nonsolid", "vehicle", "item" }); } RaycastHit[] array = Physics.RaycastAll(new Ray(((Component)val).transform.position, ((Component)val).transform.forward), 50f, _mascaraObra, (QueryTriggerInteraction)1); Array.Sort(array, (RaycastHit a, RaycastHit b) => ((RaycastHit)(ref a)).distance.CompareTo(((RaycastHit)(ref b)).distance)); int num = LayerMask.NameToLayer("terrain"); RaycastHit[] array2 = array; for (int num2 = 0; num2 < array2.Length; num2++) { RaycastHit val2 = array2[num2]; if (!((Object)(object)((Component)((RaycastHit)(ref val2)).collider).GetComponentInParent<Character>() != (Object)null)) { MonoBehaviour val3 = CompanionAI.AcharObra(((RaycastHit)(ref val2)).collider); if ((Object)(object)val3 != (Object)null) { return val3; } if (((Component)((RaycastHit)(ref val2)).collider).gameObject.layer == num || (Object)(object)((Component)((RaycastHit)(ref val2)).collider).GetComponentInParent<Piece>() != (Object)null) { return null; } } } return null; } private static long MundoAtual() { if (ZNet.m_world == null) { return 0L; } return ZNet.m_world.m_uid; } private static void CarregarCasa() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) _casa = null; long num = MundoAtual(); if (num != 0L) { float[] array = CasasBot.DeTexto(_estado.Casas).Onde(num); if (array != null) { _casa = new Vector3(array[0], array[1], array[2]); } } } private static void ComandoCasa(Terminal terminal) { //IL_003c: 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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) if (!PodeMudar(terminal)) { return; } Player jogador = Jogador; long num = MundoAtual(); if (num == 0L) { if (terminal != null) { terminal.AddString(Tr.T("Não deu pra saber qual mundo é este.")); } return; } CraftingStation val = CraftingStation.FindClosestStationInRange("$piece_workbench", ((Component)jogador).transform.position, 20f); if ((Object)(object)val == (Object)null) { if (terminal != null) { terminal.AddString(Tr.T("Não tem bancada perto (até 20 m). Fica perto da bancada da sua base e usa /bot casa.")); } if ((Object)(object)_corpo != (Object)null) { _corpo.Falar(Tr.T("Cadê a bancada? Preciso de uma pra saber onde é a casa."), 8f); } return; } Vector3 position = ((Component)val).transform.position; CasasBot casasBot = CasasBot.DeTexto(_estado.Casas); casasBot.Marcar(num, position.x, position.y, position.z); _estado.Casas = casasBot.ParaTexto(); _casa = position; _ficarEm = null; if ((Object)(object)_corpo != (Object)null) { _corpo.Falar(Tr.T("Beleza, {0}! Fico cuidando da casa.", NomeDoDono(jogador)), 8f); } if (terminal != null) { terminal.AddString(Tr.T("Casa marcada nesta bancada (só neste mundo). Ele fica por aqui. /bot seguir faz ele voltar a te acompanhar.")); } Plugin.Log.LogInfo((object)$"Casa do bot marcada em {position} (mundo {num})."); } private static void ComandoSeguir(Terminal terminal) { //IL_0105: 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) if (!PodeMudar(terminal)) { return; } bool flag = _ficarEm.HasValue || _lapide.HasValue || _casa.HasValue; _ficarEm = null; _lapide = null; if (_casa.HasValue) { CasasBot casasBot = CasasBot.DeTexto(_estado.Casas); casasBot.Tirar(MundoAtual()); _estado.Casas = casasBot.ParaTexto(); _casa = null; Plugin.Log.LogInfo((object)"Casa do bot desmarcada neste mundo."); } if ((Object)(object)_corpo != (Object)null) { _corpo.Falar(flag ? Tr.T("Bora, {0}!", NomeDoDono(Jogador)) : Tr.T("Já tô te seguindo, {0}!", NomeDoDono(Jogador))); } else if (_estacionadoEm.HasValue) { float num = Vector3.Distance(_estacionadoEm.Value, ((Component)Jogador).transform.position); if (terminal != null) { terminal.AddString(Tr.T("Seu bot tá esperando onde ficou, a {0:0} m daqui. Volta lá pra buscar ele.", num)); } } } public static void AoDonoMorrer(Player p) { //IL_0029: 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) if (!((Object)(object)p == (Object)null) && !((Object)(object)p != (Object)(object)Jogador) && _estado.Ativo) { _lapide = ((Component)p).transform.position; _ficarEm = null; if ((Object)(object)_corpo != (Object)null && !_corpo.Caido) { _corpo.Falar(Tr.T("Vou guardar tuas coisas, {0}! Volta aqui.", NomeDoDono(p)), 15f); } Plugin.Log.LogInfo((object)$"Dono morreu: bot guardando a lápide em {_lapide.Value}."); } } private static void SoltarLapideSePrecisar(Player p) { //IL_002c: 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) if (_lapide.HasValue && !((Object)(object)p == (Object)null) && !((Character)p).IsDead() && !((Character)p).IsTeleporting() && !(Vector3.Distance(((Component)p).transform.position, _lapide.Value) > 8f)) { _lapide = null; if ((Object)(object)_corpo != (Object)null) { _corpo.Falar(Tr.T("Tá aí tuas coisas, {0}! Bora.", NomeDoDono(p))); } Plugin.Log.LogInfo((object)"Dono voltou na lápide: bot volta a seguir."); } } public static void AoUsarPortal(Player p, bool tudoPassa) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)p == (Object)null) && !((Object)(object)p != (Object)(object)Jogador) && !((Object)(object)_corpo == (Object)null) && !_corpo.Caido && !PontoFixo.HasValue && !_querBarco && !(Vector3.Distance(((Component)_corpo).transform.position, ((Component)p).transform.position) > 40f)) { if (!tudoPassa && ((_corpo.MochilaInv != null && !_corpo.MochilaInv.IsTeleportable(false)) || (_corpo.Inventario != null && !_corpo.Inventario.IsTeleportable(false)))) { _corpo.Falar(Tr.T("Tô com metal, não passo no portal! Volta pra me buscar, {0}.", NomeDoDono(p)), 15f); Plugin.Log.LogInfo((object)"Bot não passou no portal: está carregando coisa que não passa (metal etc.)."); } else { _vaiPeloPortal = true; _portalAte = Time.time + 60f; } } } private static void TerminarPortalSePrecisar() { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) if (!_vaiPeloPortal) { return; } Player jogador = Jogador; if ((Object)(object)jogador == (Object)null || Time.time > _portalAte) { _vaiPeloPortal = false; } else { if (((Character)jogador).IsTeleporting()) { return; } _vaiPeloPortal = false; if ((Object)(object)_corpo != (Object)null) { if (Vector3.Distance(((Component)_corpo).transform.position, ((Component)jogador).transform.position) > 40f) { MoverCorpo(PosicaoDoLado(jogador)); } } else { _estacionadoEm = null; _naoAntesDe = 0f; } Plugin.Log.LogInfo((object)"Bot passou pelo portal junto com o dono."); } } public static void Chamar(Terminal terminal) { //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) Player jogador = Jogador; if ((Object)(object)jogador == (Object)null) { if (terminal != null) { terminal.AddString(Tr.T("Você precisa estar dentro do jogo pra chamar o bot.")); } return; } if (_sessaoJogadorId != jogador.GetPlayerID()) { AoNascer(jogador); } _estado.Ativo = true; _ficarEm = null; if (_casa.HasValue) { if ((Object)(object)_corpo != (Object)null) { _corpo.Falar(Tr.T("Tô cuidando da casa, {0}! Usa /bot seguir pra eu ir contigo.", NomeDoDono(jogador)), 8f); } else { float num = Vector3.Distance(_casa.Value, ((Component)jogador).transform.position); Avisar(jogador, Tr.T("Seu bot tá cuidando da casa, a {0:0} m daqui. Use /bot seguir pra ele voltar a te acompanhar.", num)); } } else if ((Object)(object)_corpo != (Object)null) { float num2 = Vector3.Distance(((Component)_corpo).transform.position, ((Component)jogador).transform.position); _corpo.Falar((num2 < 15f) ? Tr.T("Já tô aqui, {0}!", NomeDoDono(jogador)) : Tr.T("Tô indo, {0}!", NomeDoDono(jogador))); } else if (_estacionadoEm.HasValue) { float num3 = Vector3.Distance(_estacionadoEm.Value, ((Component)jogador).transform.position); Avisar(jogador, Tr.T("Seu bot tá esperando onde ficou, a {0:0} m daqui. Volta lá pra buscar ele.", num3)); } else { _naoAntesDe = 0f; CriarCorpo(PosicaoDoLado(jogador)); } } public static void AoPassarPelaPorta(Player p) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)p == (Object)null) && !((Object)(object)p != (Object)(object)Jogador) && !((Object)(object)_corpo == (Object)null) && !_corpo.Caido && !PontoFixo.HasValue && !_querBarco && !(Vector3.Distance(((Component)_corpo).transform.position, ((Component)p).transform.position) > 40f)) { _passarPelaPortaAte = Time.time + 30f; } } private static void TerminarPortaSePrecisar() { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) if (_passarPelaPortaAte < 0f) { return; } Player jogador = Jogador; if ((Object)(object)jogador == (Object)null || (Object)(object)_corpo == (Object)null || _corpo.Caido || Time.time > _passarPelaPortaAte) { _passarPelaPortaAte = -1f; } else if (!((Character)jogador).IsTeleporting()) { _passarPelaPortaAte = -1f; if (!(Vector3.Distance(((Component)_corpo).transform.position, ((Component)jogador).transform.position) <= 40f)) { MoverCorpo(PosicaoDoLado(jogador)); Plugin.Log.LogInfo((object)"Bot passou pela porta junto com o dono."); } } } private static void MoverCorpo(Vector3 pos) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) ((Component)_corpo).transform.position = pos; Rigidbody component = ((Component)_corpo).GetComponent<Rigidbody>(); if (Object.op_Implicit((Object)(object)component)) { component.position = pos; if (!component.isKinematic) { component.linearVelocity = Vector3.zero; } } if (_corpo.NView.IsValid()) { _corpo.NView.GetZDO().SetPosition(pos); } CompanionAI component2 = ((Component)_corpo).GetComponent<CompanionAI>(); if (Object.op_Implicit((Object)(object)component2)) { ((BaseAI)component2).StopMoving(); } } public static void Tick() { //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0180: 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_0186: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) TerminarPortaSePrecisar(); TerminarPortalSePrecisar(); GravarInventarioSePrecisar(); MusicaBot.Atualizar(_corpo); AtualizarBaus(); MarcaBau.Atualizar(_bausCarregados); VerTeclaTrabalho(); VerTeclaRoda(); VidaBot.Tick(_corpo); TreinoBot.Tick(_corpo); HudBot.Atualizar(_corpo); if (Time.time < _proximoTick) { return; } _proximoTick = Time.time + 0.5f; Player jogador = Jogador; SoltarLapideSePrecisar(jogador); if ((Object)(object)jogador == (Object)null || !_estado.Ativo || (Object)(object)_corpo != (Object)null || _sessaoJogadorId != jogador.GetPlayerID() || (Object)(object)_sessaoRede != (Object)(object)ZNet.instance || Time.time < _naoAntesDe || ((Character)jogador).InIntro() || ((Character)jogador).IsTeleporting() || ((Character)jogador).IsDead() || (Object)(object)ZNetScene.instance == (Object)null || (Object)(object)ZNetScene.instance.GetPrefab(BotPrefab.Hash) == (Object)null) { return; } if (_estacionadoEm.HasValue) { Vector3 value = _estacionadoEm.Value; if (Vector3.Distance(value, ((Component)jogador).transform.position) <= Plugin.DistanciaRecriar.Value && (Object)(object)ZoneSystem.instance != (Object)null && ZoneSystem.instance.IsZoneLoaded(value)) { CriarCorpo((_casa.HasValue && Vector3.Distance(value, _casa.Value) < 0.5f) ? PosicaoPerto(value, Vector3.forward) : value); } } else { CriarCorpo(PosicaoDoLado(jogador)); } } private static void CriarCorpo(Vector3 posicao) { //IL_004d: 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_0053: 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_005d: 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_0066: 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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) Player jogador = Jogador; GameObject val = (Object.op_Implicit((Object)(object)ZNetScene.instance) ? ZNetScene.instance.GetPrefab(BotPrefab.Hash) : null); if ((Object)(object)jogador == (Object)null || (Object)(object)val == (Object)null) { Plugin.Log.LogError((object)"Não deu pra criar o bot: molde não registrado."); return; } Vector3 val2 = Vector3.ProjectOnPlane(((Component)jogador).transform.position - posicao, Vector3.up); Quaternion val3 = Quaternion.LookRotation(((Vector3)(ref val2)).normalized + Vector3.forward * 0.001f); GameObject val4 = Object.Instantiate<GameObject>(val, posicao, val3); BotBody component = val4.GetComponent<BotBody>(); if ((Object)(object)co