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 Bertram Buddy Bot v3.9.1
BepInEx\plugins\BertramBuddyBot\BertramBuddyBot.dll
Decompiled 6 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.IO.Compression; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text; using System.Threading; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using ExitGames.Client.Photon; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using Photon.Realtime; using Strobotnik.Klattersynth; using UnityEngine; using UnityEngine.AI; using UnityEngine.Audio; using UnityEngine.Networking; using UnityEngine.Rendering; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("BertramBuddyBot")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Bertram Buddy Bot - autonomous bot player & NPC teammate for R.E.P.O.")] [assembly: AssemblyFileVersion("3.9.1.0")] [assembly: AssemblyInformationalVersion("3.9.1")] [assembly: AssemblyProduct("BertramBuddyBot")] [assembly: AssemblyTitle("BertramBuddyBot")] [assembly: AssemblyVersion("3.9.1.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace BotSpike { public static class BotAggro { private const float Damping = 0.35f; private static bool _warnedStuckTimer; private const float CycleSeconds = 1f; private const float ReRegisterEvery = 3f; private static float _registerAt; private static int _lastCount = -1; public static void Reset() { _registerAt = 0f; _lastCount = -1; } public static void Tick(PlayerAvatar bot, float dt) { if (!((Object)(object)bot == (Object)null)) { KeepRegistered(bot); Damp(bot); } } private static void KeepRegistered(PlayerAvatar bot) { if (Time.unscaledTime < _registerAt) { return; } _registerAt = Time.unscaledTime + 3f; try { if ((Object)(object)EnemyDirector.instance == (Object)null) { return; } PhotonView component = ((Component)bot).GetComponent<PhotonView>(); if ((Object)(object)component == (Object)null) { return; } int viewID = component.ViewID; int num = 0; foreach (EnemyParent item in EnemyDirector.instance.enemiesSpawned) { if ((Object)(object)item == (Object)null) { continue; } object obj = Reflect.Get<object>(item, "Enemy"); if (obj == null) { continue; } try { MethodInfo methodInfo = AccessTools.Method(obj.GetType(), "PlayerAdded", (Type[])null, (Type[])null); if (methodInfo != null) { methodInfo.Invoke(obj, new object[1] { viewID }); num++; } } catch { } } if (num != _lastCount) { Plugin.Log.LogInfo((object)("[Aggro] He is now known to " + num + " enemies (was " + ((_lastCount < 0) ? "none" : _lastCount.ToString()) + ").")); _lastCount = num; } } catch (Exception ex) { Plugin.Log.LogWarning((object)("[Aggro] Re-register: " + ex.Message)); } } private static void Damp(PlayerAvatar bot) { try { if (Reflect.Get<bool>(bot, "isDisabled")) { return; } bool num = Time.time % 1f < 0.35f; float num2 = Reflect.Get<float>(bot, "enemyVisionFreezeTimer"); if (num) { if (num2 < 0.05f) { Reflect.Set(bot, "enemyVisionFreezeTimer", 0.06f); } } else if (num2 > 0f) { if (num2 > 0.2f && !_warnedStuckTimer) { _warnedStuckTimer = true; Plugin.Log.LogWarning((object)("[Aggro] His enemyVisionFreezeTimer was stuck at " + num2.ToString("F2") + " — the game had stopped decaying it, so every enemy was skipping him entirely. Clearing it myself from now on. If you see this, his PlayerAvatar.Update is throwing somewhere.")); } Reflect.Set(bot, "enemyVisionFreezeTimer", 0f); } } catch { } } [HarmonyPatch(typeof(EnemyVision), "Awake")] [HarmonyPostfix] public static void VisionAwakePostfix(EnemyVision __instance) { try { PlayerAvatar botAvatar = BotSpawner.BotAvatar; if (!((Object)(object)botAvatar == (Object)null)) { PhotonView component = ((Component)botAvatar).GetComponent<PhotonView>(); if (!((Object)(object)component == (Object)null)) { __instance.PlayerAdded(component.ViewID); Plugin.Log.LogInfo((object)"[Aggro] A new enemy woke up — introduced it to him immediately."); } } } catch { } } } public static class BotAssist { private static PlayerAvatar _who; private static PhysGrabObject _what; private static float _until; private static float _offerAt; private const float Reach = 6f; private const float MaxSeconds = 45f; public static bool Helping { get; private set; } public static void Reset() { Helping = false; _who = null; _what = null; } public static bool Help(PlayerAvatar asker, Vector3 botPos) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) try { PlayerAvatar val = asker ?? BotBuddy.Current; if ((Object)(object)val == (Object)null) { BotPersona.SpeakExact(BotPersona.HelpNobody, botPos); return false; } PhysGrabObject val2 = HeldBy(val); if ((Object)(object)val2 == (Object)null || BotHands.IsCart(val2)) { BotPersona.SpeakExact(BotPersona.HelpNothing, botPos, SemiFunc.PlayerGetName(val)); return false; } return Begin(val, val2, botPos, announce: true); } catch (Exception ex) { Plugin.Log.LogWarning((object)("[Assist] " + ex.Message)); return false; } } private static bool Begin(PlayerAvatar who, PhysGrabObject what, Vector3 botPos, bool announce) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) _who = who; _what = what; Helping = true; _until = Time.unscaledTime + 45f; BotHands.DropEverything(); if (announce) { BotPersona.SpeakExact(BotPersona.HelpOnIt, botPos, SemiFunc.PlayerGetName(who)); } Plugin.Log.LogInfo((object)("[Assist] Helping " + SemiFunc.PlayerGetName(who) + " with '" + ((Object)((Component)what).gameObject).name + "'.")); return true; } public static void MaybeOffer(Vector3 botPos) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) try { if (Helping || Time.unscaledTime < _offerAt || BotHands.Current != BotHands.Job.Idle) { return; } PlayerAvatar current = BotBuddy.Current; if ((Object)(object)current == (Object)null || Reflect.Get<bool>(current, "isDisabled") || Vector3.Distance(botPos, ((Component)current).transform.position) > 6f) { return; } PhysGrabObject val = HeldBy(current); if (!((Object)(object)val == (Object)null) && !((Object)(object)val.rb == (Object)null) && !BotHands.IsCart(val) && !(val.rb.mass < 2f)) { Vector3 velocity = val.rb.velocity; if (!(((Vector3)(ref velocity)).magnitude > 0.6f)) { _offerAt = Time.unscaledTime + 25f; Begin(current, val, botPos, announce: false); BotPersona.SpeakExact(BotPersona.HelpUnasked, botPos, SemiFunc.PlayerGetName(current)); } } } catch { } } public static bool Tick(GameObject bot, PlayerAvatar avatar, float dt) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_0129: 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_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0155: 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_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_016c: 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) if (!Helping) { return false; } try { Vector3 position = bot.transform.position; if ((Object)(object)_who == (Object)null || (Object)(object)_what == (Object)null || Time.unscaledTime > _until || Reflect.Get<bool>(_who, "isDisabled") || (Object)(object)HeldBy(_who) != (Object)(object)_what) { Stop(position, (Object)(object)HeldBy(_who) != (Object)(object)_what && (Object)(object)_what != (Object)null); return false; } Transform transform = ((Component)_what).transform; float num = Vector3.Distance(position, transform.position); PhysGrabber physGrabber = avatar.physGrabber; if ((Object)(object)physGrabber == (Object)null) { Stop(position, announce: false); return false; } if (!((Object)(object)Reflect.Get<PhysGrabObject>(physGrabber, "grabbedPhysGrabObject") == (Object)(object)_what)) { if (num > 2.2f) { BotMovement.SetDestination(transform.position); BotMovement.FaceTowards(transform.position); return true; } BotHands.GrabDirectly(_what); return true; } PhysGrabber physGrabber2 = _who.physGrabber; Vector3 aim = transform.position + Vector3.up * 0.6f; if ((Object)(object)physGrabber2 != (Object)null) { Vector3 val = Reflect.Get<Vector3>(physGrabber2, "physGrabPointPullerPosition"); if (((Vector3)(ref val)).sqrMagnitude > 0.0001f) { aim = val; } } BotMovement.FaceTowards(transform.position); if (num > 2.6f) { BotMovement.SetDestination(transform.position); } else { BotMovement.Stop(); } BotHands.HoldAt(physGrabber, _what, bot, dt, aim); return true; } catch (Exception ex) { Plugin.Log.LogWarning((object)("[Assist] " + ex.Message)); return false; } } public static void Stop(Vector3 botPos, bool announce) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) if (Helping) { Helping = false; _who = null; _what = null; BotHands.DropEverything(); if (announce) { BotPersona.SpeakExact(BotPersona.HelpDone, botPos); } } } private static PhysGrabObject HeldBy(PlayerAvatar p) { try { PhysGrabber val = (((Object)(object)p != (Object)null) ? p.physGrabber : null); if ((Object)(object)val == (Object)null) { return null; } return Reflect.Get<PhysGrabObject>(val, "grabbedPhysGrabObject"); } catch { return null; } } } public static class BotBuddy { private static float _checkTimer; public static PlayerAvatar Current { get; private set; } public static string CurrentName { get { if (!Alive(Current)) { return null; } return SemiFunc.PlayerGetName(Current); } } public static void Reset() { Current = null; _checkTimer = 0f; } public static bool AnchorPosition(out Vector3 pos) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_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) pos = Vector3.zero; if (!Alive(Current)) { return false; } pos = ((Component)Current).transform.position; return true; } public static void Tick(float dt, Vector3 botPos) { //IL_007f: Unknown result type (might be due to invalid IL or missing references) _checkTimer -= dt; if (_checkTimer > 0f) { return; } _checkTimer = 1.5f; if (!Alive(Current)) { PlayerAvatar val = PickRandom(null); if ((Object)(object)val == (Object)null) { Current = null; Announce(); return; } bool num = (Object)(object)Current != (Object)null; Current = val; Announce(); BotPersona.Speak(num ? "newbuddy" : "buddy", BotPersona.BuddyPicked, 1f, 20f, botPos, SemiFunc.PlayerGetName(val)); Plugin.Log.LogInfo((object)("[Buddy] Sticking with " + SemiFunc.PlayerGetName(val) + ".")); } } private static void Announce() { try { int num = -1; if ((Object)(object)Current != (Object)null) { PhotonView component = ((Component)Current).GetComponent<PhotonView>(); if ((Object)(object)component != (Object)null && component.Owner != null) { num = component.Owner.ActorNumber; } } BotBuddyHud.SetBuddyLocal(num); BotNet.BroadcastBuddy(num); } catch { } } public static void Assign(PlayerAvatar p, Vector3 botPos) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) if (Alive(p)) { Current = p; _checkTimer = 1.5f; Announce(); BotPersona.Speak("buddy", BotPersona.BuddyPicked, 1f, 0f, botPos, SemiFunc.PlayerGetName(p)); Plugin.Log.LogInfo((object)("[Buddy] Reassigned to " + SemiFunc.PlayerGetName(p) + ".")); } } public static void Reroll(Vector3 botPos) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) PlayerAvatar val = PickRandom(Current); if ((Object)(object)val == (Object)null) { BotPersona.Speak("nobuddy", BotPersona.NoOneElse, 1f, 10f, botPos); return; } Current = val; _checkTimer = 1.5f; Announce(); BotPersona.Speak("newbuddy", BotPersona.BuddyPicked, 1f, 0f, botPos, SemiFunc.PlayerGetName(val)); Plugin.Log.LogInfo((object)("[Buddy] Swapped to " + SemiFunc.PlayerGetName(val) + ".")); } private static bool Alive(PlayerAvatar p) { try { if ((Object)(object)p == (Object)null) { return false; } if (BotSpawner.IsBot(p)) { return false; } if (Reflect.Get<bool>(p, "isDisabled")) { return false; } if ((Object)(object)GameDirector.instance != (Object)null && !GameDirector.instance.PlayerList.Contains(p)) { return false; } return true; } catch { return false; } } private static PlayerAvatar PickRandom(PlayerAvatar avoid) { try { if ((Object)(object)GameDirector.instance == (Object)null) { return null; } List<PlayerAvatar> list = new List<PlayerAvatar>(); foreach (PlayerAvatar player in GameDirector.instance.PlayerList) { if (Alive(player) && player != avoid) { list.Add(player); } } if (list.Count == 0) { return null; } return list[Random.Range(0, list.Count)]; } catch { return null; } } } public static class BotBuddyHud { private sealed class Cmd { public readonly string Intent; public readonly string Label; public Cmd(string intent, string label) { Intent = intent; Label = label; } } private static readonly List<Cmd> Commands = new List<Cmd> { new Cmd("buddy.claim", "Follow me"), new Cmd("move.wait", "Wait here"), new Cmd("scout.go", "Scout ahead"), new Cmd("cart.fetch", "Fetch the cart"), new Cmd("medic.revive", "Revive them"), new Cmd("medic.heal", "Heal me"), new Cmd("work.drop", "Drop it"), new Cmd("scout.report", "Report"), new Cmd("social.quiet", "Be quiet"), new Cmd("social.unquiet", "Speak up"), new Cmd("work.resume", "Back to work"), new Cmd("work.stop", "Stop working"), new Cmd("move.hide", "Hide"), new Cmd("buddy.reroll", "Go find someone else"), new Cmd("buddy.who", "Who are you following?"), new Cmd("social.praise", "Good job"), new Cmd("social.howareyou", "How are you?"), new Cmd("social.greet", "Hey Bertram"), new Cmd("social.robot", "Are you a robot?"), new Cmd("social.name", "What's your name?") }; private static int _slot; private static float _drum; private static bool _wasArmed; private static float _flash; private static string _flashLabel; private static GUIStyle _title; private static GUIStyle _row; private static GUIStyle _rowHi; private static GUIStyle _num; private static GUIStyle _foot; private static Texture2D _panelTex; private static Texture2D _hiTex; private static Texture2D _lineTex; private static Texture2D _shadeTex; private static Texture2D _icon; private const float DrumHeight = 150f; private const float RowPitch = 26f; private const float DegPerRow = 21f; public static int BuddyActor { get; private set; } = -1; private static int SlotCount => Commands.Count + 1; private static Cmd Selected { get { if (_slot <= 0 || _slot > Commands.Count) { return null; } return Commands[_slot - 1]; } } public static bool Visible { get { try { if (Plugin.CfgBuddyHud != null && !Plugin.CfgBuddyHud.Value) { return false; } if (SemiFunc.MenuLevel() && !SemiFunc.RunIsLobbyMenu()) { return false; } PlayerAvatar val = LocalAvatar(); if ((Object)(object)val == (Object)null) { return false; } if (Reflect.Get<bool>(val, "isDisabled")) { return false; } if (!BotSpawner.HasBot) { return false; } if (BotIntercom.Open) { return true; } if (!PhotonNetwork.InRoom || PhotonNetwork.IsMasterClient) { return (Object)(object)BotBuddy.Current == (Object)(object)val; } return BuddyActor >= 0 && PhotonNetwork.LocalPlayer.ActorNumber == BuddyActor; } catch { return false; } } } public static void Reset() { BuddyActor = -1; _slot = 0; _drum = 0f; _wasArmed = false; _flash = 0f; } public static void SetBuddyLocal(int actorNumber) { if (BuddyActor != actorNumber) { BuddyActor = actorNumber; if (actorNumber < 0) { _slot = 0; _drum = 0f; } } } public static void OnBuddyBroadcast(int actorNumber) { BuddyActor = actorNumber; if (!Visible) { _slot = 0; _drum = 0f; } } private static PlayerAvatar LocalAvatar() { try { if ((Object)(object)PlayerController.instance != (Object)null && (Object)(object)PlayerController.instance.playerAvatarScript != (Object)null) { return PlayerController.instance.playerAvatarScript; } } catch { } return null; } public static void Tick() { //IL_0042: Unknown result type (might be due to invalid IL or missing references) try { if (_flash > 0f) { _flash -= Time.unscaledDeltaTime; } bool armed = BotInputGate.Armed; if (armed && !_wasArmed) { _slot = 0; _drum = 0f; } if (armed) { float y = Input.mouseScrollDelta.y; if (Mathf.Abs(y) > 0.01f) { int num = ((!(y > 0f)) ? 1 : (-1)); int slot = _slot; _slot = (_slot + num + SlotCount) % SlotCount; if (slot == SlotCount - 1 && _slot == 0) { _drum -= SlotCount; } else if (slot == 0 && _slot == SlotCount - 1) { _drum += SlotCount; } } for (int i = 0; i < 9 && i < Commands.Count; i++) { if (Input.GetKeyDown((KeyCode)(49 + i)) || Input.GetKeyDown((KeyCode)(257 + i))) { Send(i); _slot = 0; _drum = 0f; break; } } } if (!armed && _wasArmed) { if (_slot > 0) { Send(_slot - 1); } _slot = 0; } _drum = Mathf.Lerp(_drum, (float)_slot, 1f - Mathf.Exp(-18f * Time.unscaledDeltaTime)); if (Mathf.Abs(_drum - (float)_slot) < 0.001f) { _drum = _slot; } _wasArmed = armed; } catch (Exception ex) { Plugin.Log.LogWarning((object)("[Hud] " + ex.Message)); } } private static void Send(int index) { if (index >= 0 && index < Commands.Count) { Cmd cmd = Commands[index]; _flash = 0.8f; _flashLabel = cmd.Label; if (!PhotonNetwork.InRoom || PhotonNetwork.IsMasterClient) { BotCommands.Run(cmd.Intent, LocalAvatar()); } else { BotNet.SendHudCommand(cmd.Intent); } Plugin.Log.LogInfo((object)("[Hud] Sent '" + cmd.Intent + "' (" + cmd.Label + ").")); } } public static void Draw() { //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) if (!Visible) { return; } try { EnsureSkin(); bool armed = BotInputGate.Armed; float num = (armed ? 150f : 40f); float num2 = 58f + num + 22f; float num3 = (float)Screen.width - 276f - 18f; float num4 = (float)Screen.height - num2 - 18f; GUI.DrawTexture(new Rect(num3, num4, 276f, num2), (Texture)(object)_panelTex, (ScaleMode)0); GUI.DrawTexture(new Rect(num3 + 12f, num4 + 10f, 64f, 32f), (Texture)(object)_icon, (ScaleMode)2); GUI.Label(new Rect(num3 + 84f, num4 + 9f, 182f, 18f), BotSpawner.ChosenName.ToUpperInvariant(), _title); GUI.Label(new Rect(num3 + 84f, num4 + 26f, 182f, 16f), (_flash > 0f) ? ("sent: " + _flashLabel) : "is sticking with you", _foot); GUI.DrawTexture(new Rect(num3 + 10f, num4 + 58f - 10f, 256f, 1f), (Texture)(object)_lineTex, (ScaleMode)0); Rect area = default(Rect); ((Rect)(ref area))..ctor(num3 + 8f, num4 + 58f, 260f, num); if (!armed) { GUI.Label(new Rect(((Rect)(ref area)).x + 6f, ((Rect)(ref area)).y + 2f, ((Rect)(ref area)).width - 12f, 18f), "Hold ALT", _row); GUI.Label(new Rect(((Rect)(ref area)).x + 6f, ((Rect)(ref area)).y + 19f, ((Rect)(ref area)).width - 12f, 16f), "wheel spins · release sends · 1-9 direct", _foot); } else { DrawDrum(area); GUI.Label(new Rect(num3 + 10f, num4 + num2 - 18f, 256f, 14f), (Selected == null) ? "spin to choose" : ("release ALT → " + Selected.Label), _foot); } } catch { } } private static void DrawDrum(Rect area) { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_007e: 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_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00be: 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_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Unknown result type (might be due to invalid IL or missing references) //IL_0369: Unknown result type (might be due to invalid IL or missing references) //IL_0387: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) float num = ((Rect)(ref area)).x + ((Rect)(ref area)).width * 0.5f; float num2 = ((Rect)(ref area)).y + ((Rect)(ref area)).height * 0.5f; float num3 = ((Rect)(ref area)).height * 0.5f; GUI.DrawTexture(new Rect(((Rect)(ref area)).x, num2 - 13f, ((Rect)(ref area)).width, 26f), (Texture)(object)_hiTex, (ScaleMode)0); GUI.DrawTexture(new Rect(((Rect)(ref area)).x, num2 - 13f, ((Rect)(ref area)).width, 1f), (Texture)(object)_lineTex, (ScaleMode)0); GUI.DrawTexture(new Rect(((Rect)(ref area)).x, num2 + 13f, ((Rect)(ref area)).width, 1f), (Texture)(object)_lineTex, (ScaleMode)0); Matrix4x4 matrix = GUI.matrix; Color color = GUI.color; int num4 = Mathf.RoundToInt(_drum); int num5 = Mathf.CeilToInt(4.285714f); Rect val2 = default(Rect); for (int i = -num5; i <= num5; i++) { int num6 = num4 + i; float num7 = ((float)num6 - _drum) * 21f; if (Mathf.Abs(num7) >= 88f) { continue; } float num8 = num7 * (MathF.PI / 180f); float num9 = num3 * Mathf.Sin(num8); float num10 = Mathf.Cos(num8); if (!(num10 <= 0.02f)) { int num11 = (num6 % SlotCount + SlotCount) % SlotCount; bool num12 = num11 == 0; string text = (num12 ? "— nothing —" : Commands[num11 - 1].Label); string text2 = ((num12 || num11 > 9) ? "" : num11.ToString()); float num13 = num2 + num9; float num14 = Mathf.Pow(num10, 1.35f); GUI.color = new Color(1f, 1f, 1f, Mathf.Clamp01(num14)); GUIUtility.ScaleAroundPivot(new Vector2(1f, num10), new Vector2(num, num13)); bool flag = Mathf.Abs(num7) < 10.5f; GUIStyle val = (num12 ? _foot : (flag ? _rowHi : _row)); ((Rect)(ref val2))..ctor(((Rect)(ref area)).x + 8f, num13 - 13f, ((Rect)(ref area)).width - 16f, 26f); if (text2.Length > 0) { GUI.Label(new Rect(((Rect)(ref val2)).x, ((Rect)(ref val2)).y, 16f, ((Rect)(ref val2)).height), text2, _num); } GUI.Label(new Rect(((Rect)(ref val2)).x + 22f, ((Rect)(ref val2)).y, ((Rect)(ref val2)).width - 28f, ((Rect)(ref val2)).height), text, val); GUI.matrix = matrix; } } GUI.color = color; GUI.matrix = matrix; for (int j = 0; j < 7; j++) { float num15 = (float)j / 7f; float num16 = ((Rect)(ref area)).height * 0.3f / 7f; GUI.color = new Color(1f, 1f, 1f, 0.55f * (1f - num15)); GUI.DrawTexture(new Rect(((Rect)(ref area)).x, ((Rect)(ref area)).y + (float)j * num16, ((Rect)(ref area)).width, num16 + 1f), (Texture)(object)_shadeTex, (ScaleMode)0); GUI.DrawTexture(new Rect(((Rect)(ref area)).x, ((Rect)(ref area)).yMax - (float)(j + 1) * num16, ((Rect)(ref area)).width, num16 + 1f), (Texture)(object)_shadeTex, (ScaleMode)0); } GUI.color = color; } private static void EnsureSkin() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Expected O, but got Unknown //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Expected O, but got Unknown //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Expected O, but got Unknown //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017a: 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_018d: Expected O, but got Unknown //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Expected O, but got Unknown //IL_01ec: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_panelTex != (Object)null)) { _panelTex = Solid(new Color(0.06f, 0.07f, 0.08f, 0.92f)); _hiTex = Solid(new Color(0.85f, 0.72f, 0.18f, 0.16f)); _lineTex = Solid(new Color(1f, 1f, 1f, 0.18f)); _shadeTex = Solid(new Color(0.04f, 0.05f, 0.06f, 1f)); _icon = BuildIcon(); _title = new GUIStyle(GUI.skin.label) { fontSize = 14, fontStyle = (FontStyle)1, alignment = (TextAnchor)3 }; _title.normal.textColor = new Color(1f, 0.86f, 0.35f); _row = new GUIStyle(GUI.skin.label) { fontSize = 12, alignment = (TextAnchor)3 }; _row.normal.textColor = new Color(0.86f, 0.88f, 0.9f); _rowHi = new GUIStyle(_row) { fontStyle = (FontStyle)1 }; _rowHi.normal.textColor = new Color(1f, 0.93f, 0.62f); _num = new GUIStyle(_row) { alignment = (TextAnchor)4, fontStyle = (FontStyle)1 }; _num.normal.textColor = new Color(0.55f, 0.6f, 0.66f); _foot = new GUIStyle(GUI.skin.label) { fontSize = 10, alignment = (TextAnchor)3 }; _foot.normal.textColor = new Color(0.6f, 0.64f, 0.7f); } } private static Texture2D Solid(Color c) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown Texture2D val = new Texture2D(1, 1, (TextureFormat)4, false); val.SetPixel(0, 0, c); val.Apply(); ((Object)val).hideFlags = (HideFlags)61; return val; } private static Texture2D BuildIcon() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_0104: 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_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(96, 48, (TextureFormat)4, false); ((Object)val).hideFlags = (HideFlags)61; ((Texture)val).filterMode = (FilterMode)1; Color val2 = default(Color); ((Color)(ref val2))..ctor(0f, 0f, 0f, 0f); Color shell = default(Color); ((Color)(ref shell))..ctor(0.91f, 0.91f, 0.88f, 1f); Color edge = default(Color); ((Color)(ref edge))..ctor(0.55f, 0.56f, 0.55f, 1f); Color visor = default(Color); ((Color)(ref visor))..ctor(0.09f, 0.1f, 0.12f, 1f); Color eye = default(Color); ((Color)(ref eye))..ctor(1f, 0.85f, 0.3f, 1f); for (int i = 0; i < 48; i++) { for (int j = 0; j < 96; j++) { val.SetPixel(j, i, val2); } } DrawBot(val, 30f, 22f, 15f, 0.34f, shell, edge, visor, eye); DrawBot(val, 66f, 22f, 15f, -0.34f, shell, edge, visor, eye); val.Apply(); return val; } private static void DrawBot(Texture2D t, float cx, float cy, float r, float lean, Color shell, Color edge, Color visor, Color eye) { //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0089: 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_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: 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_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Cos(lean); float num2 = Mathf.Sin(lean); for (int i = 0; i < ((Texture)t).height; i++) { for (int j = 0; j < ((Texture)t).width; j++) { float num3 = (float)j + 0.5f - cx; float num4 = (float)i + 0.5f - cy; float num5 = num3 * num + num4 * num2; float num6 = (0f - num3) * num2 + num4 * num; float num7 = Mathf.Pow(Mathf.Abs(num5 / r), 3f) + Mathf.Pow(Mathf.Abs(num6 / (r * 0.92f)), 3f); if (num7 > 1.18f) { continue; } Color val = ((num7 > 0.86f) ? edge : shell); if (num6 > (0f - r) * 0.05f && num6 < r * 0.46f && Mathf.Abs(num5) < r * 0.8f) { val = visor; float num8 = Mathf.Abs(num5) - r * 0.36f; float num9 = num6 - r * 0.21f; if (num8 * num8 + num9 * num9 < r * 0.15f * (r * 0.15f)) { val = eye; } } t.SetPixel(j, i, val); } } } } public static class BotCart { private static readonly HashSet<int> Told = new HashSet<int>(); public static Vector3 SteeringGrip(PhysGrabCart cart, Vector3 fallback) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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) try { if ((Object)(object)cart == (Object)null) { return fallback; } Collider val = HandleCollider(cart); if ((Object)(object)val != (Object)null) { Bounds bounds = val.bounds; return ((Bounds)(ref bounds)).center; } if ((Object)(object)cart.handlePoint != (Object)null) { return cart.handlePoint.position; } } catch { } return fallback; } public static Collider HandleCollider(PhysGrabCart cart) { try { if ((Object)(object)cart == (Object)null) { return null; } PhysGrabObjectGrabArea val = ((Component)cart).GetComponent<PhysGrabObjectGrabArea>() ?? ((Component)cart).GetComponentInChildren<PhysGrabObjectGrabArea>(true); if ((Object)(object)val == (Object)null || val.grabAreas == null) { return null; } foreach (GrabArea grabArea in val.grabAreas) { if (grabArea == null) { continue; } List<Collider> list = Reflect.Get<List<Collider>>(grabArea, "grabAreaColliders"); if (list != null) { foreach (Collider item in list) { if ((Object)(object)item != (Object)null) { return item; } } } if ((Object)(object)grabArea.grabAreaTransform != (Object)null) { Collider val2 = ((Component)grabArea.grabAreaTransform).GetComponent<Collider>() ?? ((Component)grabArea.grabAreaTransform).GetComponentInChildren<Collider>(true); if ((Object)(object)val2 != (Object)null) { return val2; } } } } catch { } return null; } public static bool IsSteering(PhysGrabCart cart, PhysGrabber grabber) { try { if ((Object)(object)cart == (Object)null || (Object)(object)grabber == (Object)null) { return false; } PhysGrabObjectGrabArea val = ((Component)cart).GetComponent<PhysGrabObjectGrabArea>() ?? ((Component)cart).GetComponentInChildren<PhysGrabObjectGrabArea>(true); if ((Object)(object)val == (Object)null || val.listOfAllGrabbers == null) { return false; } return val.listOfAllGrabbers.Contains(grabber) && Reflect.Get<bool>(cart, "cartActive"); } catch { return false; } } public static Vector3 StandingSpot(PhysGrabCart cart, Vector3 grip, Vector3 cartCentre) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: 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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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) Vector3 val = grip - cartCentre; val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude < 0.04f) { return grip; } return grip + ((Vector3)(ref val)).normalized * 1f; } public static Vector3 Maintain(PhysGrabCart cart, PhysGrabber grabber, Vector3 fallback) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: 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_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: 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) Vector3 result = SteeringGrip(cart, fallback); try { if ((Object)(object)cart == (Object)null || (Object)(object)grabber == (Object)null) { return result; } if (Reflect.Get<float>(grabber, "initialPressTimer") <= 0.02f) { Reflect.Set(grabber, "initialPressTimer", 0.15f); } int instanceID = ((Object)cart).GetInstanceID(); if (IsSteering(cart, grabber)) { if (Told.Add(instanceID)) { Plugin.Log.LogInfo((object)"[Cart] He's on the handle — the cart is in Handled mode, so it steers instead of being dragged."); } } else { Told.Remove(instanceID); } } catch { } return result; } } public static class BotChatter { private static float _pollTimer; private static readonly Dictionary<int, int> _lastHealth = new Dictionary<int, int>(); private static readonly HashSet<int> _knownDead = new HashSet<int>(); private const float EarshotRange = 18f; public static void SayFetching() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) BotPersona.Speak("fetch", BotPersona.Fetch, 0.2f, 240f, BotSpawner.BotPosition); } public static void SayHauling() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) BotPersona.Speak("haul", BotPersona.Haul, 0.2f, 240f, BotSpawner.BotPosition); } public static void SayDelivered() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) BotPersona.Speak("delivered", BotPersona.Delivered, 0.35f, 180f, BotSpawner.BotPosition); } public static void SayDanger() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) BotPersona.Speak("danger", BotPersona.Danger, 0.55f, 90f, BotSpawner.BotPosition); } public static void SayOops() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) BotPersona.Speak("oops", BotPersona.Oops, 0.6f, 120f, BotSpawner.BotPosition); } public static void SayYielding() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) BotPersona.Speak("yield", BotPersona.Yield, 0.45f, 150f, BotSpawner.BotPosition); } public static void SayAssisting() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) BotPersona.Speak("assist", BotPersona.Assist, 0.45f, 180f, BotSpawner.BotPosition); } public static void Reset() { BotPersona.Reset(); _lastHealth.Clear(); _knownDead.Clear(); } public static void Tick(GameObject bot, float dt) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)bot == (Object)null) { return; } _pollTimer -= dt; if (_pollTimer > 0f) { return; } _pollTimer = 0.25f; try { PollCrew(bot.transform.position); } catch { } } private static void PollCrew(Vector3 botPos) { //IL_0079: 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_00db: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)GameDirector.instance == (Object)null) { return; } foreach (PlayerAvatar player in GameDirector.instance.PlayerList) { if ((Object)(object)player == (Object)null || BotSpawner.IsBot(player)) { continue; } PhotonView component = ((Component)player).GetComponent<PhotonView>(); if ((Object)(object)component == (Object)null) { continue; } int viewID = component.ViewID; if (Reflect.Get<bool>(player, "deadSet")) { if (_knownDead.Add(viewID) && InEarshot(botPos, player)) { BotOpinions.Eulogise(player, botPos); } continue; } _knownDead.Remove(viewID); PlayerHealth playerHealth = player.playerHealth; if ((Object)(object)playerHealth == (Object)null) { continue; } int num = Reflect.Get<int>(playerHealth, "health"); if (_lastHealth.TryGetValue(viewID, out var value)) { int num2 = value - num; if (num2 > 0 && InEarshot(botPos, player)) { bool flag = num2 >= 25 || num <= 30; BotPersona.Speak(flag ? "badhurt" : "hurt", flag ? BotPersona.BadHurt : BotPersona.Hurt, flag ? 0.55f : 0.3f, flag ? 90f : 150f, botPos); } } _lastHealth[viewID] = num; } } private static bool InEarshot(Vector3 botPos, PlayerAvatar p) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) return Vector3.Distance(botPos, ((Component)p).transform.position) <= 18f; } public static void MaybeIdleChatter() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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_0018: Unknown result type (might be due to invalid IL or missing references) Vector3 botPosition = BotSpawner.BotPosition; string text = BotComposer.Ambient1(); if (text != null && BotPersona.SpeakLiteral(text, botPosition)) { BotComposer.MaybeSecondThought(botPosition); } else { BotPersona.Speak("idle", BotPersona.Idle, 0.5f, 150f, botPosition); } } [HarmonyPatch(typeof(PhysGrabObjectImpactDetector), "BreakRPC")] [HarmonyPostfix] public static void OnValuableBroke(PhysGrabObjectImpactDetector __instance, float valueLost, int breakLevel, bool _loseValue) { //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: 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_01d9: Unknown result type (might be due to invalid IL or missing references) try { if (!BotSpawner.HasBot || valueLost <= 0f || !_loseValue) { return; } Vector3 botPosition = BotSpawner.BotPosition; Transform transform = ((Component)__instance).transform; if (Vector3.Distance(botPosition, transform.position) > 18f) { return; } PhysGrabObject val = ((Component)__instance).GetComponent<PhysGrabObject>() ?? ((Component)__instance).GetComponentInParent<PhysGrabObject>(); PlayerAvatar val2 = (((Object)(object)val != (Object)null) ? Reflect.Get<PlayerAvatar>(val, "lastPlayerGrabbing") : null); if (((Object)(object)val != (Object)null && BotHands.IsCarrying(val)) || ((Object)(object)val2 != (Object)null && BotSpawner.IsBot(val2))) { BotPersona.Speak("oops", BotPersona.Oops, 0.6f, 120f, botPosition); return; } if ((Object)(object)val2 != (Object)null && !BotSpawner.IsBot(val2)) { BotFacts.NoteBreakage(SemiFunc.PlayerGetName(val2)); string text = BotComposer.OnBreakage(); if (text != null && BotPersona.SpeakLiteral(text, botPosition)) { BotComposer.MaybeSecondThought(botPosition, 0.25f); return; } } try { ValuableObject val3 = ((Component)__instance).GetComponent<ValuableObject>() ?? ((Component)__instance).GetComponentInParent<ValuableObject>(); if ((Object)(object)val3 != (Object)null && (Object)(object)val2 != (Object)null) { float num = Reflect.Get<float>(val3, "dollarValueOriginal"); float num2 = Reflect.Get<float>(val3, "dollarValueCurrent"); if (num > 0f && num2 < num * 0.15f) { BotTattle.Witnessed((Component)(object)__instance, val2, Mathf.RoundToInt(num)); } } } catch { } if ((Object)(object)val2 != (Object)null && !Reflect.Get<bool>(val2, "isDisabled")) { string aboutName = (BotPersona.CanSee(botPosition, val2) ? SemiFunc.PlayerGetName(val2) : null); bool flag = breakLevel <= 1 || valueLost >= 40f; BotPersona.Speak(flag ? "blamebig" : "blame", flag ? BotPersona.BlameBig : BotPersona.Blame, flag ? 0.75f : 0.5f, flag ? 90f : 45f, botPosition, aboutName); } else { BotPersona.Speak("break", BotPersona.Break, 0.5f, 120f, botPosition); } } catch { } } } public static class BotChute { public static Vector3 StandingSpot(ExtractionPoint ep) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0039: 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_0048: 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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: 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_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: 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_0106: 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) Vector3 val = Vector3.zero; try { if ((Object)(object)ep == (Object)null) { return val; } val = (((Object)(object)ep.safetySpawn != (Object)null) ? ep.safetySpawn : ((Component)ep).transform).position; RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(val + Vector3.up * 3f, Vector3.down, ref val2, 30f, LayerMask.GetMask(new string[2] { "Default", "StaticGrabObject" }), (QueryTriggerInteraction)1)) { return new Vector3(val.x, ((RaycastHit)(ref val2)).point.y + 0.15f, val.z); } NavMeshHit val3 = default(NavMeshHit); if (NavMesh.SamplePosition(val, ref val3, 3f, -1)) { Vector2 val4 = default(Vector2); ((Vector2)(ref val4))..ctor(((NavMeshHit)(ref val3)).position.x - val.x, ((NavMeshHit)(ref val3)).position.z - val.z); if (((Vector2)(ref val4)).magnitude < 1.5f) { return ((NavMeshHit)(ref val3)).position + Vector3.up * 0.15f; } } Plugin.Log.LogWarning((object)("[Chute] No floor found under '" + ((Object)ep).name + "' — using the raw anchor, which is how he ends up wedged in the top.")); return val + Vector3.up * 0.1f; } catch (Exception ex) { Plugin.Log.LogWarning((object)("[Chute] " + ex.Message)); return val; } } public static bool LooksStandable(Vector3 p) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: 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_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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_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) try { RaycastHit val = default(RaycastHit); if (!Physics.Raycast(p + Vector3.up * 0.5f, Vector3.down, ref val, 4f, LayerMask.GetMask(new string[2] { "Default", "StaticGrabObject" }), (QueryTriggerInteraction)1)) { return false; } return !Physics.CheckSphere(p + Vector3.up * 0.6f, 0.25f, LayerMask.GetMask(new string[2] { "Default", "StaticGrabObject" }), (QueryTriggerInteraction)1); } catch { return true; } } } public static class BotCommands { private sealed class Ctx { public PlayerAvatar Speaker; public Vector3 BotPos; public string Text; } private sealed class Intent { public string Name; public string[] Phrases; public Action<Ctx> Run; public Intent(string name, string[] phrases, Action<Ctx> run) { Name = name; Phrases = phrases; Run = run; } } private struct PendingChat { public string Text; public PlayerAvatar Who; public float At; } private static readonly List<Intent> Table = new List<Intent> { new Intent("cart.fetch", new string[14] { "bring the cart", "get the cart", "fetch the cart", "cart over here", "bring a cart", "cart please", "i need the cart", "we need the cart", "push the cart", "cart here", "bringing the cart", "getting the cart", "fetching the cart", "the cart" }, delegate(Ctx c) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) BotHands.FetchCart(c.Speaker, c.BotPos); }), new Intent("buddy.reroll", new string[7] { "someone else", "somebody else", "new buddy", "leave me alone", "go away", "get lost", "not me" }, delegate(Ctx c) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) BotScout.Stop(c.BotPos, announce: false); if (!BotGrudge.NoteDismissal(c.Speaker, c.BotPos)) { BotBuddy.Reroll(c.BotPos); } }), new Intent("buddy.claim", new string[8] { "follow me", "come here", "with me", "over here", "stay close", "on me", "stick with me", "come with" }, delegate(Ctx c) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) BotScout.Stop(c.BotPos, announce: false); if ((Object)(object)c.Speaker != (Object)null) { if (Reflect.Get<bool>(c.Speaker, "isDisabled")) { BotMedic.OrderRevive(c.BotPos); } else { BotBuddy.Assign(c.Speaker, c.BotPos); if (BotDanger.Level == BotDanger.Threat.Hiding) { BotDanger.ForceWary(); } } } else { BotPersona.Speak("confused", BotPersona.Confused, 1f, 5f, c.BotPos); } }), new Intent("buddy.who", new string[4] { "who are you with", "whose buddy", "who's your buddy", "who are you following" }, delegate(Ctx c) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) string currentName = BotBuddy.CurrentName; if (string.IsNullOrEmpty(currentName)) { BotPersona.Speak("nobuddy", BotPersona.NoOneElse, 1f, 5f, c.BotPos); } else { BotPersona.Speak("buddywho", BotPersona.BuddyWho, 1f, 5f, c.BotPos, currentName); } }), new Intent("medic.revive", new string[20] { "revive", "resurrect", "res him", "res her", "res them", "rez", "raise him", "raise her", "bring him back", "bring her back", "bring them back", "jump start", "jumpstart", "jumper cables", "shock him", "shock her", "get him up", "get her up", "wake him", "wake her" }, delegate(Ctx c) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) BotMedic.OrderRevive(c.BotPos); }), new Intent("medic.heal", new string[11] { "heal me", "heal him", "heal her", "heal them", "patch me up", "patch him up", "i need health", "give me health", "top me up", "i'm hurt", "im hurt" }, delegate(Ctx c) { //IL_0090: 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) BotMedic.OrderHeal(((c.Text.Contains("heal me") || c.Text.Contains("patch me") || c.Text.Contains("top me") || c.Text.Contains("i need") || c.Text.Contains("give me") || c.Text.Contains("hurt")) ? c.Speaker : NearestHurtOther(c.BotPos, c.Speaker)) ?? c.Speaker, c.BotPos); }), new Intent("scout.go", new string[11] { "look around", "take a look", "have a look", "go and look", "scout", "explore", "recon", "check it out", "scope it out", "go ahead", "see what's out there" }, delegate(Ctx c) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) BotScout.Begin(c.BotPos, c.Speaker); }), new Intent("scout.report", new string[7] { "report", "what did you see", "anything out there", "find anything", "see anything", "what's out there", "sitrep" }, delegate(Ctx c) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) BotScout.Report(c.BotPos); }), new Intent("work.drop", new string[4] { "drop it", "put it down", "let go", "drop that" }, delegate(Ctx c) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) BotHands.DropEverything(); BotPersona.Speak("acknowledge", BotPersona.Acknowledge, 1f, 3f, c.BotPos); }), new Intent("work.stop", new string[6] { "stop working", "stop looting", "leave the loot", "forget the loot", "don't touch anything", "hands off" }, delegate(Ctx c) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) BotHands.PauseWork(paused: true); BotPersona.Speak("toldoff", BotPersona.ToldOff, 1f, 10f, c.BotPos); }), new Intent("work.resume", new string[8] { "get to work", "back to work", "start working", "grab the loot", "get the loot", "fill the cart", "load the cart", "do your job" }, delegate(Ctx c) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) BotHands.PauseWork(paused: false); BotScout.Stop(c.BotPos, announce: false); BotPersona.Speak("acknowledge", BotPersona.Acknowledge, 1f, 3f, c.BotPos); }), new Intent("move.hide", new string[4] { "hide", "get down", "take cover", "get out of sight" }, delegate(Ctx c) { //IL_0001: 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) BotScout.Stop(c.BotPos, announce: false); BotDanger.ForceHide(12f); BotPersona.Speak("acknowledge", BotPersona.Acknowledge, 1f, 3f, c.BotPos); }), new Intent("social.unquiet", new string[8] { "you can talk", "talk again", "all clear", "at ease", "it's gone", "its gone", "coast is clear", "you can speak" }, delegate(Ctx c) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) if (BotHush.Release()) { BotPersona.SpeakExact(BotPersona.Unhushed, c.BotPos); } else { BotPersona.Speak("confused", BotPersona.Confused, 1f, 8f, c.BotPos); } }), new Intent("social.quiet", new string[8] { "shut up", "be quiet", "stop talking", "zip it", "pipe down", "quiet", "hush", "silence" }, delegate(Ctx c) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) BotScout.Stop(c.BotPos, announce: false); BotHush.Start(30f); BotGrudge.NoteHush(c.Speaker, c.BotPos); }), new Intent("move.wait", new string[6] { "wait", "stay", "hold on", "hold up", "stand still", "stop" }, delegate(Ctx c) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) BotScout.Stop(c.BotPos, announce: false); BotMovement.Stop(); BotPersona.Speak("acknowledge", BotPersona.Acknowledge, 1f, 3f, c.BotPos); }), new Intent("ask.haul", new string[9] { "how much do we have", "how much have we got", "what's the haul", "whats the haul", "how much money", "are we short", "how much more", "what's the total", "whats the total" }, delegate(Ctx c) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) BotOrders.ReportHaul(c.BotPos); }), new Intent("ask.extractions", new string[4] { "how many extractions", "how many left", "how many more", "extractions left" }, delegate(Ctx c) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) BotOrders.ReportExtractions(c.BotPos); }), new Intent("ask.alive", new string[8] { "who's alive", "whos alive", "who's left", "whos left", "who's down", "whos down", "is anyone alive", "how many are up" }, delegate(Ctx c) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) BotOrders.ReportAlive(c.BotPos); }), new Intent("ask.where", new string[4] { "where are you", "where'd you go", "where did you go", "how far are you" }, delegate(Ctx c) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) BotOrders.ReportPosition(c.BotPos); }), new Intent("ask.safe", new string[6] { "is it clear", "is it safe", "anything there", "anything near you", "see anything", "all clear over there" }, delegate(Ctx c) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) BotOrders.ReportSafety(c.BotPos); }), new Intent("point.go", new string[9] { "go over there", "go there", "over there", "go that way", "head over there", "get over there", "move over there", "stand there", "wait over there" }, delegate(Ctx c) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) BotOrders.GoThere(c.Speaker, c.BotPos); }), new Intent("point.grab", new string[22] { "grab that", "grab this", "take that", "take this", "get that", "get this", "pick that up", "pick this up", "bring that", "carry this", "carry that", "grabbing that", "grabbing this", "taking that", "taking this", "getting that", "getting this", "picking that up", "picking this up", "bringing that", "carrying that", "carrying this" }, delegate(Ctx c) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) BotOrders.GrabThat(c.Speaker, c.BotPos); }), new Intent("point.leave", new string[7] { "leave that", "leave it alone", "don't touch that", "dont touch that", "put that down", "not that one", "forget that one" }, delegate(Ctx c) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) BotOrders.LeaveThat(c.Speaker, c.BotPos); }), new Intent("point.follow", new string[9] { "follow him", "follow her", "follow them", "go with him", "go with her", "go with them", "stay with him", "stay with her", "stay with them" }, delegate(Ctx c) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) BotOrders.FollowThem(c.Speaker, c.BotPos); }), new Intent("go.truck", new string[6] { "go to the truck", "get to the truck", "back to the truck", "head to the truck", "get in the truck", "truck" }, delegate(Ctx c) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) BotOrders.GoToTruck(c.BotPos); }), new Intent("go.extraction", new string[5] { "go to extraction", "get to extraction", "head to extraction", "go to the extraction point", "get to the chute" }, delegate(Ctx c) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) BotOrders.GoToExtraction(c.BotPos); }), new Intent("body.crouch", new string[4] { "crouch", "get low", "duck", "keep your head down" }, delegate(Ctx c) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) BotOrders.Crouch(down: true, c.BotPos); }), new Intent("body.stand", new string[4] { "stand up", "get up", "stand", "on your feet" }, delegate(Ctx c) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) BotOrders.Crouch(down: false, c.BotPos); }), new Intent("body.jump", new string[3] { "jump", "hop", "get up there" }, delegate(Ctx c) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) BotOrders.Jump(c.BotPos); }), new Intent("body.lookat", new string[4] { "look at me", "face me", "eyes on me", "pay attention" }, delegate(Ctx c) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) BotOrders.LookAt(c.Speaker, c.BotPos); }), new Intent("body.backup", new string[8] { "back up", "move back", "get out of the way", "out of my way", "you're in the way", "youre in the way", "give me room", "move" }, delegate(Ctx c) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) BotOrders.BackUp(c.Speaker, c.BotPos); }), new Intent("social.praise", new string[16] { "good bot", "good boy", "thanks", "thank you", "thankyou", "cheers", "nice one", "well done", "good work", "legend", "you're the best", "appreciate it", "you saved me", "nice save", "much obliged", "ta" }, delegate(Ctx c) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) BotOpinions.Thank(c.Speaker, 1f, "said something nice"); BotPersona.Speak("praised", BotPersona.Praised, 1f, 6f, c.BotPos); }), new Intent("social.name", new string[3] { "what's your name", "who are you", "your name" }, delegate(Ctx c) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BotPersona.Speak("whoami", BotPersona.WhoAmI, 1f, 10f, c.BotPos); }), new Intent("social.robot", new string[7] { "are you a robot", "are you a bot", "are you real", "are you human", "are you an ai", "are you the impostor", "are you a player" }, delegate(Ctx c) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BotPersona.Speak("denial", BotPersona.Denial, 1f, 15f, c.BotPos); }), new Intent("fun.playsong", new string[4] { "play ", "put on ", "play some ", "dj " }, delegate(Ctx c) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) BotDance.RequestSong(c.Text, c.BotPos); }), new Intent("fun.dance", new string[5] { "dance", "boogie", "bust a move", "show us your moves", "get down" }, delegate(Ctx c) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) BotDance.Start(c.BotPos); }), new Intent("fun.stopdance", new string[4] { "stop dancing", "turn it off", "stop the music", "enough dancing" }, delegate { BotDance.Stop(announce: true); }), new Intent("assist.lift", new string[11] { "help me lift", "help me carry", "help me with this", "give me a hand", "help me pick", "help me move", "grab this too", "help lift", "help carry", "lend a hand", "help me grab" }, delegate(Ctx c) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) BotAssist.Help(c.Speaker, c.BotPos); }), new Intent("control.halt", new string[10] { "stop", "stop it", "freeze", "hold on", "hold up", "knock it off", "pack it in", "cut it out", "that's enough", "quit it" }, delegate(Ctx c) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) BotSpawner.HaltEverything(c.BotPos, announce: true); }), new Intent("social.howareyou", new string[5] { "how are you", "you alright", "you ok", "you okay", "how's it going" }, delegate(Ctx c) { //IL_002c: 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) string text = BotComposer.StatusReport(); if (text == null || !BotPersona.SpeakLiteral(text, c.BotPos)) { BotPersona.Speak("howami", BotPersona.HowAmI, 1f, 15f, c.BotPos); } }), new Intent("social.blame", new string[4] { "you broke it", "you broke that", "you broke the loot", "you smashed it" }, delegate(Ctx c) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BotPersona.Speak("blame", BotPersona.BlameItem, 1f, 5f, c.BotPos); }), new Intent("social.frustration", new string[5] { "damn it", "dammit", "god damn it", "come on bertram", "seriously bertram" }, delegate(Ctx c) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BotPersona.Speak("frust", BotPersona.Frustrated, 1f, 5f, c.BotPos); }), new Intent("emergency.run", new string[4] { "run", "save yourself", "get out of here", "flee" }, delegate(Ctx c) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BotPersona.Speak("run", BotPersona.EmergencyRun, 1f, 5f, c.BotPos); }), new Intent("emergency.trapped", new string[4] { "i'm trapped", "im trapped", "door is locked", "open this door" }, delegate(Ctx c) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BotPersona.Speak("trapped", BotPersona.Trapped, 1f, 5f, c.BotPos); }), new Intent("emergency.monster", new string[3] { "what is that thing", "monster", "it sees me" }, delegate(Ctx c) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BotPersona.Speak("monster", BotPersona.MonsterPanic, 1f, 5f, c.BotPos); }), new Intent("emergency.taunt", new string[5] { "take the hit", "distract it", "bait it", "yell at it", "taunt it" }, delegate(Ctx c) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BotPersona.Speak("taunt", BotPersona.TauntReply, 1f, 5f, c.BotPos); }), new Intent("emergency.elevator", new string[5] { "close the door", "close the elevator", "press the button", "get in the elevator", "get in" }, delegate(Ctx c) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BotPersona.Speak("elevator", BotPersona.ElevatorPress, 1f, 5f, c.BotPos); }), new Intent("resource.light", new string[4] { "too dark", "turn on your light", "can't see", "cant see" }, delegate(Ctx c) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BotPersona.Speak("light", BotPersona.TooDark, 1f, 5f, c.BotPos); }), new Intent("resource.stamina", new string[4] { "slow down", "out of stamina", "wait for me", "i'm tired" }, delegate(Ctx c) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BotPersona.Speak("stamina", BotPersona.StaminaLow, 1f, 5f, c.BotPos); }), new Intent("resource.pass", new string[3] { "pass me that", "give me that", "hand it over" }, delegate(Ctx c) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BotPersona.Speak("pass", BotPersona.ItemPass, 1f, 5f, c.BotPos); }), new Intent("resource.value", new string[5] { "is this expensive", "is this valuable", "worth keeping", "price check", "appraise" }, delegate(Ctx c) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BotPersona.Speak("value", BotPersona.AppraiseValue, 1f, 5f, c.BotPos); }), new Intent("resource.explosive", new string[3] { "carry the explosive", "hold this bomb", "take the nuke" }, delegate(Ctx c) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BotPersona.Speak("explosive", BotPersona.ExplosiveItem, 1f, 5f, c.BotPos); }), new Intent("tactical.stealth", new string[4] { "crouch walk", "go quiet", "don't make a sound", "tiptoe" }, delegate(Ctx c) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BotPersona.Speak("stealth", BotPersona.StealthMode, 1f, 5f, c.BotPos); }), new Intent("tactical.rear", new string[3] { "watch our six", "watch my back", "cover behind" }, delegate(Ctx c) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BotPersona.Speak("rear", BotPersona.WatchRear, 1f, 5f, c.BotPos); }), new Intent("tactical.peek", new string[3] { "peek the door", "check the corner", "check doorway" }, delegate(Ctx c) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BotPersona.Speak("peek", BotPersona.PeekCorner, 1f, 5f, c.BotPos); }), new Intent("tactical.leave", new string[3] { "should we leave", "call it", "time to go" }, delegate(Ctx c) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BotPersona.Speak("leave", BotPersona.LeaveLevel, 1f, 5f, c.BotPos); }), new Intent("tactical.throw", new string[3] { "throw it", "toss that", "chuck it" }, delegate(Ctx c) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BotPersona.Speak("throw", BotPersona.ThrowItem, 1f, 5f, c.BotPos); }), new Intent("accusation.loud", new string[4] { "you're too loud", "youre too loud", "stop stomping", "shush your feet" }, delegate(Ctx c) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BotPersona.Speak("loud", BotPersona.LoudNoise, 1f, 5f, c.BotPos); }), new Intent("accusation.hoard", new string[3] { "loot goblin", "stop stealing loot", "leave some for us" }, delegate(Ctx c) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BotPersona.Speak("hoard", BotPersona.LootSteal, 1f, 5f, c.BotPos); }), new Intent("accusation.apologize", new string[2] { "say sorry", "apologize" }, delegate(Ctx c) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BotPersona.Speak("apologize", BotPersona.ApologyReply, 1f, 5f, c.BotPos); }), new Intent("hazard.mine", new string[4] { "watch the laser", "watch out for mines", "mine", "trap ahead" }, delegate(Ctx c) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BotPersona.Speak("mine", BotPersona.HazardMine, 1f, 5f, c.BotPos); }), new Intent("hazard.pit", new string[4] { "watch your step", "don't fall", "dont fall", "cliff" }, delegate(Ctx c) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BotPersona.Speak("pit", BotPersona.HazardPit, 1f, 5f, c.BotPos); }), new Intent("hazard.deadend", new string[3] { "dead end", "is this a dead end", "wrong way" }, delegate(Ctx c) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BotPersona.Speak("deadend", BotPersona.DeadEndRoom, 1f, 5f, c.BotPos); }), new Intent("hazard.fog", new string[3] { "it's so foggy", "can't see anything", "creepy in here" }, delegate(Ctx c) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BotPersona.Speak("fog", BotPersona.FoggyWeather, 1f, 5f, c.BotPos); }), new Intent("social.favorite", new string[3] { "who is your favorite", "who's your favorite", "favorite player" }, delegate(Ctx c) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BotPersona.Speak("favorite", BotPersona.Favourite, 1f, 5f, c.BotPos); }), new Intent("social.scared", new string[3] { "are you scared", "you nervous", "you shaking" }, delegate(Ctx c) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BotPersona.Speak("scared", BotPersona.ScaredCheck, 1f, 5f, c.BotPos); }), new Intent("social.highfive", new string[3] { "high five", "fist bump", "slap it" }, delegate(Ctx c) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BotPersona.Speak("highfive", BotPersona.HighFiveAct, 1f, 5f, c.BotPos); }), new Intent("social.sing", new string[3] { "sing something", "hum a tune", "sing a song" }, delegate(Ctx c) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BotPersona.Speak("sing", BotPersona.SingSong, 1f, 5f, c.BotPos); }), new Intent("monster.weakness", new string[3] { "how do we beat it", "weakness", "how to kill it" }, delegate(Ctx c) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BotPersona.Speak("weakness", BotPersona.WeaknessCheck, 1f, 5f, c.BotPos); }), new Intent("monster.dead", new string[3] { "is it dead", "did it die", "is it down" }, delegate(Ctx c) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BotPersona.Speak("monsterdead", BotPersona.IsMonsterDead, 1f, 5f, c.BotPos); }), new Intent("monster.hear", new string[3] { "did you hear that", "footsteps", "hear that" }, delegate(Ctx c) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BotPersona.Speak("hear", BotPersona.FootstepsHear, 1f, 5f, c.BotPos); }), new Intent("truck.time", new string[3] { "how much time left", "time left", "clock ticking" }, delegate(Ctx c) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BotPersona.Speak("time", BotPersona.TimeRemaining, 1f, 5f, c.BotPos); }), new Intent("truck.pack", new string[3] { "pack the truck", "stack it", "organize the truck" }, delegate(Ctx c) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BotPersona.Speak("pack", BotPersona.PackTruck, 1f, 5f, c.BotPos); }), new Intent("truck.quota", new string[3] { "did we make it", "quota done", "enough loot" }, delegate(Ctx c) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BotPersona.Speak("quota", BotPersona.QuotaStatus, 1f, 5f, c.BotPos); }), new Intent("truck.cheer", new string[4] { "we made it", "we survived", "gg", "ez" }, delegate(Ctx c) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BotPersona.Speak("cheer", BotPersona.CheerExtracted, 1f, 5f, c.BotPos); }), new Intent("fun.spin", new string[3] { "do a 360", "do a trick", "spin around" }, delegate(Ctx c) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BotPersona.Speak("spin", BotPersona.SpinTrick, 1f, 5f, c.BotPos); }), new Intent("fun.math", new string[3] { "what's 2 plus 2", "whats 2 plus 2", "are you smart" }, delegate(Ctx c) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BotPersona.Speak("math", BotPersona.MathJoke, 1f, 5f, c.BotPos); }), new Intent("fun.joke", new string[2] { "tell a joke", "say something funny" }, delegate(Ctx c) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BotPersona.Speak("joke", BotPersona.TellJoke, 1f, 5f, c.BotPos); }), new Intent("fun.useless", new string[4] { "you suck", "you're useless", "youre useless", "bad bot" }, delegate(Ctx c) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BotPersona.Speak("useless", BotPersona.UselessBot, 1f, 5f, c.BotPos); }), new Intent("fun.sleep", new string[3] { "go to sleep", "take a nap", "sleep" }, delegate(Ctx c) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BotPersona.Speak("sleep", BotPersona.SleepMode, 1f, 5f, c.BotPos); }), new Intent("loot.guard", new string[3] { "guard the loot", "watch the pile", "protect the loot" }, delegate(Ctx c) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BotPersona.Speak("guard", BotPersona.GuardLoot, 1f, 5f, c.BotPos); }), new Intent("loot.fragile", new string[3] { "is it fragile", "will it break", "careful with that" }, delegate(Ctx c) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BotPersona.Speak("fragile", BotPersona.FragileItem, 1f, 5f, c.BotPos); }), new Intent("social.greet", new string[11] { "hey", "hi", "hello", "yo", "sup", "howdy", "morning", "evening", "you there", "you awake", "greetings" }, delegate(Ctx c) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) string aboutName = (((Object)(object)c.Speaker != (Object)null) ? SemiFunc.PlayerGetName(c.Speaker) : null); BotPersona.Speak("greet", BotPersona.Greeting, 1f, 25f, c.BotPos, aboutName); }) }; private static readonly List<PendingChat> _pendingChat = new List<PendingChat>(); public static bool Run(string intentName, PlayerAvatar speaker) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) try { GameObject botObject = BotSpawner.BotObject; if ((Object)(object)botObject == (Object)null) { return false; } foreach (Intent item in Table) { if (!(item.Name != intentName)) { BotSocial.ExpectRealAnswer(); Interrupt(item.Name, botObject.transform.position); BotIdle.CommandHeard(item.Name); item.Run(new Ctx { Speaker = speaker, BotPos = botObject.transform.position, Text = intentName }); Plugin.Log.LogInfo((object)("[Cmd] " + intentName + " (from the buddy panel).")); return true; } } Plugin.Log.LogWarning((object)("[Cmd] No such intent: " + intentName)); } catch (Exception ex) { Plugin.Log.LogWarning((object)("[Cmd] Run: " + ex.Message)); } return false; } private static void Interrupt(string intentName, Vector3 botPos) { try { if ((intentName == null || !intentName.StartsWith("fun.")) && BotDance.Dancing) { BotDance.Stop(announce: false); } } catch { } } public static bool Handle(string text, PlayerAvatar speaker, bool addressed = false) { //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) try { if (string.IsNullOrEmpty(text)) { return false; } if (!BotSpawner.HasBot) { return false; } if ((Object)(object)speaker != (Object)null && BotSpawner.IsBot(speaker)) { return false; } string text2 = text.ToLowerInvariant(); if (!addressed && !NameMatcher.Mentions(text2, BotSpawner.ChosenName)) { return BotReflex.Handle(text2, speaker, BotSpawner.BotPosition); } BotSocial.ExpectRealAnswer(); if ((Object)(object)speaker != (Object)null && Plugin.CfgBuddyOnlyCommands != null && Plugin.CfgBuddyOnlyCommands.Value) { PlayerAvatar current = BotBuddy.Current; if ((Object)(object)current != (Object)null && current != speaker) { Plugin.Log.LogInfo((object)("[Cmd] Ignoring " + SemiFunc.PlayerGetName(speaker) + " — he's attached to " + SemiFunc.PlayerGetName(current) + ".")); BotPersona.Speak("notmyboss", BotPersona.NotMyBoss, 1f, 15f, BotSpawner.BotPosition, SemiFunc.PlayerGetName(current)); return true; } } Ctx ctx = new Ctx { Speaker = speaker, BotPos = BotSpawner.BotPosition, Text = text2 }; if (BotGrudge.IsSulkingAt(speaker)) { Plugin.Log.LogInfo((object)("[Cmd] Sulking — ignoring " + SemiFunc.PlayerGetName(speaker) + ".")); BotPersona.Speak("snubbed", BotPersona.Snubbed, 1f, 6f, ctx.BotPos); return true; } if (BotGrudge.JudgeMessage(text2, speaker, ctx.BotPos)) { return true; } if (DangerNearby(ctx.BotPos)) { BotPersona.Speak("shush", BotPersona.Shush, 1f, 8f, ctx.BotPos, ((Object)(object)speaker != (Object)null) ? SemiFunc.PlayerGetName(speaker) : null); } for (int i = 0; i < Table.Count; i++) { Intent intent = Table[i]; for (int j = 0; j < intent.Phrases.Length; j++) { if (Matches(text2, intent.Phrases[j])) { Plugin.Log.LogInfo((object)("[Cmd] " + intent.Name + " <- \"" + text + "\"")); BotIdle.CommandHeard(intent.Name); intent.Run(ctx); return true; } } } Plugin.Log.LogInfo((object)("[Cmd] (unmatched) <- \"" + text + "\"")); if (BotMovement.InLobby()) { string aboutName = (((Object)(object)speaker != (Object)null) ? SemiFunc.PlayerGetName(speaker) : null); BotPersona.Speak("insult", BotPersona.Insult, 0.4f, 20f, ctx.BotPos, aboutName); } else { BotPersona.Speak("confused", BotPersona.Confused, 0.35f, 25f, ctx.BotPos); } return true; } catch (Exception ex) { Plugin.Log.LogWarning((object)("[Cmd] " + ex.Message)); return false; } } private static PlayerAvatar NearestHurtOther(Vector3 botPos, PlayerAvatar except) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) PlayerAvatar result = null; float num = 1f; try { if ((Object)(object)GameDirector.instance == (Object)null) { return null; } foreach (PlayerAvatar player in GameDirector.instance.PlayerList) { if ((Object)(object)player == (Object)null || BotSpawner.IsBot(player) || player == except || Reflect.Get<bool>(player, "isDisabled") || Vector3.Distance(botPos, ((Component)player).transform.position) > 15f) { continue; } PlayerHealth playerHealth = player.playerHealth; if ((Object)(object)playerHealth == (Object)null) { continue; } int num2 = Reflect.Get<int>(playerHealth, "maxHealth"); if (num2 > 0) { float num3 = (float)Reflect.Get<int>(playerHealth, "health") / (float)num2; if (num3 < num) { num = num3; result = player; } } } } catch { } return result; } private static bool DangerNearby(Vector3 botPos) { //IL_0057: 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) try { if (BotDanger.Level != BotDanger.Threat.Clear) { return true; } if ((Object)(object)EnemyDirector.instance == (Object)null) { return false; } foreach (EnemyParent item in EnemyDirector.instance.enemiesSpawned) { if (!((Object)(object)item == (Object)null)) { Enemy val = Reflect.Get<Enemy>(item, "Enemy"); if (!((Object)(object)val == (Object)null) && Vector3.Distance(botPos, ((Component)val).transform.position) <= 16f) { return true; } } } } catch { } return false; } private static bool Matches(string text, string phrase) { if (string.IsNullOrEmpty(phrase)) { return false; } if (phrase.IndexOf(' ') >= 0) { return text.IndexOf(phrase, StringComparison.Ordinal) >= 0; } int startIndex = 0; while (true) { int num = text.IndexOf(phrase, startIndex, StringComparison.Ordinal); if (num < 0) { return false; } bool num2 = num == 0 || !IsWordChar(text[num - 1]); int num3 = num + phrase.Length; bool flag = num3 >= text.Length || !IsWordChar(text[num3]); if (num2 && flag) { break; } startIndex = num + 1; } return true; } private static bool IsWordChar(char c) { if (!char.IsLetterOrDigit(c)) { return c == '\''; } return true; } public static bool LooksLikeCommand(string lowerText) { if (string.IsNullOrEmpty(lowerText)) { return false; } for (int i = 0; i < Table.Count; i++) { for (int j = 0; j < Table[i].Phrases.Length; j++) { if (Matches(lowerText, Table[i].Phrases[j])) { return true; } } } return false; } public static IEnumerable<string> AllPhrases() { yield return "bertram"; foreach (Intent item in Table) { string[] phrases = item.Phrases; for (int i = 0; i < phrases.Length; i++) { yield return phrases[i]; } } } [HarmonyPatch(typeof(PlayerAvatar), "ChatMessageSendRPC")] [HarmonyPostfix] public static void OnChatMessage(PlayerAvatar __instance, string _message) { try { if (!PhotonNetwork.IsMasterClient || string.IsNullOrEmpty(_message) || ((Object)(object)__instance != (Object)null && BotSpawner.IsBot(__instance))) { return; } int num = 1; for (int i = 0; i < _message.Length; i++) { if (_message[i] == ' ') { num++; } } float num2 = Mathf.Clamp((float)num * 0.32f + 0.35f, 0.35f, 7f); _pendingChat.Add(new PendingChat { Text = _message, Who = __instance, At = Time.unscaledTime + num2 }); } catch { } } public static void TickPendingChat() { try { if (_pendingChat.Count == 0) { return; } float unscaledTime = Time.unscaledTime; for (int num = _pendingChat.Count - 1; num >= 0; num--) { if (!(unscaledTime < _pendingChat[num].At)) { PendingChat pendingChat = _pendingChat[num]; _pendingChat.RemoveAt(num); Handle(pendingChat.Text, pendingChat.Who); } } } catch { } } } public static class BotComposer { private sealed class Core { public readonly string Text; public readonly string[] Needs; public Core(string text, params string[] needs) { Text = text; Needs = needs; } } private static readonly string[] Openers = new string[13] { "", "", "", "", "Right, ", "So. ", "Okay. ", "Look, ", "For what it's worth, ", "Not to be a bore, but ", "Genuine question: ", "Hm. ", "Anyway. " }; private static readonly string[] Hedges = new string[10] { "", "", "", "", "", "", "I think ", "probably ", "if I'm reading this right, ", "roughly " }; private static readonly string[] Riders = new string[13] { "", "", "", "", "", "", " Just so we're all aware.", " Not that anyone asked.", " Carry on.", " That's my contribution.", " Do with that what you will.", " I'll be over here.", " Anyway." }; private static readonly Core[] Ambient = new Core[18] { new Core("we're {short} short of quota.", "short"), new Core("{haul} banked, {goal} wanted. You do the maths.", "haul", "goal"), new Core("that's {haul} so far. Underwhelming.", "haul"), new Core("we've been down here {mins} minutes.", "mins"), new Core("{mins} minutes and {haul}. Not a great rate.", "mins", "haul"), new Core("{done} of {total} extractions done.", "done", "total"), new Core("{name} is the only one of you doing anything.", "name"), new Core("I'm on {hp} health, since nobody asked.", "hp"), new Core("{name} has broken {n} things tonight.", "name", "n"), new Core("that's {broke} broken between you. A record?", "broke"), new Core("I'm still following {buddy}. Lucky them.", "buddy"), new Core("{buddy} has wandered off again.", "buddy"), new Core("last thing I saw was a {enemy}. Sleep well.", "enemy"), new Core("no sign of that {enemy} for a bit.", "enemy"), new Core("{down} of you are down. That's not ideal.", "down"), new Core("this {item} is worth {value} and I'm the one carrying it.", "item", "value"), new Core("carrying {value} of {item}. No pressure.", "value", "item"), new Core("{name} is {dist} metres away and hasn't helped once.", "name", "dist") }; private static readonly Core[] Breakage = new Core[6] { new Core("{name} just destroyed a {item}. {value} gone.", "name", "item", "value"), new Core("that {item} was worth {value}. Was.", "item", "value"), new Core("{name}, that's {n} now.", "name", "n"), new Core("{value} lighter, thanks to {name}.", "value", "name"), new Core("we're {short} short and {name} is smashing the furniture.", "short", "name"), new Core("that's {broke} things broken tonight.", "broke") }; private static readonly Core[] Status = new Core[6] { new Core("{hp} health, {haul} banked, {short} to go.", "hp", "haul", "short"), new Core("{hp} out of {hpmax}. I've had better runs.", "hp", "hpmax"), new Core("alive, which is more than {down} of you can say.", "down"), new Core("I've died {deaths} times and I'm still here. Think about that.", "deaths"), new Core("following {buddy}, carrying nothing, quietly judging.", "buddy"), new Core("holding {value} of {item} and wishing I wasn't.", "value", "item") }; private static readonly Dictionary<string, string> Slots = new Dictionary<string, string>(); private static readonly List<Core> Usable = new List<Core>(); private static readonly Queue<string> Recent = new Queue<string>(); private static string _pending; private static float _pendingAt; private static readonly string[] SecondThoughts = new string[7] { "Actually, ignore me.", "...although I could be wrong.", "Don't quote me on that.", "Actually no, that's worse than I said.", "Forget it.", "Sorry, thinking out loud.", "That came out ruder than intended. Slightly." }; public static string Ambient1() { return Compose(Ambient); } public static string OnBreakage() { return Compose(Breakage); } public static string StatusReport() { return Compose(Status); } private static string Compose(Core[] pool) { try { BuildSlots(); Usable.Clear(); foreach (Core core in pool) { bool flag = true; string[] needs = core.Needs; foreach (string key in needs) { if (!Slots.ContainsKey(key)) { flag = false; break; } } if (flag && !Recent.Contains(core.Text)) { Usable.Add(core); } } if (Usable.Count == 0) { return null; } Core core2 = Usable[Random.Range(0, Usable.Count)]; Recent.Enqueue(core2.Text); while (Recent.Count > 8) { Recent.Dequeue(); } StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(Openers[Random.Range(0, Openers.Length)]); string text = core2.Text; foreach (KeyValuePair<string, string> slot in Slots) { text = text.Replace("{" + slot.Key + "}", slot.Value); } string text2 = Hedges[Random.Range(0, Hedges.Length)]; if (text2.Length > 0 && text.Length > 0) { text = text2 + text; } if (stringBuilder.Length == 0 && text.Length > 0) { text = char.ToUpperInvariant(text[0]) + text.Substring(1); } stringBuilder.Append(text); stringBuilder.Append(Riders[Random.Range(0, Riders.Length)]); return stringBuilder.ToString(); } catch { return null; } } private static void BuildSlots() { Slots.Clear(); if (BotFacts.HaveMoneyFacts) { Slots["haul"] = BotFacts.Money(BotFacts.Haul); Slots["goal"] = BotFacts.Money(BotFacts.Goal); if (BotFacts.Shortfall > 0) { Slots["short"] = BotFacts.Money(BotFacts.Shortfall); } } if (BotFacts.ExtractionsTotal > 0) { Slots["done"] = BotFacts.ExtractionsDone.ToString(); Slots["total"] = BotFacts.ExtractionsTotal.ToString(); } if (BotFacts.HpMax > 0) { Slots["hp"] = BotFacts.Hp.ToString(); Slots["hpmax"] = BotFacts.HpMax.ToString(); } if (BotFacts.Deaths > 0) { Slots["deaths"] = BotFacts.Deaths.ToString(); } if (BotFacts.MinutesHere >= 1f) { Slots["mins"] = Mathf.FloorToInt(BotFacts.MinutesHere).ToString(); } if (!string.IsNullOrEmpty(BotFacts.BuddyName)) { Slots["buddy"] = BotFacts.BuddyName; } if (!string.IsNullOrEmpty(BotFacts.NearestName)) { Slots["name"] = BotFacts.NearestName; Slots["dist"] = Mathf.RoundToInt(BotFacts.NearestDist).ToString(); int num = BotFacts.BreakagesBy(BotFacts.NearestName); if (num > 0) { Slots["n"] = num.ToString(); } } if (BotFacts.PlayersDown > 0) { Slots["down"] = BotFacts.PlayersDown.ToString(); } if (BotFacts.TotalBreakages > 0) { Slots["broke"] = BotFacts.TotalBreakages.ToString(); } if (!string.IsNullOrEmpty(BotFacts.CarryingName) && BotFacts.CarryingValue > 0) { Slots["item"] = BotFacts.CarryingName; Slots["value"] = BotFacts.Money(BotFacts.CarryingValue); } if (!string.IsNullOrEmpty(BotFacts.LastEnemy) && BotFacts.SinceEnemy < 120f) { Slots["enemy"] = BotFacts