Decompiled source of TravelingMerchant v0.22.12

BepInEx/plugins/TravelingMerchant/TravelingMerchant.dll

Decompiled 4 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Jotunn.Entities;
using Jotunn.Managers;
using Jotunn.Utils;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: InternalsVisibleTo("TravelingMerchant.RuntimeTests")]
[assembly: InternalsVisibleTo("TravelingMerchant.MultiplayerTests")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("TravelingMerchant")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.22.12.0")]
[assembly: AssemblyInformationalVersion("0.22.12")]
[assembly: AssemblyProduct("TravelingMerchant")]
[assembly: AssemblyTitle("TravelingMerchant")]
[assembly: AssemblyVersion("0.22.12.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[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 TravelingMerchant
{
	public sealed class MerchantArrival : MonoBehaviour
	{
		private static readonly MethodInfo Inworld = AccessTools.Method(typeof(Chat), "AddInworldText", (Type[])null, (Type[])null);

		private float lastToast;

		public bool Announced { get; private set; }

		public int ToastAnnouncements { get; private set; }

		public string ToastCaption { get; private set; } = "";

		private void Awake()
		{
			ZNetView component = ((Component)this).GetComponent<ZNetView>();
			if (Object.op_Implicit((Object)(object)component) && component.IsValid())
			{
				lastToast = component.GetZDO().GetFloat("tm.toast", 0f);
			}
		}

		private void CheckToastCaption()
		{
			//IL_007c: 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_00d0: 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_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_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Expected O, but got Unknown
			if (Plugin.Dedicated || !Object.op_Implicit((Object)(object)Chat.instance) || !Object.op_Implicit((Object)(object)Player.m_localPlayer))
			{
				return;
			}
			ZNetView component = ((Component)this).GetComponent<ZNetView>();
			if (!Object.op_Implicit((Object)(object)component) || !component.IsValid())
			{
				return;
			}
			float num = component.GetZDO().GetFloat("tm.toast", 0f);
			if (!(num <= lastToast))
			{
				lastToast = num;
				if (!(Server.Now - (double)num > 2.0) && !(Vector3.Distance(((Component)Player.m_localPlayer).transform.position, ((Component)this).transform.position) > 25f))
				{
					UserInfo localUser = UserInfo.GetLocalUser();
					localUser.Name = "Traveling Merchant";
					Inworld.Invoke(Chat.instance, new object[6]
					{
						null,
						-9187343L,
						((Component)this).transform.position + Vector3.up * 1.7f,
						(object)(Type)1,
						localUser,
						"Traveling Merchant\nSkål!"
					});
					object obj = AccessTools.Method(typeof(Chat), "FindExistingWorldText", (Type[])null, (Type[])null).Invoke(Chat.instance, new object[1] { -9187343L });
					TextMeshProUGUI val = (TextMeshProUGUI)AccessTools.Field(obj.GetType(), "m_textMeshField").GetValue(obj);
					((TMP_Text)val).alignment = (TextAlignmentOptions)514;
					ToastCaption = ((TMP_Text)val).text;
					ToastAnnouncements++;
				}
			}
		}

		private void Update()
		{
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00df: 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_00f3: 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)
			CheckToastCaption();
			if (Announced || Plugin.Dedicated || !Object.op_Implicit((Object)(object)Chat.instance) || !Object.op_Implicit((Object)(object)Player.m_localPlayer) || ((Character)Player.m_localPlayer).InIntro())
			{
				return;
			}
			ZNetView component = ((Component)this).GetComponent<ZNetView>();
			if (Object.op_Implicit((Object)(object)component) && component.IsValid())
			{
				ZDO zDO = component.GetZDO();
				double num = Server.Now - (double)zDO.GetFloat("tm.start", 0f);
				if (num > 10.0)
				{
					Announced = true;
				}
				else if (!(num < 0.0) && !(Vector3.Distance(((Component)Player.m_localPlayer).transform.position, ((Component)this).transform.position) > 100f))
				{
					UserInfo localUser = UserInfo.GetLocalUser();
					localUser.Name = "Traveling Merchant";
					Vector3 val = zDO.GetVec3("tm.home", ((Component)this).transform.position) + Vector3.up * 2f;
					((Terminal)Chat.instance).AddString("<color=#ffd479>Traveling Merchant: I've arrived!</color>");
					AccessTools.Field(typeof(Chat), "m_hideTimer").SetValue(Chat.instance, 0f);
					Inworld.Invoke(Chat.instance, new object[6]
					{
						null,
						-9187341L,
						val,
						(object)(Type)2,
						localUser,
						"Hello!"
					});
					Announced = true;
				}
			}
		}
	}
	[DefaultExecutionOrder(100)]
	public sealed class MerchantAudio : MonoBehaviour
	{
		public const float Crossfade = 4f;

		private ZNetView view;

		private AudioSource voice;

		private AudioSource purchase;

		private AudioSource toastVoice;

		private float lastPurchaseCue;

		private float lastToastCue;

		private AudioEchoFilter echo;

		private readonly AudioSource[] music = (AudioSource[])(object)new AudioSource[2];

		private readonly bool[] active = new bool[2];

		private bool checkedArrival;

		private double voiceAt = -100.0;

		private double lastTrade = -100.0;

		public static float Duck { get; private set; }

		public bool ArrivalQueued { get; private set; }

		public int TradeCalls { get; private set; }

		public double MusicPosition { get; private set; }

		public float MusicGain { get; private set; }

		public bool Paused { get; private set; }

		public AudioClip[] Clips { get; private set; } = Array.Empty<AudioClip>();

		public AudioClip PurchaseClip { get; private set; }

		public int PurchaseCalls { get; private set; }

		public AudioClip ToastClip { get; private set; }

		public int ToastCalls { get; private set; }

		private void Awake()
		{
			//IL_00c8: 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_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_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_015d: 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_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Expected O, but got Unknown
			//IL_022c: 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_02fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0307: Unknown result type (might be due to invalid IL or missing references)
			if (Plugin.Dedicated)
			{
				((Behaviour)this).enabled = false;
				return;
			}
			view = ((Component)this).GetComponent<ZNetView>();
			Clips = new string[4] { "Hallo", "TradeGreeting", "MerchantSecret", "CampfireTreasures" }.Select((string name) => Plugin.AudioAssets.LoadAsset<AudioClip>("Assets/Audio/" + name + ".wav")).ToArray();
			if (Clips.Any((AudioClip clip) => !Object.op_Implicit((Object)(object)clip)))
			{
				throw new InvalidOperationException("Missing merchant audio clip");
			}
			voice = Source("MerchantVoice", 1f);
			((Component)voice).transform.localPosition = Vector3.up * 1.45f;
			voice.minDistance = 4f;
			voice.maxDistance = 80f;
			voice.dopplerLevel = 0f;
			voice.rolloffMode = (AudioRolloffMode)2;
			voice.SetCustomCurve((AudioSourceCurveType)0, new AnimationCurve((Keyframe[])(object)new Keyframe[5]
			{
				new Keyframe(0f, 1f),
				new Keyframe(0.05f, 1f),
				new Keyframe(0.3f, 0.65f),
				new Keyframe(0.6f, 0.25f),
				new Keyframe(1f, 0f)
			}));
			if (Object.op_Implicit((Object)(object)AudioMan.instance))
			{
				voice.outputAudioMixerGroup = AudioMan.instance.m_masterMixer.FindMatchingGroups("SFX").FirstOrDefault();
			}
			PurchaseClip = Plugin.AudioAssets.LoadAsset<AudioClip>("Assets/Audio/PurchaseResponseBoosted.wav");
			if (!Object.op_Implicit((Object)(object)PurchaseClip))
			{
				throw new InvalidOperationException("Missing purchase response");
			}
			purchase = Source("MerchantPurchaseVoice", 1f);
			purchase.clip = PurchaseClip;
			((Component)purchase).transform.localPosition = Vector3.up * 1.3f;
			purchase.minDistance = 3f;
			purchase.maxDistance = 18f;
			purchase.dopplerLevel = 0f;
			purchase.bypassReverbZones = true;
			purchase.bypassListenerEffects = true;
			purchase.outputAudioMixerGroup = voice.outputAudioMixerGroup;
			ToastClip = Plugin.AudioAssets.LoadAsset<AudioClip>("Assets/Audio/ToastBoosted.wav");
			if (!Object.op_Implicit((Object)(object)ToastClip))
			{
				throw new InvalidOperationException("Missing toast voice");
			}
			toastVoice = Source("MerchantToastVoice", 1f);
			toastVoice.clip = ToastClip;
			((Component)toastVoice).transform.localPosition = Vector3.up * 1.3f;
			toastVoice.minDistance = 3f;
			toastVoice.maxDistance = 18f;
			toastVoice.dopplerLevel = 0f;
			toastVoice.bypassReverbZones = true;
			toastVoice.bypassListenerEffects = true;
			toastVoice.outputAudioMixerGroup = voice.outputAudioMixerGroup;
			lastToastCue = ((Object.op_Implicit((Object)(object)view) && view.IsValid()) ? view.GetZDO().GetFloat("tm.toast", 0f) : 0f);
			lastPurchaseCue = ((Object.op_Implicit((Object)(object)view) && view.IsValid()) ? view.GetZDO().GetFloat("tm.buyVoice", 0f) : 0f);
			echo = ((Component)voice).gameObject.AddComponent<AudioEchoFilter>();
			echo.delay = 180f;
			echo.decayRatio = 0.28f;
			echo.dryMix = 1f;
			echo.wetMix = 0.15f;
			((Behaviour)echo).enabled = false;
			for (int num = 0; num < 2; num++)
			{
				music[num] = Source("MerchantMusic" + num, 0f);
				music[num].clip = Clips[num + 2];
				music[num].volume = 0f;
				if (Object.op_Implicit((Object)(object)MusicMan.instance))
				{
					music[num].outputAudioMixerGroup = MusicMan.instance.m_musicMixer;
				}
			}
		}

		private AudioSource Source(string name, float spatial)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name);
			val.transform.SetParent(((Component)this).transform, false);
			AudioSource obj = val.AddComponent<AudioSource>();
			obj.playOnAwake = false;
			obj.spatialBlend = spatial;
			obj.loop = false;
			obj.priority = ((spatial > 0f) ? 80 : 160);
			return obj;
		}

		public static void Track(double elapsed, float first, float second, int index, out float position, out float weight)
		{
			double num = first + second - 8f;
			double num2 = ((index == 0) ? 0f : (first - 4f));
			float num3 = ((index == 0) ? first : second);
			if (elapsed < num2)
			{
				position = (weight = 0f);
				return;
			}
			position = (float)(((elapsed - num2) % num + num) % num);
			weight = ((position < num3) ? Mathf.Min(Mathf.Clamp01(position / 4f), Mathf.Clamp01((num3 - position) / 4f)) : 0f);
		}

		private void LateUpdate()
		{
			//IL_037b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0380: Unknown result type (might be due to invalid IL or missing references)
			//IL_0392: Unknown result type (might be due to invalid IL or missing references)
			//IL_039a: Unknown result type (might be due to invalid IL or missing references)
			//IL_036a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0359: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ee: Unknown result type (might be due to invalid IL or missing references)
			bool flag = Game.IsPaused() || Time.timeScale == 0f;
			if (flag != Paused)
			{
				Paused = flag;
				AudioSource[] array = music;
				foreach (AudioSource val in array)
				{
					if (Object.op_Implicit((Object)(object)val))
					{
						if (flag)
						{
							val.Pause();
						}
						else
						{
							val.UnPause();
						}
					}
				}
				if (Object.op_Implicit((Object)(object)voice))
				{
					if (flag)
					{
						voice.Pause();
					}
					else
					{
						voice.UnPause();
					}
				}
				if (Object.op_Implicit((Object)(object)purchase))
				{
					if (flag)
					{
						purchase.Pause();
					}
					else
					{
						purchase.UnPause();
					}
				}
				if (Object.op_Implicit((Object)(object)toastVoice))
				{
					if (flag)
					{
						toastVoice.Pause();
					}
					else
					{
						toastVoice.UnPause();
					}
				}
			}
			if (flag || !Object.op_Implicit((Object)(object)view) || !view.IsValid())
			{
				return;
			}
			ZDO zDO = view.GetZDO();
			double num = Server.Now - (double)zDO.GetFloat("tm.start", 0f);
			if (!checkedArrival)
			{
				checkedArrival = true;
				if (num >= 0.0 && num < (double)Clips[0].length)
				{
					voice.bypassReverbZones = false;
					voice.bypassListenerEffects = false;
					voice.clip = Clips[0];
					voice.Play();
					voice.time = (float)num;
					voiceAt = Server.Now - num;
					ArrivalQueued = true;
				}
			}
			purchase.volume = Plugin.VoiceVolume.Value * (Object.op_Implicit((Object)(object)purchase.outputAudioMixerGroup) ? 1f : AudioMan.GetSFXVolume());
			toastVoice.volume = Plugin.VoiceVolume.Value * (Object.op_Implicit((Object)(object)toastVoice.outputAudioMixerGroup) ? 1f : AudioMan.GetSFXVolume());
			float num2 = zDO.GetFloat("tm.toast", 0f);
			if (num2 > lastToastCue)
			{
				lastToastCue = num2;
				if (Server.Now - (double)num2 < 2.0 && zDO.GetFloat("tm.leave", 0f) == 0f)
				{
					toastVoice.Play();
					ToastCalls++;
				}
			}
			float num3 = zDO.GetFloat("tm.buyVoice", 0f);
			if (num3 > lastPurchaseCue)
			{
				lastPurchaseCue = num3;
				if (Server.Now - (double)num3 < 1.5 && zDO.GetFloat("tm.leave", 0f) == 0f)
				{
					if ((Object)(object)voice.clip == (Object)(object)Clips[1])
					{
						voice.Stop();
					}
					purchase.Play();
					PurchaseCalls++;
				}
			}
			voice.volume = Plugin.VoiceVolume.Value * (Object.op_Implicit((Object)(object)voice.outputAudioMixerGroup) ? 1f : AudioMan.GetSFXVolume());
			Vector3 val2 = (Object.op_Implicit((Object)(object)GameCamera.instance) ? ((Component)GameCamera.instance).transform.position : (Object.op_Implicit((Object)(object)Player.m_localPlayer) ? ((Component)Player.m_localPlayer).transform.position : ((Component)this).transform.position));
			echo.wetMix = Mathf.Lerp(0.04f, 0.22f, Mathf.Clamp01(Vector3.Distance(val2, ((Component)this).transform.position) / 60f));
			((Behaviour)echo).enabled = (Object)(object)voice.clip == (Object)(object)Clips[0] && Server.Now - voiceAt < (double)Clips[0].length + 0.8;
			float num4 = zDO.GetFloat("tm.musicAt", 0f);
			if (num4 <= 0f && !zDO.GetBool("tm.abort", false) && num >= (double)zDO.GetFloat("tm.walk", 0f))
			{
				num4 = zDO.GetFloat("tm.start", 0f) + zDO.GetFloat("tm.walk", 0f);
			}
			if (Object.op_Implicit((Object)(object)MusicMan.instance))
			{
				AudioSource[] array = music;
				foreach (AudioSource val3 in array)
				{
					if (!Object.op_Implicit((Object)(object)val3.outputAudioMixerGroup))
					{
						val3.outputAudioMixerGroup = MusicMan.instance.m_musicMixer;
					}
				}
			}
			Vector3 vec = zDO.GetVec3("tm.seat", ((Component)this).transform.position);
			float num5 = (Object.op_Implicit((Object)(object)Player.m_localPlayer) ? Vector3.Distance(((Component)Player.m_localPlayer).transform.position, vec) : 100f);
			float num6 = 1f - Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(5f, 22f, num5));
			float num7 = ((num4 > 0f && zDO.GetFloat("tm.leave", 0f) == 0f) ? num6 : 0f);
			MusicGain = Mathf.MoveTowards(MusicGain, num7, Time.deltaTime / 3f);
			Duck = MusicGain * (float)((Plugin.MusicVolume.Value > 0f && MusicMan.m_masterMusicVolume > 0f) ? 1 : 0);
			if (num4 <= 0f)
			{
				return;
			}
			MusicPosition = Math.Max(0.0, Server.Now - (double)num4);
			for (int j = 0; j < 2; j++)
			{
				Track(MusicPosition, Clips[2].length, Clips[3].length, j, out var position, out var weight);
				bool flag2 = MusicGain > 0.001f && weight > 0f;
				if (flag2 && (!active[j] || (!music[j].isPlaying && !AudioListener.pause)))
				{
					music[j].Play();
					Seek(music[j], position);
				}
				else if (!flag2 && active[j])
				{
					music[j].Stop();
				}
				else if (flag2 && !AudioListener.pause && Mathf.Abs((float)music[j].timeSamples / (float)music[j].clip.frequency - position) > 0.4f)
				{
					Seek(music[j], position);
				}
				active[j] = flag2;
				music[j].volume = weight * MusicGain * Plugin.MusicVolume.Value * MusicMan.m_masterMusicVolume;
			}
		}

		private static void Seek(AudioSource source, float seconds)
		{
			source.timeSamples = Mathf.Clamp(Mathf.RoundToInt(seconds * (float)source.clip.frequency), 0, source.clip.samples - 1);
		}

		public void PlayTrade()
		{
			if (((Behaviour)this).enabled && !(Server.Now - lastTrade < 1.0))
			{
				lastTrade = (voiceAt = Server.Now);
				TradeCalls++;
				((Behaviour)echo).enabled = false;
				voice.bypassReverbZones = true;
				voice.bypassListenerEffects = true;
				voice.clip = Clips[1];
				voice.Play();
			}
		}

		private void OnDestroy()
		{
			Duck = 0f;
		}
	}
	[HarmonyPatch(typeof(MusicMan), "UpdateMusic")]
	internal static class MerchantMusicDuck
	{
		private static readonly FieldRef<MusicMan, AudioSource> Source = AccessTools.FieldRefAccess<MusicMan, AudioSource>("m_musicSource");

		private static MusicMan? last;

		private static float unducked;

		private static void Prefix(MusicMan __instance)
		{
			if ((Object)(object)last == (Object)(object)__instance && Object.op_Implicit((Object)(object)Source.Invoke(__instance)))
			{
				Source.Invoke(__instance).volume = unducked;
			}
		}

		private static void Postfix(MusicMan __instance)
		{
			AudioSource val = Source.Invoke(__instance);
			if (Object.op_Implicit((Object)(object)val))
			{
				last = __instance;
				unducked = val.volume;
				val.volume *= 1f - 0.85f * MerchantAudio.Duck;
			}
		}
	}
	public sealed class MerchantBody : MonoBehaviour, Hoverable, Interactable
	{
		private static readonly HashSet<MerchantBody> bodies = new HashSet<MerchantBody>();

		private ZNetView view;

		private Transform wizard;

		private Transform pack;

		private Transform staff;

		private Transform hips;

		private Transform tankard;

		private Transform[] bones = Array.Empty<Transform>();

		private Vector3 wizardRest;

		private readonly Dictionary<string, Transform> rig = new Dictionary<string, Transform>();

		private readonly Dictionary<string, TradeItem> stock = new Dictionary<string, TradeItem>();

		private List<Vector3> path = new List<Vector3>();

		private int routeRevision = -1;

		private Vector3 plantedStaff;

		private float lastCanePhase = 1f;

		private bool caneWalking;

		private MerchantStraps? straps;

		public const float TradeDistance = 2f;

		private readonly Dictionary<string, AnimationClip> clips = new Dictionary<string, AnimationClip>();

		private Vector3 authoredBagGround;

		private Vector3 authoredStaffGround;

		private Quaternion authoredPackRotation;

		private Quaternion authoredStaffRotation;

		private Transform model;

		private Transform packAnchor;

		private Transform staffAnchor;

		private Transform mugAnchor;

		private string lastClip = "";

		private float transition;

		private float transitionDuration = 0.45f;

		private Vector3[] blendPositions = Array.Empty<Vector3>();

		private Quaternion[] blendRotations = Array.Empty<Quaternion>();

		private Vector3[] gaitPositions = Array.Empty<Vector3>();

		private Quaternion[] gaitRotations = Array.Empty<Quaternion>();

		private float warmthWeight;

		private float cupRestWeight;

		private float cupBottom;

		private Vector3 cupLocalCentre;

		private readonly Dictionary<string, Quaternion> palmFrames = new Dictionary<string, Quaternion>();

		private readonly Dictionary<Transform, Quaternion> fingerBind = new Dictionary<Transform, Quaternion>();

		private Quaternion packCarryRotation;

		private bool carryRotationReady;

		private Vector3 packFitOffset;

		private float attentionYaw;

		private float attentionPitch;

		private float yawVelocity;

		private float pitchVelocity;

		private Player? attentionPlayer;

		private bool attentionApplied;

		private Quaternion attentionHeadBase;

		private Quaternion attentionNeckBase;

		private Quaternion attentionSpineBase;

		public bool CanTrade { get; private set; }

		public int BodyTriangles => ((Component)this).GetComponentsInChildren<SkinnedMeshRenderer>().Sum((SkinnedMeshRenderer r) => r.sharedMesh.triangles.Length / 3);

		public int PropTriangles => ((Component)this).GetComponentsInChildren<MeshFilter>().Sum((MeshFilter r) => r.sharedMesh.triangles.Length / 3);

		internal ZDO? VisitData => Data;

		private ZDO? Data
		{
			get
			{
				if (!Object.op_Implicit((Object)(object)view) || !view.IsValid())
				{
					return null;
				}
				return view.GetZDO();
			}
		}

		public string CurrentMotion => lastClip;

		public bool WarmingHands { get; private set; }

		public float FarewellPitch { get; private set; }

		public float WarmingJoin { get; private set; }

		public bool DrawingTankard { get; private set; }

		public float PackBodyClearance { get; private set; } = 1f;

		public float AttentionYaw => attentionYaw;

		public float AttentionPitch => attentionPitch;

		public bool InTradeRange(Humanoid user)
		{
			//IL_000e: 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)
			if (Object.op_Implicit((Object)(object)user))
			{
				return Vector3.Distance(((Component)user).transform.position, ((Component)this).transform.position) <= 2f;
			}
			return false;
		}

		private void Awake()
		{
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0306: Unknown result type (might be due to invalid IL or missing references)
			//IL_030b: Unknown result type (might be due to invalid IL or missing references)
			//IL_034d: Unknown result type (might be due to invalid IL or missing references)
			//IL_03de: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0412: Unknown result type (might be due to invalid IL or missing references)
			//IL_0421: Unknown result type (might be due to invalid IL or missing references)
			//IL_053f: Unknown result type (might be due to invalid IL or missing references)
			//IL_044e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0453: Unknown result type (might be due to invalid IL or missing references)
			//IL_0552: Unknown result type (might be due to invalid IL or missing references)
			//IL_0557: Unknown result type (might be due to invalid IL or missing references)
			//IL_0770: Unknown result type (might be due to invalid IL or missing references)
			//IL_0777: Unknown result type (might be due to invalid IL or missing references)
			//IL_077c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0781: Unknown result type (might be due to invalid IL or missing references)
			//IL_0785: Unknown result type (might be due to invalid IL or missing references)
			//IL_078a: Unknown result type (might be due to invalid IL or missing references)
			//IL_07a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_07bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_07cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_07cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_07cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0469: Unknown result type (might be due to invalid IL or missing references)
			//IL_0489: Unknown result type (might be due to invalid IL or missing references)
			//IL_0495: Unknown result type (might be due to invalid IL or missing references)
			//IL_04aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_056d: Unknown result type (might be due to invalid IL or missing references)
			//IL_058e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0593: Unknown result type (might be due to invalid IL or missing references)
			//IL_0598: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_07e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_07fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0800: Unknown result type (might be due to invalid IL or missing references)
			//IL_080c: Unknown result type (might be due to invalid IL or missing references)
			//IL_080e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0815: Unknown result type (might be due to invalid IL or missing references)
			//IL_0817: Unknown result type (might be due to invalid IL or missing references)
			//IL_081c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0990: Unknown result type (might be due to invalid IL or missing references)
			//IL_0995: Unknown result type (might be due to invalid IL or missing references)
			//IL_099a: Unknown result type (might be due to invalid IL or missing references)
			//IL_09ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_09b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_09b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_09c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_09c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_09d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_09d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_09eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_09f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a04: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a09: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a0e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a1a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a1f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a2a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a2f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a43: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a48: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a4d: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_050f: Unknown result type (might be due to invalid IL or missing references)
			//IL_051a: Unknown result type (might be due to invalid IL or missing references)
			//IL_051f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a63: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a7a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b14: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b1e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0936: Unknown result type (might be due to invalid IL or missing references)
			//IL_0944: Unknown result type (might be due to invalid IL or missing references)
			//IL_0949: Unknown result type (might be due to invalid IL or missing references)
			//IL_094e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0952: Unknown result type (might be due to invalid IL or missing references)
			view = ((Component)this).GetComponent<ZNetView>();
			if (!Object.op_Implicit((Object)(object)view) || !view.IsValid())
			{
				return;
			}
			bodies.Add(this);
			if (Plugin.Dedicated)
			{
				return;
			}
			wizard = Object.Instantiate<GameObject>(Plugin.Assets.LoadAsset<GameObject>("Assets/Built/AnimatedWizard.prefab"), ((Component)this).transform, false).transform;
			pack = Object.Instantiate<GameObject>(Plugin.Assets.LoadAsset<GameObject>("Assets/Built/Backpack.prefab"), ((Component)this).transform, false).transform;
			pack.localScale = new Vector3(1.45f, 3.3846157f, 1.35f);
			MerchantLantern.Attach(pack);
			staff = Object.Instantiate<GameObject>(Plugin.Assets.LoadAsset<GameObject>("Assets/Built/Staff.prefab"), ((Component)this).transform, false).transform;
			model = wizard.GetChild(0);
			string[] array = new string[17]
			{
				"StandingIdle", "Walk", "Stop", "RemoveBackpack", "PlaceStaff", "SitDown", "SeatedIdle", "SeatedTalk", "Straighten", "WeightShift",
				"LookAround", "Drink", "Toast", "StandUp", "PickupStaff", "EquipBackpack", "StartWalk"
			};
			foreach (string text in array)
			{
				AnimationClip val = Plugin.Assets.LoadAsset<AnimationClip>("Assets/Built/Animations/" + text + ".anim");
				if (!Object.op_Implicit((Object)(object)val))
				{
					throw new InvalidOperationException("Missing animation in bundle: " + text);
				}
				clips[text] = val;
			}
			packAnchor = ((Component)wizard).GetComponentsInChildren<Transform>().First((Transform t) => ((Object)t).name == "BackpackAnchor");
			staffAnchor = ((Component)wizard).GetComponentsInChildren<Transform>().First((Transform t) => ((Object)t).name == "StaffAnchor");
			mugAnchor = ((Component)wizard).GetComponentsInChildren<Transform>().First((Transform t) => ((Object)t).name == "TankardAnchor");
			bones = ((Component)wizard).GetComponentsInChildren<Transform>();
			Transform[] array2 = bones;
			foreach (Transform val2 in array2)
			{
				if (((Object)val2).name.StartsWith("mixamorig:"))
				{
					rig[((Object)val2).name.Substring(10)] = val2;
				}
			}
			hips = rig["Hips"];
			wizardRest = wizard.localPosition;
			GameObject itemPrefab = ObjectDB.instance.GetItemPrefab("Tankard");
			Transform val3 = (Object.op_Implicit((Object)(object)itemPrefab) ? itemPrefab.transform.Find("attach") : null);
			Renderer[] array3;
			if (Object.op_Implicit((Object)(object)val3))
			{
				tankard = new GameObject("MerchantTankard").transform;
				tankard.SetParent(((Component)this).transform, false);
				GameObject val4 = Object.Instantiate<GameObject>(((Component)val3).gameObject, tankard, false);
				val4.SetActive(true);
				Collider[] componentsInChildren = val4.GetComponentsInChildren<Collider>();
				for (int i = 0; i < componentsInChildren.Length; i++)
				{
					Object.Destroy((Object)(object)componentsInChildren[i]);
				}
				MonoBehaviour[] componentsInChildren2 = val4.GetComponentsInChildren<MonoBehaviour>();
				for (int i = 0; i < componentsInChildren2.Length; i++)
				{
					((Behaviour)componentsInChildren2[i]).enabled = false;
				}
				val4.transform.localPosition = Vector3.zero;
				val4.transform.localRotation = Quaternion.identity;
				MeshFilter[] componentsInChildren3 = val4.GetComponentsInChildren<MeshFilter>();
				foreach (MeshFilter obj in componentsInChildren3)
				{
					((Component)obj).transform.localPosition = Vector3.zero;
					((Component)obj).transform.localRotation = Quaternion.identity;
				}
				Renderer[] componentsInChildren4 = val4.GetComponentsInChildren<Renderer>();
				if (componentsInChildren4.Length != 0)
				{
					Bounds bounds = componentsInChildren4[0].bounds;
					array3 = componentsInChildren4;
					foreach (Renderer val5 in array3)
					{
						((Bounds)(ref bounds)).Encapsulate(val5.bounds);
					}
					Transform transform = val4.transform;
					transform.localScale *= 0.22f / Mathf.Max(((Bounds)(ref bounds)).size.y, 0.01f);
					bounds = componentsInChildren4[0].bounds;
					array3 = componentsInChildren4;
					foreach (Renderer val6 in array3)
					{
						((Bounds)(ref bounds)).Encapsulate(val6.bounds);
					}
					Transform transform2 = val4.transform;
					transform2.position -= Vector3.up * (((Bounds)(ref bounds)).min.y - ((Component)this).transform.position.y);
				}
				val4.transform.localRotation = Quaternion.Euler(0f, 90f, 0f);
				if (componentsInChildren4.Length != 0)
				{
					Bounds bounds2 = componentsInChildren4[0].bounds;
					array3 = componentsInChildren4;
					foreach (Renderer val7 in array3)
					{
						((Bounds)(ref bounds2)).Encapsulate(val7.bounds);
					}
					cupLocalCentre = tankard.InverseTransformPoint(((Bounds)(ref bounds2)).center);
					cupBottom = ((Bounds)(ref bounds2)).min.y - tankard.position.y;
				}
				((Component)tankard).gameObject.SetActive(false);
			}
			SkinnedMeshRenderer[] componentsInChildren5 = ((Component)wizard).GetComponentsInChildren<SkinnedMeshRenderer>();
			for (int i = 0; i < componentsInChildren5.Length; i++)
			{
				componentsInChildren5[i].updateWhenOffscreen = true;
			}
			Shader shader = Shader.Find("Custom/Creature") ?? Shader.Find("Standard");
			array3 = ((Component)this).GetComponentsInChildren<Renderer>();
			foreach (Renderer val8 in array3)
			{
				if (((Component)val8).transform.IsChildOf(pack.Find("BackpackLantern")))
				{
					continue;
				}
				val8.sharedMaterials = val8.sharedMaterials.Select(delegate(Material m)
				{
					//IL_0001: Unknown result type (might be due to invalid IL or missing references)
					//IL_0007: Expected O, but got Unknown
					Material val16 = new Material(m);
					if (Object.op_Implicit((Object)(object)shader))
					{
						val16.shader = shader;
					}
					return val16;
				}).ToArray();
			}
			Vector3[] array4 = bones.Select((Transform t) => t.localPosition).ToArray();
			Quaternion[] array5 = bones.Select((Transform t) => t.localRotation).ToArray();
			clips["SeatedIdle"].SampleAnimation(((Component)model).gameObject, 0f);
			array = new string[2] { "Left", "Right" };
			foreach (string text2 in array)
			{
				Transform val9 = rig[text2 + "Hand"];
				Vector3 val10 = rig[text2 + "HandMiddle1"].position - val9.position;
				Vector3 normalized = ((Vector3)(ref val10)).normalized;
				Vector3 val11 = rig[text2 + "HandIndex1"].position - rig[text2 + "HandPinky1"].position;
				Vector3 val12 = Vector3.Cross(normalized, val11) * (float)((text2 == "Right") ? 1 : (-1));
				val10 = Vector3.ProjectOnPlane(val12, normalized);
				val12 = ((Vector3)(ref val10)).normalized;
				palmFrames[text2] = Quaternion.LookRotation(val9.InverseTransformDirection(normalized), val9.InverseTransformDirection(val12));
			}
			componentsInChildren5 = ((Component)wizard).GetComponentsInChildren<SkinnedMeshRenderer>();
			foreach (SkinnedMeshRenderer val13 in componentsInChildren5)
			{
				Matrix4x4[] bindposes = val13.sharedMesh.bindposes;
				Dictionary<Transform, int> dictionary = val13.bones.Select((Transform bone, int index) => (bone: bone, index: index)).ToDictionary(((Transform bone, int index) pair) => pair.bone, ((Transform bone, int index) pair) => pair.index);
				for (int num = 0; num < val13.bones.Length; num++)
				{
					Transform val14 = val13.bones[num];
					if (((Object)val14).name.Contains("Hand") && ((Object)val14).name.Last() >= '1' && ((Object)val14).name.Last() <= '3' && dictionary.TryGetValue(val14.parent, out var value))
					{
						Dictionary<Transform, Quaternion> dictionary2 = fingerBind;
						Matrix4x4 val15 = bindposes[value] * ((Matrix4x4)(ref bindposes[num])).inverse;
						dictionary2[val14] = ((Matrix4x4)(ref val15)).rotation;
					}
				}
			}
			authoredBagGround = ((Component)this).transform.InverseTransformPoint(packAnchor.position);
			authoredStaffGround = ((Component)this).transform.InverseTransformPoint(staffAnchor.position);
			authoredPackRotation = Quaternion.Inverse(((Component)this).transform.rotation) * packAnchor.rotation * Quaternion.Euler(90f, 0f, 0f) * Quaternion.Euler(0f, 180f, 0f);
			authoredStaffRotation = Quaternion.Inverse(((Component)this).transform.rotation) * staffAnchor.rotation * Quaternion.Euler(90f, 0f, 0f);
			for (int num2 = 0; num2 < bones.Length; num2++)
			{
				bones[num2].localPosition = array4[num2];
				bones[num2].localRotation = array5[num2];
			}
			straps = new MerchantStraps(((Component)this).transform, pack, rig["LeftArm"], rig["RightArm"], rig["Spine2"], hips, ((Component)pack).GetComponentInChildren<Renderer>().sharedMaterial);
			CapsuleCollider obj2 = ((Component)this).gameObject.AddComponent<CapsuleCollider>();
			obj2.height = 1.7f;
			obj2.radius = 0.3f;
			obj2.center = Vector3.up * 0.9f;
			((Component)this).gameObject.AddComponent<MerchantAudio>();
		}

		private void OnDestroy()
		{
			straps?.Dispose();
			bodies.Remove(this);
		}

		public static bool Reserved(Chair chair)
		{
			ZNetView net = MerchantSeating.View(chair);
			if (!Object.op_Implicit((Object)(object)net) || !net.IsValid())
			{
				return false;
			}
			return bodies.Any((MerchantBody b) => Object.op_Implicit((Object)(object)b) && b.Data != null && b.Data.GetZDOID("tm.chair") == net.GetZDO().m_uid && Object.op_Implicit((Object)(object)chair.m_attachPoint) && Vector3.Distance(b.Data.GetVec3("tm.seat", Vector3.zero), chair.m_attachPoint.position) < 0.2f && (b.Data.GetFloat("tm.leave", 0f) == 0f || Server.Now - (double)b.Data.GetFloat("tm.leave", 0f) < 3.0));
		}

		private static float Ease(float x)
		{
			float num = Mathf.Clamp01(x);
			return num * num * num * (num * (num * 6f - 15f) + 10f);
		}

		private void SampleMotion(string name, float time, float walkClock)
		{
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: 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_027a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: Unknown result type (might be due to invalid IL or missing references)
			//IL_028f: 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_02b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_064e: Unknown result type (might be due to invalid IL or missing references)
			//IL_065c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0662: Unknown result type (might be due to invalid IL or missing references)
			//IL_067d: Unknown result type (might be due to invalid IL or missing references)
			//IL_068b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0691: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0403: Unknown result type (might be due to invalid IL or missing references)
			//IL_040e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0418: Unknown result type (might be due to invalid IL or missing references)
			//IL_041d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0428: Unknown result type (might be due to invalid IL or missing references)
			//IL_043d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0442: Unknown result type (might be due to invalid IL or missing references)
			//IL_0447: Unknown result type (might be due to invalid IL or missing references)
			//IL_044b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0452: Unknown result type (might be due to invalid IL or missing references)
			//IL_045e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0465: Unknown result type (might be due to invalid IL or missing references)
			//IL_047a: Unknown result type (might be due to invalid IL or missing references)
			//IL_047f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0483: Unknown result type (might be due to invalid IL or missing references)
			//IL_0488: Unknown result type (might be due to invalid IL or missing references)
			//IL_048f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0494: Unknown result type (might be due to invalid IL or missing references)
			//IL_0499: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_050f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0514: Unknown result type (might be due to invalid IL or missing references)
			//IL_051f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0529: Unknown result type (might be due to invalid IL or missing references)
			//IL_052e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0533: Unknown result type (might be due to invalid IL or missing references)
			//IL_0537: Unknown result type (might be due to invalid IL or missing references)
			//IL_053c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0544: Unknown result type (might be due to invalid IL or missing references)
			//IL_054b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0550: Unknown result type (might be due to invalid IL or missing references)
			//IL_0554: Unknown result type (might be due to invalid IL or missing references)
			//IL_0556: Unknown result type (might be due to invalid IL or missing references)
			//IL_0558: Unknown result type (might be due to invalid IL or missing references)
			//IL_055a: Unknown result type (might be due to invalid IL or missing references)
			//IL_055f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0563: Unknown result type (might be due to invalid IL or missing references)
			//IL_0568: Unknown result type (might be due to invalid IL or missing references)
			//IL_0575: Unknown result type (might be due to invalid IL or missing references)
			//IL_057a: Unknown result type (might be due to invalid IL or missing references)
			//IL_057f: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d1: Unknown result type (might be due to invalid IL or missing references)
			if (lastClip != name)
			{
				blendPositions = bones.Select((Transform t) => t.localPosition).ToArray();
				blendRotations = bones.Select((Transform t) => (!attentionApplied || !((Object)(object)t == (Object)(object)rig["Head"])) ? ((!attentionApplied || !(((Object)t).name == "mixamorig:Neck")) ? ((!attentionApplied || !(((Object)t).name == "mixamorig:Spine2")) ? t.localRotation : attentionSpineBase) : attentionNeckBase) : attentionHeadBase).ToArray();
				int num;
				switch (name)
				{
				case "Walk":
					num = ((lastClip == "StartWalk") ? 1 : 0);
					break;
				default:
					num = 0;
					break;
				case "Stop":
				case "StartWalk":
					num = 1;
					break;
				}
				bool flag = (byte)num != 0;
				transitionDuration = ((MerchantIdle.IsSeated(name) && MerchantIdle.IsSeated(lastClip) && name != "Toast") ? 0.85f : 0.45f);
				transition = ((lastClip == "" || flag) ? transitionDuration : 0f);
				lastClip = name;
			}
			object obj;
			string key;
			float num2;
			string[] array;
			switch (name)
			{
			case "Stop":
			case "StartWalk":
			{
				if (gaitPositions.Length != bones.Length)
				{
					gaitPositions = (Vector3[])(object)new Vector3[bones.Length];
					gaitRotations = (Quaternion[])(object)new Quaternion[bones.Length];
				}
				clips["StandingIdle"].SampleAnimation(((Component)model).gameObject, time % clips["StandingIdle"].length);
				for (int num6 = 0; num6 < bones.Length; num6++)
				{
					gaitPositions[num6] = bones[num6].localPosition;
					gaitRotations[num6] = bones[num6].localRotation;
				}
				clips["Walk"].SampleAnimation(((Component)model).gameObject, Mathf.Repeat(walkClock, 1.8f));
				float num7 = Mathf.Clamp01(time / 1.2f);
				float num8 = num7 * num7 * num7 * (num7 * (num7 * 6f - 15f) + 10f);
				float num9 = ((name == "Stop") ? (1f - num8) : num8);
				for (int num10 = 0; num10 < bones.Length; num10++)
				{
					if (!((Object)(object)bones[num10] == (Object)(object)wizard))
					{
						bones[num10].localPosition = Vector3.Lerp(gaitPositions[num10], bones[num10].localPosition, num9);
						bones[num10].localRotation = Quaternion.Slerp(gaitRotations[num10], bones[num10].localRotation, num9);
					}
				}
				break;
			}
			default:
				obj = name;
				goto IL_02f8;
			case "WalkEmpty":
				{
					obj = "Walk";
					goto IL_02f8;
				}
				IL_02f8:
				key = (string)obj;
				clips[key].SampleAnimation(((Component)model).gameObject, Mathf.Clamp(time, 0f, clips[key].length));
				if (!(name == "WalkEmpty"))
				{
					break;
				}
				num2 = time / 1.8f * (float)Math.PI * 2f;
				array = new string[2] { "Left", "Right" };
				foreach (string text in array)
				{
					float num4 = ((!(text == "Left")) ? 1 : (-1));
					Transform val = rig[text + "Arm"];
					Transform val2 = rig[text + "ForeArm"];
					Transform val3 = rig[text + "Hand"];
					Vector3 val4 = hips.position + wizard.right * (num4 * 0.29f) - wizard.up * 0.16f + wizard.forward * (num4 * 0.085f * Mathf.Sin(num2));
					float num5 = (Vector3.Distance(val.position, val2.position) + Vector3.Distance(val2.position, val3.position)) * 0.94f;
					val4 = val.position + Vector3.ClampMagnitude(val4 - val.position, num5);
					Solve(text + "Arm", text + "ForeArm", text + "Hand", val4, hips.position + wizard.right * (num4 * 0.6f) + wizard.forward * 0.1f);
					Vector3 val5 = -wizard.up + wizard.forward * 0.12f;
					Vector3 normalized = ((Vector3)(ref val5)).normalized;
					Vector3 val6 = wizard.right * num4;
					val5 = Vector3.ProjectOnPlane(val6, normalized);
					val3.rotation = Quaternion.LookRotation(normalized, ((Vector3)(ref val5)).normalized) * Quaternion.Inverse(palmFrames[text]);
				}
				foreach (KeyValuePair<Transform, Quaternion> item in fingerBind)
				{
					item.Key.localRotation = Quaternion.Slerp(item.Key.localRotation, item.Value, 0.65f);
				}
				break;
			}
			transition += Time.deltaTime;
			float num11 = Ease(transition / transitionDuration);
			if (num11 >= 1f)
			{
				return;
			}
			for (int num12 = 0; num12 < bones.Length; num12++)
			{
				if (!((Object)(object)bones[num12] == (Object)(object)wizard))
				{
					bones[num12].localPosition = Vector3.Lerp(blendPositions[num12], bones[num12].localPosition, num11);
					bones[num12].localRotation = Quaternion.Slerp(blendRotations[num12], bones[num12].localRotation, num11);
				}
			}
		}

		private void LateUpdate()
		{
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: 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_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: 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_01de: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_071e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0723: Unknown result type (might be due to invalid IL or missing references)
			//IL_073c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0741: Unknown result type (might be due to invalid IL or missing references)
			//IL_0749: Unknown result type (might be due to invalid IL or missing references)
			//IL_074e: Unknown result type (might be due to invalid IL or missing references)
			//IL_075d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0708: Unknown result type (might be due to invalid IL or missing references)
			//IL_070d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0711: Unknown result type (might be due to invalid IL or missing references)
			//IL_0716: Unknown result type (might be due to invalid IL or missing references)
			//IL_0493: Unknown result type (might be due to invalid IL or missing references)
			//IL_049b: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0815: Unknown result type (might be due to invalid IL or missing references)
			//IL_081a: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_07cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_07e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0778: Unknown result type (might be due to invalid IL or missing references)
			//IL_077d: Unknown result type (might be due to invalid IL or missing references)
			//IL_077f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0784: Unknown result type (might be due to invalid IL or missing references)
			//IL_0794: Unknown result type (might be due to invalid IL or missing references)
			//IL_0796: Unknown result type (might be due to invalid IL or missing references)
			//IL_079b: Unknown result type (might be due to invalid IL or missing references)
			//IL_07a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_07a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_07a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_08e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_08e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_08fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0908: Unknown result type (might be due to invalid IL or missing references)
			//IL_0913: Unknown result type (might be due to invalid IL or missing references)
			//IL_091e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0933: Unknown result type (might be due to invalid IL or missing references)
			//IL_0947: Unknown result type (might be due to invalid IL or missing references)
			//IL_094c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0955: Unknown result type (might be due to invalid IL or missing references)
			//IL_095a: Unknown result type (might be due to invalid IL or missing references)
			//IL_095c: Unknown result type (might be due to invalid IL or missing references)
			//IL_096c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0976: Unknown result type (might be due to invalid IL or missing references)
			//IL_098c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0999: Unknown result type (might be due to invalid IL or missing references)
			//IL_09a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_09a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_09b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_09b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_09b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b3e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b43: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b47: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b49: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b5a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b5c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b5e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b63: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b65: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b6a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b6c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b71: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b79: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b7b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b7e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b83: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b88: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b8d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b92: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b94: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b96: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b98: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b9b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ba0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ba5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0baa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0baf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bb1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bb8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bbf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bc4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bcd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bd2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bd4: Unknown result type (might be due to invalid IL or missing references)
			//IL_085a: Unknown result type (might be due to invalid IL or missing references)
			//IL_085f: Unknown result type (might be due to invalid IL or missing references)
			//IL_086a: Unknown result type (might be due to invalid IL or missing references)
			//IL_086f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0872: Unknown result type (might be due to invalid IL or missing references)
			//IL_0877: Unknown result type (might be due to invalid IL or missing references)
			//IL_087c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0881: Unknown result type (might be due to invalid IL or missing references)
			//IL_0886: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c03: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c0d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c18: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c22: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c27: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c34: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c39: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c47: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c4c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c50: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c55: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c5a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c5c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c61: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c63: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c65: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c6c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c71: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c97: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cab: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cb0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cc4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cc9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cce: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ce0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ceb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cf0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cf5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cf9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cfe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d00: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d02: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d07: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d0c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d0e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d13: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d15: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d1a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c8a: Unknown result type (might be due to invalid IL or missing references)
			//IL_08b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_08b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_08bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d35: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d3a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d53: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d58: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d63: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d66: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d79: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d25: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d27: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a22: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a27: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a29: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a36: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a46: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a4d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a58: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a65: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a6a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a75: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a7f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a84: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a89: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a8d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a95: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ad4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ad6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ada: Unknown result type (might be due to invalid IL or missing references)
			//IL_0adf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ae7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0af1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0afb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b00: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b0b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b18: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b1d: Unknown result type (might be due to invalid IL or missing references)
			//IL_08cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_08cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_08d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0daa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dad: Unknown result type (might be due to invalid IL or missing references)
			//IL_0db2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0db7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0db9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dbb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dc2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dc7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dcc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dd4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dd9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ddb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0de0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0de5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e1b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e20: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e24: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e29: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e2b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e36: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e3b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e40: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e45: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e55: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e5a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e6c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e71: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e73: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e7e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e83: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e88: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e8d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e92: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ea4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0eb6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ec1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ecb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ed0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ee6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0eeb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0eef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ef4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ef9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0efb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0efd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f04: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f09: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f19: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f1c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f2f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f45: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f59: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f5e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f6f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f82: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f87: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f8c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fa5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fa8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fad: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fc6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fc8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fcb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fd1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fd6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fdb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fe0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ff0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ff3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ff8: Unknown result type (might be due to invalid IL or missing references)
			//IL_105f: Unknown result type (might be due to invalid IL or missing references)
			//IL_1064: Unknown result type (might be due to invalid IL or missing references)
			//IL_1066: Unknown result type (might be due to invalid IL or missing references)
			//IL_1068: Unknown result type (might be due to invalid IL or missing references)
			//IL_106f: Unknown result type (might be due to invalid IL or missing references)
			//IL_1074: Unknown result type (might be due to invalid IL or missing references)
			//IL_1079: Unknown result type (might be due to invalid IL or missing references)
			//IL_10a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_10b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_10c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_10e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_10e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_11b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_11c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_11cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_11ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_11f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_120c: Unknown result type (might be due to invalid IL or missing references)
			//IL_1211: Unknown result type (might be due to invalid IL or missing references)
			//IL_1216: Unknown result type (might be due to invalid IL or missing references)
			//IL_1289: Unknown result type (might be due to invalid IL or missing references)
			//IL_129f: Unknown result type (might be due to invalid IL or missing references)
			//IL_12a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_12a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_12ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_12ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_1267: Unknown result type (might be due to invalid IL or missing references)
			//IL_126c: Unknown result type (might be due to invalid IL or missing references)
			ZDO data = Data;
			if (data == null || !Object.op_Implicit((Object)(object)wizard))
			{
				return;
			}
			if (routeRevision != data.GetInt("tm.routeRevision", 0))
			{
				path = Server.ReadPath(data);
				routeRevision = data.GetInt("tm.routeRevision", 0);
			}
			if (path.Count < 2)
			{
				return;
			}
			float num = data.GetFloat("tm.pause", 0f);
			float num2 = (float)(Server.Now - (double)data.GetFloat("tm.start", 0f)) - num;
			float num3 = data.GetFloat("tm.walk", 0f);
			float num4 = data.GetFloat("tm.leave", 0f);
			float num5 = data.GetFloat("tm.transfer", 0f);
			float num6 = 0f;
			float num7 = num2 - num3;
			bool flag = num4 > 0f;
			float num8 = (flag ? ((float)(Server.Now - (double)num4) - num) : 0f);
			bool flag2 = data.GetBool("tm.abort", false);
			bool flag3 = data.GetBool("tm.paused", false);
			float num9 = (flag2 ? data.GetFloat("tm.returnDelay", 2.4f) : MerchantMotion.DepartureFor(data));
			float num10 = ((flag ? (num8 - (flag2 ? num9 : (12.4f + 2f * num5))) : num2) + data.GetFloat("tm.gaitOffset", 0f)) * MerchantMotion.GaitRateFor(data);
			List<Vector3> list = path;
			if (flag)
			{
				list = new List<Vector3>(path);
				list.Reverse();
			}
			float num11 = (flag ? (Mathf.Max(0f, num8 - num9) * MerchantMotion.SpeedFor(data)) : (Mathf.Max(0f, num2) * MerchantMotion.SpeedFor(data)));
			Vector3 forward;
			Vector3 val = Server.Along(list, num11, out forward);
			Vector3 vec = data.GetVec3("tm.seat", path.Last());
			Quaternion quaternion = data.GetQuaternion("tm.rotation", Quaternion.identity);
			bool flag4 = (flag ? (num8 >= num9) : (num2 < num3));
			float num12 = 0f;
			float num13 = 0f;
			float num14 = 0f;
			float time = 0f;
			string clip;
			if (flag3)
			{
				val = data.GetVec3("tm.pausePosition", data.GetPosition());
				time = Mathf.Min((float)(Server.Now - (double)data.GetFloat("tm.waitStart", 0f)), 1.2f);
				clip = ((time < 1.2f) ? "Stop" : "StandingIdle");
			}
			else if (flag && flag2 && !flag4)
			{
				clip = ((num8 < 1.2f) ? "Stop" : "StartWalk");
				time = ((num8 < 1.2f) ? num8 : (num8 - 1.2f));
			}
			else if (flag4)
			{
				clip = "Walk";
				time = Mathf.Repeat(num10, 1.8f);
			}
			else
			{
				forward = quaternion * Vector3.forward;
				if (flag)
				{
					float num15 = num8 - 2.4f - num5;
					float num16 = num8 - 2.4f;
					if (num8 < 2.4f)
					{
						clip = "SeatedIdle";
						time = num8;
						num12 = (num13 = (num14 = 1f));
					}
					else if (num16 < 3f)
					{
						clip = "StandUp";
						time = num16;
						num12 = 1f - Ease(time / 3f);
						num13 = (num14 = 1f);
					}
					else if (num16 < 3f + num5)
					{
						clip = "WalkEmpty";
						num6 = Ease((num16 - 3f) / num5);
						time = Mathf.Repeat(num6 * num5 * MerchantMotion.GaitRateFor(data), 1.8f);
						num13 = (num14 = 1f);
					}
					else if (num15 < 5.5f)
					{
						clip = "PickupStaff";
						time = num15 - 3f;
						num6 = 1f;
						num13 = 1f;
						num14 = 1f - Ease(time / 2.5f);
					}
					else if (num15 < 10f)
					{
						clip = "EquipBackpack";
						time = num15 - 5.5f;
						num6 = 1f;
						num13 = Ease((1f - time / 4.5f - 0.25f) / 0.57f);
					}
					else if (num16 < 10f + 2f * num5)
					{
						clip = "Walk";
						num6 = 1f - Ease((num16 - 10f - num5) / num5);
						time = Mathf.Repeat((1f - num6) * num5 * MerchantMotion.GaitRateFor(data), 1.8f);
					}
					else
					{
						clip = "StartWalk";
						time = num16 - 10f - 2f * num5;
					}
					val = Vector3.Lerp(vec, path.Last(), 1f - num12);
				}
				else
				{
					float num17 = num7 - num5;
					if (num7 < 1.2f)
					{
						clip = "Stop";
						time = num7;
					}
					else if (num7 < 1.2f + num5)
					{
						clip = "Walk";
						num6 = Ease((num7 - 1.2f) / num5);
						time = Mathf.Repeat(num6 * num5 * MerchantMotion.GaitRateFor(data), 1.8f);
					}
					else if (num17 < 5.7f)
					{
						clip = "RemoveBackpack";
						time = num17 - 1.2f;
						num6 = 1f;
						num13 = Ease((time / 4.5f - 0.25f) / 0.57f);
					}
					else if (num17 < 8.2f)
					{
						clip = "PlaceStaff";
						time = num17 - 5.7f;
						num6 = 1f;
						num13 = 1f;
						num14 = Ease(time / 2.5f);
					}
					else if (num7 < 8.2f + 2f * num5)
					{
						clip = "WalkEmpty";
						num6 = 1f - Ease((num7 - 8.2f - num5) / num5);
						time = Mathf.Repeat((1f - num6) * num5 * MerchantMotion.GaitRateFor(data), 1.8f);
						num13 = (num14 = 1f);
					}
					else if (num7 < 11.2f + 2f * num5)
					{
						clip = "SitDown";
						time = num7 - 8.2f - 2f * num5;
						num12 = Ease(time / 3f);
						num13 = (num14 = 1f);
					}
					else
					{
						MerchantIdle.Select(num7 - 11.2f - 2f * num5, (uint)data.GetInt("tm.idleSeed", (int)data.GetFloat("tm.start", 0f)), out clip, out time);
						float num18 = Mathf.Repeat(num7 - MerchantMotion.SetupFor(data), 90f);
						if (data.GetBool("tm.cold", false) && num18 >= 22f && num18 < 34f)
						{
							clip = "SeatedIdle";
							time = Mathf.Repeat(num18, 12f);
						}
						float num19 = (float)(Server.Now - (double)data.GetFloat("tm.toast", -100f));
						if (num19 >= 0f && num19 < 5f)
						{
							clip = "Toast";
							time = num19;
						}
						num12 = (num13 = (num14 = 1f));
					}
					val = Vector3.Lerp(path.Last(), vec, num12);
				}
			}
			Vector3 val2 = Vector3.Lerp(((Component)this).transform.position, val, 1f - Mathf.Exp((0f - Time.deltaTime) * 12f));
			if (MerchantNavigation.Clear(((Component)this).transform.position, val2))
			{
				((Component)this).transform.position = val2;
			}
			Vector3 forward2;
			if (flag4 && !flag3)
			{
				Vector3 val3 = Server.Along(list, num11 + 0.65f, out forward2) - val;
				if (((Vector3)(ref val3)).sqrMagnitude > 0.01f)
				{
					forward2 = Vector3.ProjectOnPlane(val3, Vector3.up);
					forward = ((Vector3)(ref forward2)).normalized;
				}
			}
			if (((Vector3)(ref forward)).sqrMagnitude > 0.001f)
			{
				((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, Quaternion.LookRotation(forward), 1f - Mathf.Exp((0f - Time.deltaTime) * 5f));
			}
			wizard.localPosition = wizardRest;
			SampleMotion(clip, time, num10);
			Quaternion val4 = ((Component)this).transform.rotation;
			if ((clip == "Walk" || clip == "WalkEmpty") && !flag4 && num5 > 0f)
			{
				Vector3 val5 = data.GetVec3("tm.props", path.Last()) - (path.Last() + quaternion * authoredBagGround);
				val5.y = 0f;
				if (!(flag ? (num8 < 5.4f + num5) : (num7 < 1.2f + num5)))
				{
					val5 = -val5;
				}
				if (((Vector3)(ref val5)).sqrMagnitude > 0.001f)
				{
					val4 = Quaternion.LookRotation(val5);
				}
			}
			wizard.rotation = Quaternion.Slerp(wizard.rotation, val4, 1f - Mathf.Exp((0f - Time.deltaTime) * 5f));
			Vector3 val6 = Vector3.up * ((MerchantNavigation.Floor(((Component)this).transform.position, ((Component)this).transform.position.y) - ((Component)this).transform.position.y) * (1f - num12));
			Transform obj = wizard;
			obj.position += val6;
			float num20 = Mathf.Lerp(hips.position.y, vec.y + 0.55f, num12);
			Vector3 val7 = Vector3.up * (num20 - hips.position.y);
			Transform obj2 = wizard;
			obj2.position += val7;
			if (num12 > 0f)
			{
				string[] array = new string[2] { "Left", "Right" };
				foreach (string text in array)
				{
					float num21 = ((!(text == "Left")) ? 1 : (-1));
					Vector3 position = rig[text + "Foot"].position;
					Vector3 val8 = new Vector3(vec.x, path.Last().y + 0.1f, vec.z) + ((Component)this).transform.right * (num21 * 0.18f) + ((Component)this).transform.forward * 0.35f;
					val8.y = MerchantNavigation.Floor(val8, path.Last().y) + 0.1f;
					Solve(text + "UpLeg", text + "Leg", text + "Foot", Vector3.Lerp(position, val8, num12), val + ((Component)this).transform.forward + Vector3.up * 0.6f + ((Component)this).transform.right * (num21 * 0.18f));
				}
			}
			Vector3 val9 = path.Last();
			val9.y = MerchantNavigation.Floor(val9, val9.y);
			Vector3 val10 = val9 - val - val7 - val6;
			Vector3 vec2 = data.GetVec3("tm.props", val9 + quaternion * authoredBagGround);
			Vector3 val11 = vec2 - (val9 + quaternion * authoredBagGround);
			Vector3 val12 = val11 * 0.95f * num6;
			Transform obj3 = wizard;
			obj3.position += val12;
			UpdateAttention((!flag || (!flag2 && num8 < 2.4f)) && num12 > 0.95f, clip);
			Vector3 val13 = (Vector3.up * 0.2f + ((Component)this).transform.forward * 0.06f) * (1f - num13);
			pack.position = packAnchor.position + val10 * num13 + val13 + (val11 - val12) * num13;
			if (num13 >= 0.999f)
			{
				pack.position = vec2;
			}
			Quaternion val14 = packAnchor.rotation * Quaternion.Euler(90f, 0f, 0f) * Quaternion.Euler(0f, 180f, 0f);
			forward2 = rig["Spine2"].position - hips.position;
			Vector3 normalized = ((Vector3)(ref forward2)).normalized;
			Quaternion val15 = Quaternion.FromToRotation(val14 * Vector3.up, normalized) * val14;
			if (!carryRotationReady)
			{
				packCarryRotation = val15;
				carryRotationReady = true;
			}
			packCarryRotation = Quaternion.Slerp(packCarryRotation, val15, 1f - Mathf.Exp((0f - Time.deltaTime) * 7f));
			pack.rotation = Quaternion.Slerp(val14, packCarryRotation, (1f - num13) * 0.7f);
			FitPackAgainstTorso(num13);
			if (clip == "RemoveBackpack" || clip == "EquipBackpack")
			{
				Vector3 val16 = val13 + packFitOffset + (val11 - val12) * num13;
				Quaternion val17 = pack.rotation * Quaternion.Inverse(val14);
				Transform val18 = bones.First((Transform t) => ((Object)t).name == "BackpackGrip");
				val18.position = pack.position + val17 * (val18.position + val16 - pack.position);
				Vector3 target = pack.position + val17 * (rig["LeftHand"].position + val16 - pack.position);
				Solve("LeftArm", "LeftForeArm", "LeftHand", target, rig["LeftForeArm"].position + ((Component)this).transform.right * -0.15f);
			}
			staff.position = staffAnchor.position + val10 * num14 + (val11 - val12) * num14;
			pack.rotation = Quaternion.Slerp(val14, packCarryRotation, (1f - num13) * 0.7f);
			staff.rotation = staffAnchor.rotation * Quaternion.Euler(90f, 0f, 0f);
			Transform obj4 = staff;
			obj4.rotation *= Quaternion.AngleAxis(180f * (1f - num14), Vector3.up);
			if (num13 >= 0.999f)
			{
				pack.rotation = quaternion * authoredPackRotation;
			}
			if (num14 >= 0.999f)
			{
				staff.position = vec2 + quaternion * (authoredStaffGround - authoredBagGround);
				staff.rotation = quaternion * authoredStaffRotation;
			}
			if (clip == "PlaceStaff" || clip == "PickupStaff")
			{
				string[] array = new string[2] { "Left", "Right" };
				foreach (string text2 in array)
				{
					Vector3 target2 = rig[text2 + "Hand"].position + (val11 - val12) * num14;
					Solve(text2 + "Arm", text2 + "ForeArm", text2 + "Hand", target2, rig[text2 + "ForeArm"].position + ((Component)this).transform.right * ((text2 == "Left") ? (-0.15f) : 0.15f));
				}
			}
			FitWalkingStaff(flag4 && !flag3 && clip == "Walk", Mathf.Repeat(num10, 1.8f) / 1.8f);
			AvoidGroundedPack(num13, num12, clip);
			straps?.Update(num13);
			UpdateTankardDraw(clip, num12, num7 - MerchantMotion.SetupFor(data), flag);
			if (Object.op_Implicit((Object)(object)tankard))
			{
				((Component)tankard).gameObject.SetActive(!flag && num7 >= 11.2f + 2f * num5 + 0.55f);
				tankard.rotation = mugAnchor.rotation * Quaternion.Euler(90f, 0f, 0f);
				tankard.position = rig["RightHand"].position - tankard.rotation * new Vector3(0.28f, 0.11f, 0.025f);
			}
			UpdateVisitGestures(data, clip, num12, flag, num8, num7);
			CanTrade = !flag && !flag3 && num7 >= 11.2f + 2f * num5 && Vector3.Distance(((Component)this).transform.position, vec) < 0.15f;
			CapsuleCollider component = ((Component)this).GetComponent<CapsuleCollider>();
			component.center = Vector3.up * Mathf.Lerp(0.9f, 0.55f, num12) + val6 + val7;
			component.height = Mathf.Lerp(1.7f, 1.1f, num12);
		}

		private void UpdateVisitGestures(ZDO data, string clip, float seated, bool departing, float departure, float arrival)
		{
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: 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)
			//IL_017b: 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_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: 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_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: 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_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: 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_0279: Unknown result type (might be due to invalid IL or missing references)
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0283: Unknown result type (might be due to invalid IL or missing references)
			//IL_029a: Unknown result type (might be due to invalid IL or missing references)
			//IL_029f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_0319: Unknown result type (might be due to invalid IL or missing references)
			//IL_031e: Unknown result type (might be due to invalid IL or missing references)
			//IL_033d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0342: Unknown result type (might be due to invalid IL or missing references)
			//IL_0347: Unknown result type (might be due to invalid IL or missing references)
			//IL_034f: Unknown result type (might be due to invalid IL or missing references)
			//IL_035a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0364: Unknown result type (might be due to invalid IL or missing references)
			//IL_0369: Unknown result type (might be due to invalid IL or missing references)
			//IL_0374: Unknown result type (might be due to invalid IL or missing references)
			//IL_037e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0383: Unknown result type (might be due to invalid IL or missing references)
			//IL_0388: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_03af: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03be: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0409: Unknown result type (might be due to invalid IL or missing references)
			//IL_040e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0416: Unknown result type (might be due to invalid IL or missing references)
			//IL_0426: Unknown result type (might be due to invalid IL or missing references)
			//IL_0431: Unknown result type (might be due to invalid IL or missing references)
			//IL_0445: Unknown result type (might be due to invalid IL or missing references)
			//IL_044a: Unknown result type (might be due to invalid IL or missing references)
			//IL_044f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0454: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_07cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_07e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_07e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0492: Unknown result type (might be due to invalid IL or missing references)
			//IL_0494: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0717: Unknown result type (might be due to invalid IL or missing references)
			//IL_071e: Unknown result type (might be due to invalid IL or missing references)
			//IL_072f: Unknown result type (might be due to invalid IL or missing references)
			//IL_04de: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0505: Unknown result type (might be due to invalid IL or missing references)
			//IL_0521: Unknown result type (might be due to invalid IL or missing references)
			//IL_0542: Unknown result type (might be due to invalid IL or missing references)
			//IL_055e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0573: Unknown result type (might be due to invalid IL or missing references)
			//IL_0578: Unknown result type (might be due to invalid IL or missing references)
			//IL_057c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0581: Unknown result type (might be due to invalid IL or missing references)
			//IL_0588: Unknown result type (might be due to invalid IL or missing references)
			//IL_058d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0592: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_05de: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0602: Unknown result type (might be due to invalid IL or missing references)
			//IL_0607: Unknown result type (might be due to invalid IL or missing references)
			//IL_060c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0616: Unknown result type (might be due to invalid IL or missing references)
			//IL_061b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0620: Unknown result type (might be due to invalid IL or missing references)
			//IL_0627: Unknown result type (might be due to invalid IL or missing references)
			//IL_062c: Unknown result type (might be due to invalid IL or missing references)
			//IL_064d: Unknown result type (might be due to invalid IL or missing references)
			//IL_064f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0656: Unknown result type (might be due to invalid IL or missing references)
			//IL_065b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0660: Unknown result type (might be due to invalid IL or missing references)
			//IL_0664: Unknown result type (might be due to invalid IL or missing references)
			//IL_0669: Unknown result type (might be due to invalid IL or missing references)
			//IL_066b: Unknown result type (might be due to invalid IL or missing references)
			//IL_066d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0672: Unknown result type (might be due to invalid IL or missing references)
			//IL_0674: Unknown result type (might be due to invalid IL or missing references)
			//IL_067b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0686: Unknown result type (might be due to invalid IL or missing references)
			//IL_068b: Unknown result type (might be due to invalid IL or missing references)
			//IL_068f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0694: Unknown result type (might be due to invalid IL or missing references)
			//IL_0696: Unknown result type (might be due to invalid IL or missing references)
			//IL_0698: Unknown result type (might be due to invalid IL or missing references)
			//IL_069a: Unknown result type (might be due to invalid IL or missing references)
			//IL_069c: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_06aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_06bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d6: Unknown result type (might be due to invalid IL or missing references)
			float num = Mathf.Repeat(arrival - MerchantMotion.SetupFor(data), 90f);
			int num2;
			float num3;
			if (!departing && seated > 0.99f && clip == "SeatedIdle" && data.GetBool("tm.cold", false) && num >= 22f)
			{
				num2 = ((num < 34f) ? 1 : 0);
				if (num2 != 0)
				{
					num3 = Ease(Mathf.Min((num - 23.4f) / 0.8f, (32.6f - num) / 0.8f));
					goto IL_007c;
				}
			}
			else
			{
				num2 = 0;
			}
			num3 = 0f;
			goto IL_007c;
			IL_007c:
			float num4 = num3;
			warmthWeight = Mathf.MoveTowards(warmthWeight, num4, Time.deltaTime * 0.8f);
			WarmingHands = warmthWeight > 0.1f;
			float num5 = ((num2 == 0) ? 0f : ((num < 23.4f) ? Ease((num - 22f) / 1.4f) : ((num < 32.6f) ? 1f : (1f - Ease((num - 32.6f) / 1.4f)))));
			if (warmthWeight > 0.1f)
			{
				num5 = 1f;
			}
			cupRestWeight = Mathf.MoveTowards(cupRestWeight, num5, Time.deltaTime * 1.3f);
			if (warmthWeight > 0f || cupRestWeight > 0f)
			{
				Transform val = rig["Spine1"];
				val.rotation = Quaternion.AngleAxis(5f * warmthWeight, ((Component)this).transform.right) * val.rotation;
				Vector3 val2 = (rig["LeftA