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 PetCompanion v1.3.5
plugins/PetCompanion.dll
Decompiled 2 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.IO.Compression; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using BepInEx; 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 TMPro; using UnityEngine; using UnityEngine.AI; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.Localization; using UnityEngine.Networking; using UnityEngine.Rendering; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace PetCompanion { internal sealed class ActCarry : PetAct { internal static ActCarry Current; internal PhysGrabObject Obj; private PetCarry.Kind _kind; private Vector3 _fetch; private Vector3 _stand; private Vector3 _drop; private int _phase; private float _phaseT; private float _total; private Vector3 _liftFrom; private Vector3 _dropFrom; private bool _done; private bool _told; private float _waitT; private float _best = float.MaxValue; private float _sampleT; private float _stall; private int _strikes; private float _lagT; private string _fail; private bool _quiet; private bool _offerSaid; private bool _nudged; private float _offerT; private float _standT; private float _checkT; private float _routeLen; private float _noRoute; private Vector3 _fetchFor; private bool _abort; internal static bool Rejected; internal PetFollower Pet => F; internal string Status { get { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_0044: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) string text = PetCarry.NameOf(Obj); float num = (((Object)F != (Object)null && (Object)Obj != (Object)null) ? Vector3.Distance(Flat(((Component)F).transform.position), Flat((_phase == 0) ? _fetch : _stand)) : 0f); if (_routeLen > 0.5f && (_phase == 0 || _phase == 2)) { num = _routeLen; } switch (_phase) { case 0: if (!(_waitT > 0f)) { return "walking to " + text + ", " + Mathf.RoundToInt(num) + " m away" + ((_stall >= 2f) ? ", having trouble getting through" : ""); } return "waiting for the owner to let go of " + text; case 1: return "lifting " + text; case 2: return "carrying " + text + " overhead to the " + _kind.ToString().ToLowerInvariant() + ", " + Mathf.RoundToInt(num) + " m left" + ((_stall >= 2f) ? ", having trouble getting through" : ""); case 4: return "holding " + text + " up for the owner to take it, " + Mathf.RoundToInt(_offerT) + " s so far"; default: return "putting down " + text; } } } internal static string StateText { get { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown if (Current == null || !((Object)Current.F != (Object)null)) { return "not carrying anything"; } return Current.Status; } } private Vector3 Head => ((Component)F).transform.position + Vector3.up * F.CarryHeight; private bool Lost { get { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown if (!((Object)Obj == (Object)null)) { return (Object)Obj.rb == (Object)null; } return true; } } private bool Taken { get { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown if (_phase >= 1 && (Object)Obj != (Object)null) { if (Obj.playerGrabbing.Count <= 0) { return Obj.grabbed; } return true; } return false; } } internal ActCarry(PetCarry.Cand c, PetCarry.Kind k, Vector3 stand, Vector3 drop) { //IL_001f: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) Obj = c.Obj; _fetch = c.Stand; _routeLen = c.Route; _fetchFor = ((Component)c.Obj).transform.position; _kind = k; _stand = stand; _drop = drop; } private new static Vector3 Flat(Vector3 v) { //IL_0000: 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_0011: Unknown result type (might be due to invalid IL or missing references) return new Vector3(v.x, 0f, v.z); } protected override void OnBegin() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) Current = this; PetFollower.CarryIgnore = (((Object)Obj != (Object)null) ? ((Component)Obj).transform : null); if (_kind == PetCarry.Kind.Player) { Transform val = F.OwnerTransform(); if ((Object)val != (Object)null) { _stand = PetCarry.PlayerStand(val); } } if (!FixStand(lookAround: true)) { Plugin.Log.LogInfo((object)("Pet carry: no walkable route to the drop-off " + ((Vector3)(ref _stand)).ToString("0.0") + ", not starting")); _abort = true; _fail = "carry_stuck"; Rejected = true; } else { F.Brain.OnCarryStart(PetCarry.NameOf(Obj)); } } private bool FixStand(bool lookAround) { //IL_0001: 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) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: 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_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Expected O, but got Unknown //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: 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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_007e: 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_0086: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) NavMeshHit val = default(NavMeshHit); if (NavMesh.SamplePosition(_stand, ref val, 3f, -1)) { _stand = ((NavMeshHit)(ref val)).position; } Vector3 position = ((Component)F).transform.position; if (PetNav.Route(position, _stand, out var len, out var complete) && complete) { if (!lookAround || _kind == PetCarry.Kind.Player || PetNav.Open(_stand, _drop, 0.5f, 0.2f, 0.6f)) { _routeLen = len; return true; } if (PetNav.FindStand(position, _drop, _stand, out var stand, out var len2)) { _stand = stand; _routeLen = len2; return true; } _routeLen = len; return true; } Vector3 target = _drop; if (_kind == PetCarry.Kind.Player) { Transform val2 = F.OwnerTransform(); if ((Object)val2 == (Object)null) { return false; } target = val2.position; } if (PetNav.FindStand(position, target, _stand, out var stand2, out var len3)) { _stand = stand2; _routeLen = len3; return true; } return false; } protected override bool OnStep(float dt) { if (_abort) { return false; } _phaseT += dt; _total += dt; if (!PetCarry.Allowed) { if (F.Carrying) { F.Brain.OnCarryAbort(); } return false; } if (!Lost && _kind == PetCarry.Kind.Player && _phase >= 2 && Taken) { return Give(); } if (Lost || Taken || F.Vit.Down || F.Held || _total > 150f) { if (F.Carrying) { F.Brain.OnCarryAbort(); } return false; } int num = _phase switch { 0 => Fetch(dt) ? 1 : 0, 1 => Lift() ? 1 : 0, 2 => Haul(dt) ? 1 : 0, 4 => Offer(dt) ? 1 : 0, _ => Put() ? 1 : 0, }; if (num == 0 && _fail != null) { F.Brain.OnCarryFail(_fail); } return (byte)num != 0; } private bool Progress(float distance) { _sampleT += Time.deltaTime; if (_sampleT < 1f) { return true; } _sampleT = 0f; if (distance < _best - 0.3f) { _best = distance; _stall = 0f; return true; } _stall += 1f; if (_stall >= 3f) { _stall = 0f; _strikes++; Plugin.Log.LogInfo((object)("Pet carry: no progress (" + _strikes + "/3) in phase " + _phase + ", " + distance.ToString("0.0") + " m of route to go")); F.Unstick(); if (_strikes >= 3) { _fail = "carry_stuck"; return false; } } return true; } private void NextPhase(int p) { _phase = p; _phaseT = 0f; _best = float.MaxValue; _stall = 0f; _sampleT = 0f; _strikes = 0; _checkT = 2f; } private bool Fetch(float dt) { //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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Expected O, but got Unknown //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: 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_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0128: 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_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_016d: 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_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)Obj).transform.position; if (Obj.grabbed || Obj.playerGrabbing.Count > 0) { if (!_told) { _told = true; F.Brain.Say("carryheld", "carry_held", 3, 10f); } _waitT += dt; Dest = null; Speed = 0f; Transform val = F.OwnerTransform(); FaceAt = (((Object)val != (Object)null) ? val.position : position); if (_waitT > 20f) { return false; } return true; } _waitT = 0f; _checkT += dt; if (_checkT > 0.5f) { _checkT = 0f; Vector3 position2 = ((Component)F).transform.position; bool flag = Vector3.Distance(position, _fetchFor) > 1.2f; float len; bool complete; bool flag2 = PetNav.Route(position2, _fetch, out len, out complete) && complete; if (!flag2 || flag) { if (PetNav.FindStand(position2, position, (flag2 && !flag) ? _fetch : position, out var stand, out var len2)) { _fetch = stand; _fetchFor = position; len = len2; flag2 = true; } else { flag2 = false; } } if (flag2) { _noRoute = 0f; _routeLen = len; } else { _noRoute += 0.5f; if (_noRoute >= 2f) { _fail = "carry_stuck"; Plugin.Log.LogInfo((object)"Pet carry: lost the way to the item, giving up"); return false; } } } Dest = _fetch; FaceAt = position; Speed = 3.4f; float num = Vector3.Distance(Flat(((Component)F).transform.position), Flat(position)); float num2 = Vector3.Distance(Flat(((Component)F).transform.position), Flat(_fetch)); if ((num < 1.05f && PetNav.Open(((Component)F).transform.position, position, 0.5f, 0.2f, 0.4f)) || num2 < 0.6f) { NextPhase(1); _liftFrom = position; Dest = null; Speed = 0f; F.Carrying = true; return true; } return Progress((_routeLen > 0.5f) ? _routeLen : Mathf.Min(num, num2 + 0.5f)); } private bool Lift() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Clamp01(_phaseT / 0.8f); Dest = null; Speed = 0f; CarryNet.Send(F, Obj, Vector3.Lerp(_liftFrom, Head, Mathf.SmoothStep(0f, 1f, num)), 1); if (num >= 1f) { NextPhase(2); } return true; } private bool Haul(float dt) { //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_011d: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_018a: 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_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) _checkT += dt; if (_checkT > 1f) { _checkT = 0f; if (!FixStand(lookAround: false)) { _fail = "carry_stuck"; Plugin.Log.LogInfo((object)"Pet carry: no way to the drop-off, giving up"); return false; } } if (_kind == PetCarry.Kind.Player) { Transform val = F.OwnerTransform(); if ((Object)val == (Object)null) { return false; } _standT += dt; if (_standT > 0.5f) { _standT = 0f; Vector3 val2 = PetCarry.PlayerStand(val); if (Vector3.Distance(val2, _stand) > 1.5f) { _best = float.MaxValue; _checkT = 2f; } _stand = val2; } } Dest = _stand; FaceAt = _stand; Speed = 2.6f; bool flag = Vector3.Distance(((Component)Obj).transform.position, Head) > 2.2f || !PetNav.Open(Head, ((Component)Obj).transform.position, 0f, 0f, 0.3f); _lagT = (flag ? (_lagT + dt) : 0f); if (_lagT > 1.5f) { _lagT = 0f; CarryNet.Send(F, Obj, Head, 2); } else { CarryNet.Send(F, Obj, Head, 1); } float num = Vector3.Distance(Flat(((Component)F).transform.position), Flat(_stand)); if (num < 0.8f) { NextPhase((_kind == PetCarry.Kind.Player) ? 4 : 3); _dropFrom = Head; Dest = null; Speed = 0f; return true; } return Progress((_routeLen > 0.5f) ? _routeLen : num); } private bool Put() { //IL_003b: 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_004a: 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_0033: 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) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) Dest = null; Speed = 0f; float num = Mathf.Clamp01(_phaseT / 0.9f); Vector3 val = ((_kind == PetCarry.Kind.Idle) ? (_drop + Vector3.up * 0.35f) : _drop); CarryNet.Send(F, Obj, Vector3.Lerp(_dropFrom, val, Mathf.SmoothStep(0f, 1f, num)), 1); if (num < 1f) { return true; } Release(); if (!_quiet) { F.Brain.OnCarryDone(_kind, PetCarry.NameOf(Obj)); } _done = true; return false; } private bool Offer(float dt) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_0029: 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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) Transform val = F.OwnerTransform(); if ((Object)val == (Object)null) { return false; } CarryNet.Send(F, Obj, Head, 1); FaceAt = val.position; if (Vector3.Distance(Flat(((Component)F).transform.position), Flat(val.position)) > 4.5f) { _stand = PetCarry.PlayerStand(val); Dest = _stand; Speed = 3.2f; return true; } Dest = null; Speed = 0f; if (!_offerSaid) { _offerSaid = true; F.Brain.OnCarryOffer(); } _offerT += dt; if (!_nudged && _offerT > 5f) { _nudged = true; F.Brain.OnCarryWait(); } if (!(_offerT > 10f)) { return true; } return Decide(); } private bool Decide() { //IL_0011: 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_004b: Expected O, but got Unknown //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: 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_00a7: 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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) float value = Random.value; Vector3 stand; Vector3 drop; PetCarry.Kind kind = PetCarry.Pick(((Component)Obj).transform.position, out stand, out drop); if (value < 0.2f && TuneConfig.CarrySmash.Value && (Object)F.Owner != (Object)null && !F.Owner.deadSet) { return Smash(); } if (value < 0.4f) { return Throw(); } if (value < 0.7f && kind != PetCarry.Kind.None) { PetCarry.Kind kind2 = _kind; Vector3 stand2 = _stand; Vector3 drop2 = _drop; _kind = kind; _stand = stand; _drop = drop; if (!FixStand(lookAround: true)) { _kind = kind2; _stand = stand2; _drop = drop2; kind = PetCarry.Kind.None; } } if (value < 0.7f && kind != PetCarry.Kind.None) { F.Brain.OnCarryOutcome("carry_self", Mood.Angry); NextPhase(2); return true; } _quiet = true; _drop = ((Component)F).transform.position + ((Component)F).transform.forward * 0.5f + Vector3.up * 0.3f; _dropFrom = Head; F.Brain.OnCarryOutcome("carry_ground", Mood.Sad); NextPhase(3); Dest = null; Speed = 0f; return true; } private bool Throw() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_002c: 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_003c: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) Transform val = F.OwnerTransform(); Vector3 val2 = (((Object)val != (Object)null) ? Flat(((Component)F).transform.position - val.position) : Vector3.zero); val2 = ((((Vector3)(ref val2)).sqrMagnitude > 0.01f) ? ((Vector3)(ref val2)).normalized : ((Component)F).transform.forward); F.Carrying = false; CarryNet.Send(F, Obj, val2 * 5.5f + Vector3.up * 3f, 3); F.Brain.OnCarryOutcome("carry_throw", Mood.Angry); _done = true; return false; } private bool Smash() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_002c: 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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_004c: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: 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_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) Transform val = F.OwnerTransform(); if ((Object)val == (Object)null) { return Throw(); } Vector3 position = ((Component)Obj).transform.position; Vector3 val2 = val.position + Vector3.up * 1f - position; float num = Mathf.Clamp(((Vector3)(ref val2)).magnitude / 12f, 0.25f, 0.9f); Vector3 val3 = val2 / num - Physics.gravity * (0.5f * num); val3 = Vector3.ClampMagnitude(val3, 16f); F.Carrying = false; CarryNet.Send(F, Obj, val3, 3); F.Brain.OnCarryOutcome("carry_smash", Mood.Angry); _done = true; return false; } private bool Give() { Release(); F.Brain.OnCarryOutcome("carry_given", Mood.Proud); _done = true; return false; } private void Release() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_0043: Unknown result type (might be due to invalid IL or missing references) if (F.Carrying) { F.Carrying = false; if ((Object)Obj != (Object)null) { CarryNet.Send(F, Obj, ((Component)Obj).transform.position, 0); } } } internal override void End() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_004e: Expected O, but got Unknown if (!_done) { Release(); } if (Current == this) { Current = null; } if ((Object)Obj != (Object)null && (Object)PetFollower.CarryIgnore == (Object)((Component)Obj).transform) { PetFollower.CarryIgnore = null; } } } internal sealed class ActCart : PetAct { private PhysGrabCart _cart; private int _phase; private float _phaseT; private float _sitFor; private Vector3 _from; private Vector3 _localSeat; private Vector3 _exit; private bool _spoke; private bool _again; private float _lift; private static readonly RaycastHit[] Hits = (RaycastHit[])(object)new RaycastHit[16]; private Vector3 Seat => _cart.inCart.TransformPoint(_localSeat) + _cart.inCart.up * _lift; internal ActCart(PhysGrabCart cart) { _cart = cart; } protected override void OnBegin() { _sitFor = Random.Range(9f, 16f); } private void Lift(float dt) { //IL_000d: 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_0015: 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_001f: 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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: 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_00ac: 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_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: 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_010f: Expected O, but got Unknown //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Expected O, but got Unknown //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Expected O, but got Unknown //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) Transform inCart = _cart.inCart; Vector3 up = inCart.up; Vector3 val = inCart.TransformPoint(_localSeat); float num = Mathf.Max(0.3f, inCart.lossyScale.y); float num2 = 0f; for (int i = 0; i < 5; i++) { Vector3 val3; Vector3 val2; switch (i) { case 0: val3 = Vector3.zero; break; case 3: val2 = inCart.forward; goto IL_0099; case 2: val2 = -inCart.right; goto IL_0099; case 1: val2 = inCart.right; goto IL_0099; default: { val2 = -inCart.forward; goto IL_0099; } IL_0099: val3 = val2 * 0.15f; break; } Vector3 val4 = val3; int num3 = Physics.RaycastNonAlloc(val + val4 + up * (num * 0.9f), -up, Hits, num * 0.9f + 0.3f, PetPhysics.RayMask, (QueryTriggerInteraction)1); for (int j = 0; j < num3; j++) { Collider collider = ((RaycastHit)(ref Hits[j])).collider; if (!((Object)collider == (Object)null) && !((Object)((Component)collider).GetComponentInParent<PetFollower>() != (Object)null) && !((Object)((Component)collider).GetComponentInParent<PlayerAvatar>() != (Object)null)) { num2 = Mathf.Max(num2, Vector3.Dot(((RaycastHit)(ref Hits[j])).point - val, up)); } } } num2 = Mathf.Clamp(num2, 0f, num * 0.7f); _lift = Mathf.MoveTowards(_lift, num2, ((num2 > _lift) ? 3f : 1.5f) * dt); } protected override bool OnStep(float dt) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown if ((Object)_cart == (Object)null || (Object)_cart.inCart == (Object)null) { F.AfterRide(); return false; } if (F.Vit.Down) { return false; } _phaseT += dt; if (_phase == 1 || _phase == 2) { Lift(dt); } return _phase switch { 0 => Approach(), 1 => Hop(dt), 2 => Riding(), _ => Leave(), }; } private bool Approach() { //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_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_001d: 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_001f: 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) //IL_002a: 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_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008e: 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_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: 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_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)F).transform.position; Vector3 val = Carts.Seat(_cart); Vector3 val2 = PetAct.Flat(position - val); Vector3 val3 = val + ((((Vector3)(ref val2)).sqrMagnitude > 0.01f) ? ((Vector3)(ref val2)).normalized : Vector3.forward) * (Mathf.Max(_cart.inCart.localScale.x, _cart.inCart.localScale.z) * 0.5f + 0.7f); Dest = val3; FaceAt = val; Speed = 3.2f; if (_cart.cartBeingPulled || _phaseT > 14f) { return false; } if (Vector3.Distance(PetAct.Flat(position), PetAct.Flat(val3)) < 0.5f) { _phase = 1; _phaseT = 0f; _from = position; _localSeat = _cart.inCart.InverseTransformPoint(val); Dest = null; Speed = 0f; F.Jump(0.4f); } return true; } private bool Hop(float dt) { //IL_0013: 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_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Clamp01(_phaseT / 0.7f); Vector3 seat = Seat; Vector3 value = Vector3.Lerp(_from, seat, Mathf.SmoothStep(0f, 1f, num)); value.y += Mathf.Sin(num * MathF.PI) * (Carts.Rim(_cart) - Mathf.Min(_from.y, seat.y) + 0.5f); Place = value; FaceAt = seat; if (num >= 1f) { _phase = 2; _phaseT = 0f; F.Feel(Mood.Happy, 3f); } return true; } private bool Riding() { //IL_0002: 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_0031: Expected O, but got Unknown //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0044: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Expected O, but got Unknown //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: 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_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) Place = Seat; Sit = true; Transform val = F.OwnerTransform(); FaceAt = (((Object)val != (Object)null) ? val.position : (Seat + ((Component)_cart).transform.forward)); if ((Object)val != (Object)null && _phaseT > 1f && Vector3.Distance(Seat, val.position) > 14f) { F.AfterRide(); return false; } if (!_spoke && _phaseT > 1.2f) { _spoke = true; Report(); } if (_spoke && !_again && _phaseT > _sitFor * 0.6f && Random.value < 0.01f) { _again = true; Report(); } if (_phaseT > _sitFor || F.Alerting || (_cart.cartBeingPulled && _phaseT > 5f)) { _phase = 3; _phaseT = 0f; _from = Seat; Transform val2 = F.OwnerTransform(); Vector3 val3 = (((Object)val2 != (Object)null) ? PetAct.Flat(val2.position - ((Component)_cart).transform.position) : ((Component)_cart).transform.right); val3 = ((((Vector3)(ref val3)).sqrMagnitude > 0.01f) ? ((Vector3)(ref val3)).normalized : ((Component)_cart).transform.right); _exit = Carts.Seat(_cart) + val3 * (Mathf.Max(_cart.inCart.localScale.x, _cart.inCart.localScale.z) * 0.5f + 0.9f); _exit.y = Mathf.Min(_exit.y, Carts.Seat(_cart).y); F.Brain.OnCartLeave(); } return true; } private bool Leave() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Clamp01(_phaseT / 0.6f); Vector3 value = Vector3.Lerp(_from, _exit, Mathf.SmoothStep(0f, 1f, num)); value.y += Mathf.Sin(num * MathF.PI) * 0.9f; if (num >= 1f) { Place = null; F.AfterRide(); return false; } Place = value; return true; } private void Report() { F.Brain.OnCartRide(Carts.Money(_cart), Carts.Count(_cart)); } internal override void End() { Place = null; Sit = false; } } internal sealed class ActChat : PetAct { private readonly PetTalk _t; internal ActChat(PetTalk t) { _t = t; } protected override bool OnStep(float dt) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: 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) if (!_t.Chatting || (Object)_t.Partner == (Object)null || F.Vit.Down || F.Held || F.Alerting || T > 80f) { return false; } Vector3 position = ((Component)_t.Partner).transform.position; Vector3 val = ((Component)F).transform.position - position; val.y = 0f; Vector3 val2 = position + ((((Vector3)(ref val)).sqrMagnitude > 0.01f) ? ((Vector3)(ref val)).normalized : Vector3.forward) * 1.5f; FaceAt = position; Vector3 val3 = ((Component)F).transform.position - val2; val3.y = 0f; if (((Vector3)(ref val3)).magnitude > 0.5f) { Dest = val2; Speed = 2.8f; } else { Dest = null; Speed = 0f; } return true; } internal override void End() { _t.Stop(); F.Brain.OnChatEnd(); } } internal sealed class ActCircleShout : PetAct { private readonly Vector3 _center; private readonly float _len; private readonly string _key; private float _ang; private float _shout; internal ActCircleShout(Vector3 center, float seconds, string key) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) _center = center; _len = seconds; _key = key; } protected override void OnBegin() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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_0020: 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_003d: Unknown result type (might be due to invalid IL or missing references) Vector3 val = PetAct.Flat(((Component)F).transform.position - _center); _ang = ((((Vector3)(ref val)).sqrMagnitude > 0.01f) ? Mathf.Atan2(val.z, val.x) : 0f); F.Feel(Mood.Excited, _len + 2f); } protected override bool OnStep(float dt) { //IL_0016: 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_0040: 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_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown _ang += 3.6f * dt; Dest = _center + new Vector3(Mathf.Cos(_ang), 0f, Mathf.Sin(_ang)) * 1.6f; Speed = 6.5f; FaceAt = null; if (T >= _shout && (Object)F.Brain != (Object)null) { F.Brain.Say("circle", _key, 2, 0f); _shout = T + 2.6f; } if (T > 2f && Random.value < 0.01f) { F.Jump(0.8f); } return T < _len; } } internal sealed class ActClimb : PetAct { private Vector3 _top; private Vector3 _stand; private Vector3 _start; private int _phase; private float _phaseT; protected override void OnBegin() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) _start = ((Component)F).transform.position; _phase = (FindLedge() ? 1 : (-1)); } private bool FindLedge() { //IL_0002: 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_0012: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: 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_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) Vector3 val = default(Vector3); RaycastHit val2 = default(RaycastHit); NavMeshHit val3 = default(NavMeshHit); for (int i = 0; i < 12; i++) { float num = Random.value * MathF.PI * 2f; ((Vector3)(ref val))..ctor(Mathf.Cos(num), 0f, Mathf.Sin(num)); if (Physics.Raycast(_start + val * Random.Range(1.6f, 3.2f) + Vector3.up * 2.4f, Vector3.down, ref val2, 3.6f, PetPhysics.RayMask, (QueryTriggerInteraction)1)) { float num2 = ((RaycastHit)(ref val2)).point.y - _start.y; if (!(num2 < 0.5f) && !(num2 > 1.4f) && !(((RaycastHit)(ref val2)).normal.y < 0.85f) && !NavMesh.SamplePosition(((RaycastHit)(ref val2)).point, ref val3, 0.4f, -1)) { _top = ((RaycastHit)(ref val2)).point; _stand = _top - val * 1f; _stand.y = _start.y; return true; } } } return false; } protected override bool OnStep(float dt) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: 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_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: 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_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014a: 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_024e: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_0280: 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_02ae: 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_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) _phaseT += dt; if (_phase < 0 || T > 14f || F.Alerting) { return false; } Vector3 val; switch (_phase) { case 1: Dest = _stand; Speed = 3f; FaceAt = _top; val = PetAct.Flat(_stand - ((Component)F).transform.position); if (((Vector3)(ref val)).magnitude < 0.45f || _phaseT > 5f) { _phase = 2; _phaseT = 0f; F.Feel(Mood.Excited, 3f); F.Jump(Mathf.Clamp(_top.y - _start.y + 0.55f, 0.9f, 1.8f)); } break; case 2: { Vector3 top = _top; val = _top - _stand; Dest = top + ((Vector3)(ref val)).normalized * 0.3f; Speed = 3.2f; FaceAt = _top; if (_phaseT > 0.25f && F.Grounded) { if (!(((Component)F).transform.position.y > _start.y + 0.35f)) { return false; } _phase = 3; F.Brain?.OnClimbed(); _phaseT = 0f; } else if (_phaseT > 3f) { return false; } break; } case 3: Dest = null; Speed = 0f; FaceAt = null; if (_phaseT > Random.Range(3f, 5f)) { _phase = 4; _phaseT = 0f; } break; default: Dest = _start; Speed = 2.8f; if (_phaseT < 4f) { if (!(((Component)F).transform.position.y > _start.y + 0.25f)) { val = PetAct.Flat(_start - ((Component)F).transform.position); return ((Vector3)(ref val)).magnitude > 0.8f; } return true; } return false; } return true; } } internal sealed class ActFlee : PetAct { private readonly Vector3 _from; private readonly float _hide; private Vector3 _spot; private bool _back; private bool _spoke; internal ActFlee(Vector3 from, float hide) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) _from = from; _hide = hide; } protected override void OnBegin() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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_0020: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) Vector3 val = PetAct.Flat(((Component)F).transform.position - _from); if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { val = -((Component)F).transform.forward; } _spot = ((Component)F).transform.position + ((Vector3)(ref val)).normalized * Random.Range(9f, 14f); F.Feel(Mood.Scared, _hide + 4f); } protected override bool OnStep(float dt) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_00a0: 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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) Transform val = F.OwnerTransform(); if ((Object)val == (Object)null) { return false; } Vector3 val2; if (!_back) { Dest = _spot; val2 = PetAct.Flat(_spot - ((Component)F).transform.position); Speed = ((((Vector3)(ref val2)).magnitude > 1f) ? 8f : 0f); if (T > _hide) { _back = true; F.Feel(Mood.Worried, 5f); } return true; } Dest = val.position; Speed = 1.7f; FaceAt = null; if (!_spoke) { val2 = PetAct.Flat(val.position - ((Component)F).transform.position); if (((Vector3)(ref val2)).magnitude < 3.5f) { _spoke = true; F.Brain?.Excuse(); return true; } } if (_spoke) { if (T < _hide + 14f) { val2 = PetAct.Flat(val.position - ((Component)F).transform.position); return ((Vector3)(ref val2)).magnitude > 1.8f; } return false; } return true; } } internal sealed class ActHops : PetAct { private float _next; private int _left = 4; protected override void OnBegin() { F.Feel(Mood.Happy, 4f); } protected override bool OnStep(float dt) { Speed = 0f; if (T >= _next) { F.Jump(0.7f); _next = T + 0.75f; _left--; } if (_left <= 0) { return !F.Grounded; } return true; } } internal sealed class ActLead : PetAct { private readonly Vector3 _truck; private readonly bool _scared; private bool _fetching; private float _say; private float _wait; internal ActLead(Vector3 truck) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) _truck = truck; _scared = Random.value < 0.25f; } protected override void OnBegin() { F.Feel(_scared ? Mood.Worried : Mood.Excited, 6f); F.Brain?.Say("lead", _scared ? "lead_scared" : "lead_start", 3, 0f); _say = 8f; } protected override bool OnStep(float dt) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: 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_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) RoundDirector instance = RoundDirector.instance; Transform val = F.OwnerTransform(); if ((Object)val == (Object)null || (Object)instance == (Object)null || !instance.allExtractionPointsCompleted || T > 300f) { return false; } Vector3 position = ((Component)F).transform.position; Vector3 val2 = PetAct.Flat(val.position - position); float magnitude = ((Vector3)(ref val2)).magnitude; val2 = PetAct.Flat(_truck - val.position); if (((Vector3)(ref val2)).magnitude < 7f) { F.Feel(Mood.Happy, 4f); F.Brain?.Say("lead", "lead_arrive", 2, 0f); return false; } if (_scared) { Vector3 position2 = val.position; val2 = PetAct.Flat(val.position - _truck); Vector3 val3 = position2 + ((Vector3)(ref val2)).normalized * 2f; Dest = val3; val2 = PetAct.Flat(val3 - position); Speed = ((((Vector3)(ref val2)).magnitude > 0.9f) ? 6f : 0f); FaceAt = ((Speed > 0f) ? ((Vector3?)null) : new Vector3?(val.position)); if (T >= _say) { _say = T + Random.Range(12f, 20f); F.Brain?.Say("lead", "lead_scared", 2, 0f); } return true; } if (_fetching) { Dest = val.position; Speed = 7.5f; FaceAt = null; if (magnitude < 3.2f) { _fetching = false; _say = T + 6f; Fetched(); } return true; } if (magnitude > 18f) { _fetching = true; F.Feel(Mood.Worried, 5f); return true; } Dest = _truck; FaceAt = null; if (magnitude > 10f) { Speed = 0f; FaceAt = val.position; _wait += dt; if (_wait > 4f) { _wait = 0f; F.Brain?.Say("leadwait", "lead_urge", 2, 0f); } return true; } _wait = 0f; Speed = Mathf.Lerp(5.5f, 1.8f, Mathf.Clamp01((magnitude - 4f) / 6f)); if (T >= _say) { _say = T + Random.Range(14f, 24f); F.Brain?.Say("lead", "lead_start", 1, 0f); } return true; } private void Fetched() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown PlayerAvatar owner = F.Owner; float num = (((Object)owner != (Object)null && (Object)owner.playerHealth != (Object)null && owner.playerHealth.maxHealth > 0) ? ((float)owner.playerHealth.health / (float)owner.playerHealth.maxHealth) : 1f); float value = Random.value; string key; Mood m; if (num < 0.5f && value < 0.6f) { key = "lead_comfort"; m = Mood.Worried; } else if (value < 0.5f) { key = "lead_urge"; m = Mood.Excited; } else { key = "lead_annoyed"; m = Mood.Angry; } F.Feel(m, 4f); F.Brain?.Say("leadwait", key, 3, 0f); } } internal sealed class ActMonsterPlay : PetAct { private const float Gap = 3.4f; private readonly EnemyParent _ep; private readonly float _len; private int _mode; private float _modeT; private float _modeFor; private float _ang; private float _jumpAt; private float _chatAt; private bool _scared; private bool _arrived; private string _name = "?"; internal ActMonsterPlay(EnemyParent ep) { _ep = ep; _len = Random.Range(16f, 30f); } protected override void OnBegin() { _name = Names.Enemy(_ep); F.Feel(Mood.Excited, 5f); F.Brain?.Say("monhi" + ((Object)_ep).GetInstanceID(), "mon_hi", 2, 0f, _name); _chatAt = 6f; } protected override bool OnStep(float dt) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: 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_00db: 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_00e1: 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_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) Transform val = F.OwnerTransform(); if ((Object)val == (Object)null || F.Alerting || PetBrain.IsDead(_ep) || T > _len) { return false; } if (PetBrain.IsChasing(_ep)) { _scared = true; return false; } Vector3 position = (((Object)_ep.Enemy.CenterTransform != (Object)null) ? _ep.Enemy.CenterTransform : ((Component)_ep.Enemy).transform).position; Vector3 val2 = PetAct.Flat(((Component)F).transform.position - position); float magnitude = ((Vector3)(ref val2)).magnitude; if (!(magnitude > 22f)) { if (!Plugin.Roam) { Vector3 val3 = PetAct.Flat(val.position - position); if (((Vector3)(ref val3)).magnitude > 24f) { goto IL_03a2; } } Vector3 val4 = ((magnitude > 0.01f) ? (val2 / magnitude) : Vector3.forward); FaceAt = position; if (!_arrived) { Dest = position + val4 * 3.4f; Speed = 3.4f; if (magnitude < 4.6000004f) { _arrived = true; _ang = Mathf.Atan2(val4.z, val4.x); PickMode(); } return true; } _modeT += dt; if (_modeT > _modeFor) { PickMode(); } switch (_mode) { case 0: _ang += 1.7f * dt; Dest = position + new Vector3(Mathf.Cos(_ang), 0f, Mathf.Sin(_ang)) * 3.4f; Speed = 4.4f; break; case 1: _ang = Mathf.Atan2(val4.z, val4.x); Dest = position + val4 * 3.4f; Speed = Mathf.Clamp(2.4f + (magnitude - 3.4f) * 1.6f, 0f, 6.5f); if (magnitude < 3.7f) { Speed = 0f; } break; default: Dest = ((magnitude < 2.6000001f) ? new Vector3?(position + val4 * 3.4f) : ((Vector3?)null)); Speed = (Dest.HasValue ? 3f : 0f); if (T > _jumpAt) { _jumpAt = T + Random.Range(2.5f, 5f); F.Jump(0.55f); } break; } if (T > _chatAt) { _chatAt = T + Random.Range(5f, 9f); F.Brain?.Say("monchat" + ((Object)_ep).GetInstanceID(), (_mode == 1) ? "mon_follow" : "mon_chat", 1, 0f, _name); } return true; } goto IL_03a2; IL_03a2: return false; } private void PickMode() { _mode = Random.Range(0, 3); _modeT = 0f; _modeFor = Random.Range(4f, 8f); } internal override void End() { if (_scared) { F.Feel(Mood.Scared, 5f); F.Brain?.Say("monflee", "mon_flee", 3, 0f, _name); F.Alert(4f); } else if (_arrived && Random.value < 0.7f) { F.Feel(Mood.Happy, 4f); F.Brain?.Say("monbye", "mon_bye", 1, 0f, _name); } } } internal sealed class ActPanic : PetAct { private Vector3 _goal; private float _redirect; private float _babble; private readonly float _len = Random.Range(5f, 8f); protected override void OnBegin() { F.Feel(Mood.Scared, _len + 2f); } protected override bool OnStep(float dt) { //IL_0085: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: 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_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Expected O, but got Unknown if (T >= _redirect) { _redirect = T + Random.Range(0.5f, 1.2f); Vector3 val = Quaternion.Euler(0f, Random.Range(0f, 360f), 0f) * Vector3.forward; _goal = ((Component)F).transform.position + val * Random.Range(3f, 7f); } Dest = _goal; Speed = 8f; FaceAt = null; if (T >= _babble && (Object)F.Brain != (Object)null) { F.Brain.Say("babble", "panic_babble", 2, 0f); _babble = T + 2.2f; } if (Random.value < 0.02f) { F.Jump(0.6f); } return T < _len; } } internal sealed class ActRecall : PetAct { internal readonly CallStyle Style; private readonly bool _canTrip; internal bool Arrived; internal bool Tripped; internal ActRecall(CallStyle style, bool canTrip) { Style = style; _canTrip = canTrip; } protected override void OnBegin() { F.Feel((Style == CallStyle.Fast) ? Mood.Excited : ((Style != CallStyle.Grumble) ? Mood.Happy : Mood.Angry), 6f); } protected override bool OnStep(float dt) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) Transform val = F.OwnerTransform(); if ((Object)val == (Object)null || F.Vit.Down || F.Held || T > 25f) { return false; } Vector3 val2 = PetAct.Flat(val.position - ((Component)F).transform.position); if (((Vector3)(ref val2)).magnitude < 2.1f) { Arrived = true; return false; } Dest = val.position; FaceAt = val.position; Speed = ((Style == CallStyle.Fast) ? 8.2f : ((Style == CallStyle.Grumble) ? 2.8f : 5.4f)); if (_canTrip && Style != CallStyle.Grumble && ((Vector3)(ref val2)).magnitude > 6f && F.Running && Random.value < dt * ((Style == CallStyle.Fast) ? 0.16f : 0.07f)) { Tripped = true; F.KnockOver(((Component)F).transform.forward, 1.3f); F.Brain.ClearGate(); F.Brain.Say("calltrip", "call_trip", 3, 0f); F.Feel(Mood.Surprised, 3f); return false; } return true; } } internal sealed class ActRoam : PetAct { private const float Leash = 14f; private Interests.Spot _spot; private Vector3 _target; private bool _looking; private float _lookT; private float _lookFor; private float _walkT; private int _cycles; private int _maxCycles; private bool _reacted; private readonly NavMeshPath _path = new NavMeshPath(); private Transform OwnerRoot { get { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown if (!((Object)F.Owner != (Object)null)) { return null; } return ((Component)F.Owner).transform; } } protected override void OnBegin() { _maxCycles = Random.Range(2, 5); Next(); } private bool Reachable(Vector3 want, out Vector3 ok) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Invalid comparison between Unknown and I4 ok = want; NavMeshHit val = default(NavMeshHit); if (!NavMesh.SamplePosition(want, ref val, 2.5f, -1)) { return false; } ok = ((NavMeshHit)(ref val)).position; if (NavMesh.CalculatePath(((Component)F).transform.position, ok, -1, _path)) { return (int)_path.status == 0; } return false; } private void Next() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0160: 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_009c: 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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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) //IL_00c9: 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: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: 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_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) _looking = false; _reacted = false; _walkT = 0f; Transform val = F.OwnerTransform(); if ((Object)val == (Object)null) { return; } if (Random.value < 0.75f) { Interests.Spot spot = Interests.Pick(val.position, 12f, allowEnemy: false, ((Component)F).transform, OwnerRoot, _spot); if (spot != null) { float num = ((spot.Kind == 2 || spot.Kind == 3) ? 1.6f : 2.2f); Vector3 val2 = PetAct.Flat(((Component)F).transform.position - spot.Pos); val2 = ((((Vector3)(ref val2)).sqrMagnitude < 0.01f) ? Vector3.forward : ((Vector3)(ref val2)).normalized); if (Reachable(spot.Pos + val2 * num, out var ok)) { _spot = spot; _target = ok; return; } } } _spot = null; for (int i = 0; i < 6; i++) { float num2 = Random.value * MathF.PI * 2f; Vector3 want = val.position + new Vector3(Mathf.Cos(num2), 0f, Mathf.Sin(num2)) * Random.Range(2.5f, 9f); if (Reachable(want, out var ok2)) { _target = ok2; return; } } _target = ((Component)F).transform.position; } protected override bool OnStep(float dt) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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_00e0: 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_00ea: Unknown result type (might be due to invalid IL or missing references) Transform val = F.OwnerTransform(); if (!((Object)val == (Object)null) && !F.Alerting) { Vector3 val2 = PetAct.Flat(val.position - ((Component)F).transform.position); if (!(((Vector3)(ref val2)).magnitude > 14f)) { if (_spot != null && !_spot.Alive) { Next(); } if (!_looking) { _walkT += dt; Dest = _target; Speed = ((_spot != null) ? 2.7f : 2.1f); FaceAt = null; val2 = PetAct.Flat(_target - ((Component)F).transform.position); if (((Vector3)(ref val2)).magnitude < 0.8f || _walkT > 14f) { _looking = true; _lookT = 0f; _lookFor = ((_spot != null) ? Random.Range(3f, 6.5f) : Random.Range(1.2f, 3f)); if (Random.value < 0.15f) { F.Jump(0.5f); } } return true; } _lookT += dt; Dest = null; Speed = 0f; FaceAt = ((_spot != null) ? new Vector3?(_spot.Pos) : ((Vector3?)null)); if (!_reacted && _spot != null && _lookT > _lookFor * 0.5f) { _reacted = true; if (Random.value < 0.6f) { F.Brain?.OnStared(_spot.Kind); } } if (_lookT < _lookFor) { return true; } _cycles++; if (_cycles >= _maxCycles) { return false; } Next(); return true; } } return false; } } internal sealed class ActRollRun : PetAct { private Vector3 _goal; private float _next; private int _rolls; private readonly int _max = Random.Range(3, 6); protected override void OnBegin() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: 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) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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_0054: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Quaternion.Euler(0f, Random.Range(0f, 360f), 0f) * Vector3.forward; _goal = ((Component)F).transform.position + val * Random.Range(8f, 14f); F.Feel(Mood.Excited, 8f); } protected override bool OnStep(float dt) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: 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_0083: 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_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_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) Speed = 7.5f; Dest = _goal; if (T >= _next && _rolls < _max) { F.Celebrate(); _rolls++; _next = T + 1.4f; } Vector3 val = PetAct.Flat(_goal - ((Component)F).transform.position); if (((Vector3)(ref val)).magnitude < 1.2f && _rolls < _max) { Vector3 val2 = Quaternion.Euler(0f, Random.Range(0f, 360f), 0f) * Vector3.forward; _goal = ((Component)F).transform.position + val2 * Random.Range(8f, 14f); } if (_rolls >= _max) { return T < _next; } return true; } } internal sealed class ActSpaz : PetAct { private float _next; private Vector3 _center; protected override void OnBegin() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_002e: 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_0033: Unknown result type (might be due to invalid IL or missing references) Transform val = F.OwnerTransform(); _center = (((Object)val != (Object)null) ? val.position : ((Component)F).transform.position); F.Feel(Mood.Excited, 6f); F.Brain?.OnSpaz(); } protected override bool OnStep(float dt) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) Transform val = F.OwnerTransform(); if ((Object)val == (Object)null || F.Alerting || T > 6f) { return false; } _center = val.position; if (T >= _next) { _next = T + Random.Range(0.4f, 0.9f); float num = Random.value * MathF.PI * 2f; Dest = _center + new Vector3(Mathf.Cos(num), 0f, Mathf.Sin(num)) * Random.Range(1.5f, 4.5f); if (Random.value < 0.4f) { F.Jump(Random.Range(0.5f, 1f)); } } Speed = 6.5f; return true; } } internal sealed class ActSpin : PetAct { private float _ang; private readonly float _dir = ((Random.value < 0.5f) ? 1f : (-1f)); private readonly float _len = Random.Range(2.5f, 4.5f); protected override void OnBegin() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) _ang = ((Component)F).transform.eulerAngles.y * (MathF.PI / 180f); F.Feel(Mood.Happy, _len); } protected override bool OnStep(float dt) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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) Speed = 0f; Dest = null; _ang += _dir * 7f * dt; FaceAt = ((Component)F).transform.position + new Vector3(Mathf.Sin(_ang), 0f, Mathf.Cos(_ang)) * 3f; return T < _len; } } internal sealed class ActStare : PetAct { private readonly PlayerAvatar _p; private bool _said; private float _stareT; private readonly float _for = Random.Range(5f, 9f); internal ActStare(PlayerAvatar p) { _p = p; } protected override bool OnStep(float dt) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) if ((Object)_p == (Object)null || _p.deadSet || _p.isDisabled || F.Vit.Down || F.Held || F.Alerting || T > 30f) { return false; } Vector3 position = ((Component)_p).transform.position; FaceAt = position; Vector3 val = ((Component)F).transform.position - position; val.y = 0f; if (((Vector3)(ref val)).magnitude > 2.3f) { Dest = position; Speed = 3f; return true; } Dest = null; Speed = 0f; _stareT += dt; if (!_said && _stareT > 1.4f) { _said = true; F.Brain.OnStare(_p); } return _stareT < _for; } } internal sealed class ActWait : PetAct { private Vector3 _at; protected override void OnBegin() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) _at = ((Component)F).transform.position; } protected override bool OnStep(float dt) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) if (F.Vit.Down || F.Held || F.Alerting || T > 120f) { return false; } Transform val = F.OwnerTransform(); FaceAt = (((Object)val != (Object)null) ? new Vector3?(val.position) : ((Vector3?)null)); Dest = null; Speed = 0f; return true; } } internal sealed class ActZoomies : PetAct { private float _ang; private Vector3 _center; protected override void OnBegin() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_002e: 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_0033: 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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) Transform val = F.OwnerTransform(); _center = (((Object)val != (Object)null) ? val.position : ((Component)F).transform.position); Vector3 val2 = PetAct.Flat(((Component)F).transform.position - _center); _ang = ((((Vector3)(ref val2)).sqrMagnitude > 0.01f) ? Mathf.Atan2(val2.z, val2.x) : 0f); F.Feel(Mood.Excited, 5f); } protected override bool OnStep(float dt) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) Transform val = F.OwnerTransform(); if ((Object)val == (Object)null || T > 5f) { return false; } _center = val.position; _ang += 3.2f * dt; Dest = _center + new Vector3(Mathf.Cos(_ang), 0f, Mathf.Sin(_ang)) * 2.4f; Speed = 7f; return true; } } internal static class AiClient { internal static bool ThinkOff = true; internal static bool JsonMode = true; internal static bool ChatTts; internal static string Esc(string s) { StringBuilder stringBuilder = new StringBuilder(); string text = s ?? ""; foreach (char c in text) { switch (c) { case '"': stringBuilder.Append("\\\""); continue; case '\\': stringBuilder.Append("\\\\"); continue; case '\n': stringBuilder.Append("\\n"); continue; case '\t': stringBuilder.Append("\\t"); continue; case '\r': continue; } if (c < ' ') { StringBuilder stringBuilder2 = stringBuilder.Append("\\u"); int num = c; stringBuilder2.Append(num.ToString("x4")); } else { stringBuilder.Append(c); } } return stringBuilder.ToString(); } internal static string Str(string json, string key, int from = 0) { int num = json.IndexOf("\"" + key + "\"", from, StringComparison.Ordinal); if (num < 0) { return null; } num = json.IndexOf(':', num + key.Length + 2); if (num < 0) { return null; } for (num++; num < json.Length && char.IsWhiteSpace(json[num]); num++) { } if (num >= json.Length || json[num] != '"') { return null; } num++; StringBuilder stringBuilder = new StringBuilder(); for (; num < json.Length && json[num] != '"'; num++) { char c = json[num]; if (c == '\\' && num + 1 < json.Length) { num++; char c2 = json[num]; switch (c2) { case 'n': stringBuilder.Append('\n'); break; case 't': stringBuilder.Append('\t'); break; case 'u': { if (num + 4 < json.Length && int.TryParse(json.Substring(num + 1, 4), NumberStyles.HexNumber, null, out var result)) { stringBuilder.Append((char)result); num += 4; } break; } default: stringBuilder.Append(c2); break; case 'r': break; } } else { stringBuilder.Append(c); } } return stringBuilder.ToString(); } internal static IEnumerator Chat(string system, List<string[]> history, Action<string, string> don