using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
using Mirror;
using UnityEngine;
using UnityEngine.Rendering;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("BigDart")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BigDart")]
[assembly: AssemblyTitle("BigDart")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace BigDart
{
internal static class DartConfig
{
internal static ConfigEntry<KeyCode> SmokeKey;
internal static ConfigEntry<float> SpeedMultiplier;
internal static ConfigEntry<float> BuffDurationSeconds;
internal static ConfigEntry<bool> DebugLog;
internal static void Init(ConfigFile config)
{
SmokeKey = config.Bind<KeyCode>("Smoking", "SmokeKey", (KeyCode)99, "press to light a dart, press again to stub it out");
SpeedMultiplier = config.Bind<float>("Buff", "SpeedMultiplier", 1.2f, "movement speed multiplier while the dart buzz lasts");
BuffDurationSeconds = config.Bind<float>("Buff", "BuffDurationSeconds", 600f, "how long the speed boost lasts after lighting up (seconds)");
DebugLog = config.Bind<bool>("Debug", "DebugLog", false, "Debugging");
}
}
public sealed class DartController : MonoBehaviour
{
private const float HeartbeatSeconds = 15f;
private const float AttachRetrySeconds = 1f;
private static bool _localSmoking;
private static uint _localNetId;
private static float _nextHeartbeatAt;
private static readonly Dictionary<uint, DartInstance> _instances = new Dictionary<uint, DartInstance>();
private static readonly HashSet<uint> _desired = new HashSet<uint>();
private static readonly Dictionary<uint, float> _nextAttachTry = new Dictionary<uint, float>();
private static readonly List<uint> _scratch = new List<uint>();
public DartController(IntPtr ptr)
: base(ptr)
{
}
private void Update()
{
if (!NetworkClient.active && !NetworkServer.active)
{
ResetAll();
return;
}
HandleInput();
PlayerCharacter val = FindLocalPlayer();
TickLocal(val);
TickInstances();
SpeedBuff.Tick(val);
}
private void HandleInput()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
if (Input.GetKeyDown(DartConfig.SmokeKey.Value))
{
if (_localSmoking)
{
StopSmokingLocal();
}
else
{
StartSmokingLocal();
}
}
}
private void StartSmokingLocal()
{
_localSmoking = true;
PlayerCharacter val = FindLocalPlayer();
SpeedBuff.StartOrRefresh(val);
if (IsAlive(val))
{
_localNetId = ((NetworkBehaviour)val.playerNetworking).netId;
DartNet.SendSetSmoking(_localNetId, smoking: true);
SetSmokingState(_localNetId, smoking: true);
}
_nextHeartbeatAt = Time.time + 15f;
if (DartConfig.DebugLog.Value)
{
Plugin.Logger.LogInfo((object)"BigDart: lit one up");
}
}
private void StopSmokingLocal()
{
_localSmoking = false;
PlayerCharacter val = FindLocalPlayer();
if (IsAlive(val))
{
_localNetId = ((NetworkBehaviour)val.playerNetworking).netId;
}
if (_localNetId != 0)
{
DartNet.SendSetSmoking(_localNetId, smoking: false);
SetSmokingState(_localNetId, smoking: false);
}
if (DartConfig.DebugLog.Value)
{
Plugin.Logger.LogInfo((object)"BigDart: stubbed it out");
}
}
private void TickLocal(PlayerCharacter local)
{
if (_localSmoking && IsAlive(local))
{
uint netId = ((NetworkBehaviour)local.playerNetworking).netId;
if (netId != _localNetId)
{
_localNetId = netId;
DartNet.SendSetSmoking(netId, smoking: true);
SetSmokingState(netId, smoking: true);
}
if (Time.time >= _nextHeartbeatAt)
{
_nextHeartbeatAt = Time.time + 15f;
DartNet.SendSetSmoking(_localNetId, smoking: true);
}
}
}
internal static void SetSmokingState(uint netId, bool smoking)
{
if (smoking)
{
_desired.Add(netId);
return;
}
_desired.Remove(netId);
if (_instances.TryGetValue(netId, out var value))
{
DartVisual.Detach(value);
_instances.Remove(netId);
}
}
private void TickInstances()
{
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Expected O, but got Unknown
_scratch.Clear();
foreach (uint item in _desired)
{
_scratch.Add(item);
}
bool flag = default(bool);
for (int i = 0; i < _scratch.Count; i++)
{
uint num = _scratch[i];
if ((_instances.TryGetValue(num, out var value) && !DartVisual.IsGone(value)) || (_nextAttachTry.TryGetValue(num, out var value2) && Time.time < value2))
{
continue;
}
_nextAttachTry[num] = Time.time + 1f;
PlayerCharacter pc = FindPlayerByNetId(num);
if (!IsAlive(pc))
{
continue;
}
DartInstance dartInstance = DartVisual.Attach(pc);
if (dartInstance == null)
{
continue;
}
_instances[num] = dartInstance;
if (DartConfig.DebugLog.Value)
{
ManualLogSource logger = Plugin.Logger;
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(23, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("BigDart: dart on netId ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<uint>(num);
}
logger.LogInfo(val);
}
}
_scratch.Clear();
foreach (KeyValuePair<uint, DartInstance> instance in _instances)
{
if (DartVisual.IsGone(instance.Value))
{
DartVisual.Detach(instance.Value);
_scratch.Add(instance.Key);
}
else
{
DartVisual.Tick(instance.Value);
}
}
for (int j = 0; j < _scratch.Count; j++)
{
_instances.Remove(_scratch[j]);
}
}
private static void ResetAll()
{
if (_instances.Count == 0 && !_localSmoking)
{
return;
}
foreach (KeyValuePair<uint, DartInstance> instance in _instances)
{
DartVisual.Detach(instance.Value);
}
_instances.Clear();
_desired.Clear();
_nextAttachTry.Clear();
_localSmoking = false;
_localNetId = 0u;
SpeedBuff.Reset();
}
internal static DartInstance FindInstance(PlayerCharacter pc)
{
if (!IsAlive(pc))
{
return null;
}
uint netId = ((NetworkBehaviour)pc.playerNetworking).netId;
_instances.TryGetValue(netId, out var value);
return value;
}
internal static PlayerCharacter FindLocalPlayer()
{
List<PlayerCharacter> allPlayerCharacters = PlayerCharacter.allPlayerCharacters;
if (allPlayerCharacters == null)
{
return null;
}
for (int i = 0; i < allPlayerCharacters.Count; i++)
{
PlayerCharacter val = allPlayerCharacters[i];
if (IsAlive(val) && ((NetworkBehaviour)val).isLocalPlayer)
{
return val;
}
}
return null;
}
private static PlayerCharacter FindPlayerByNetId(uint netId)
{
List<PlayerCharacter> allPlayerCharacters = PlayerCharacter.allPlayerCharacters;
if (allPlayerCharacters == null)
{
return null;
}
for (int i = 0; i < allPlayerCharacters.Count; i++)
{
PlayerCharacter val = allPlayerCharacters[i];
if (IsAlive(val) && ((NetworkBehaviour)val.playerNetworking).netId == netId)
{
return val;
}
}
return null;
}
private static bool IsAlive(PlayerCharacter pc)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
return (Object)pc != (Object)null;
}
}
internal static class DartNet
{
private const ushort FunctionHash = 55847;
private const uint Magic = 1145131604u;
private const byte ProtocolVersion = 1;
private const byte PacketSetSmoking = 1;
private static MethodInfo _bufferRpc;
internal static void Install(Harmony harmony)
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Expected O, but got Unknown
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Expected O, but got Unknown
harmony.Patch((MethodBase)AccessTools.Method(typeof(NetworkServer), "OnCommandMessage", (Type[])null, (Type[])null), new HarmonyMethod(typeof(DartNet), "HandleCommand", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
harmony.Patch((MethodBase)AccessTools.Method(typeof(NetworkClient), "OnRPCMessage", (Type[])null, (Type[])null), new HarmonyMethod(typeof(DartNet), "HandleRpc", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
_bufferRpc = AccessTools.Method(typeof(NetworkConnectionToClient), "BufferRpc", new Type[2]
{
typeof(RpcMessage),
typeof(int)
}, (Type[])null);
if (_bufferRpc == null)
{
Plugin.Logger.LogError((object)"BigDart: NetworkConnectionToClient.BufferRpc not found; smoking will not sync.");
}
}
internal static void SendSetSmoking(uint smokerNetId, bool smoking)
{
if (NetworkServer.active)
{
RelayToAll(smokerNetId, smoking);
}
else if (NetworkClient.active && NetworkClient.connection != null)
{
NetworkWriterPooled val = NetworkWriterPool.Get();
try
{
NetworkWriterExtensions.WriteUShort((NetworkWriter)(object)val, NetworkMessages.GetId<CommandMessage>());
NetworkWriterExtensions.WriteUInt((NetworkWriter)(object)val, smokerNetId);
((NetworkWriter)val).WriteByte((byte)0);
NetworkWriterExtensions.WriteUShort((NetworkWriter)(object)val, (ushort)55847);
NetworkWriterExtensions.WriteBytesAndSize((NetworkWriter)(object)val, BuildPayload(smokerNetId, smoking));
NetworkClient.connection.Send(((NetworkWriter)val).ToArraySegment(), Channels.Reliable);
}
finally
{
NetworkWriterPool.Return(val);
}
}
}
private static Il2CppStructArray<byte> BuildPayload(uint smokerNetId, bool smoking)
{
NetworkWriterPooled val = NetworkWriterPool.Get();
try
{
NetworkWriterExtensions.WriteUInt((NetworkWriter)(object)val, 1145131604u);
((NetworkWriter)val).WriteByte((byte)1);
((NetworkWriter)val).WriteByte((byte)1);
NetworkWriterExtensions.WriteUInt((NetworkWriter)(object)val, smokerNetId);
((NetworkWriter)val).WriteByte(smoking ? ((byte)1) : ((byte)0));
return ((NetworkWriter)val).ToArray();
}
finally
{
NetworkWriterPool.Return(val);
}
}
private static bool ReadHeader(ArraySegment<byte> payload, out NetworkReader reader)
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Expected O, but got Unknown
reader = null;
if (payload.Count < 6)
{
return false;
}
reader = new NetworkReader(payload);
if (NetworkReaderExtensions.ReadUInt(reader) != 1145131604)
{
return false;
}
if (reader.ReadByte() != 1)
{
return false;
}
return reader.ReadByte() == 1;
}
private static bool ReadSetSmoking(NetworkReader reader, out uint smokerNetId, out bool smoking)
{
smokerNetId = 0u;
smoking = false;
if (reader.Remaining < 5)
{
return false;
}
smokerNetId = NetworkReaderExtensions.ReadUInt(reader);
smoking = reader.ReadByte() != 0;
return true;
}
private static bool HandleCommand(NetworkConnectionToClient conn, CommandMessage msg)
{
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Expected O, but got Unknown
if (msg.functionHash != 55847)
{
return true;
}
if (!ReadHeader(msg.payload, out var reader))
{
return false;
}
if (!ReadSetSmoking(reader, out var smokerNetId, out var smoking))
{
return false;
}
NetworkIdentity identity = ((NetworkConnection)conn).identity;
if ((Object)identity == (Object)null || identity.netId != msg.netId || smokerNetId != msg.netId)
{
return false;
}
RelayToAll(smokerNetId, smoking);
return false;
}
private static bool HandleRpc(RpcMessage message)
{
if (message.functionHash != 55847)
{
return true;
}
if (!ReadHeader(message.payload, out var reader))
{
return false;
}
if (!ReadSetSmoking(reader, out var smokerNetId, out var smoking))
{
return false;
}
DartController.SetSmokingState(smokerNetId, smoking);
return false;
}
private static void RelayToAll(uint smokerNetId, bool smoking)
{
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Expected O, but got Unknown
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Expected O, but got Unknown
if (_bufferRpc != null)
{
RpcMessage val = new RpcMessage
{
netId = smokerNetId,
componentIndex = 0,
functionHash = 55847,
payload = new ArraySegment<byte>((Il2CppArrayBase<byte>)(object)BuildPayload(smokerNetId, smoking))
};
Enumerator<int, NetworkConnectionToClient> enumerator = NetworkServer.connections.Values.GetEnumerator();
bool flag = default(bool);
while (enumerator.MoveNext())
{
NetworkConnectionToClient current = enumerator.Current;
if (!((NetworkConnection)current).isReady)
{
continue;
}
try
{
_bufferRpc.Invoke(current, new object[2]
{
val,
Channels.Reliable
});
}
catch (Exception ex)
{
ManualLogSource logger = Plugin.Logger;
BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(27, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("BigDart: relay to ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(((NetworkConnection)current).connectionId);
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" failed: ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message);
}
logger.LogWarning(val2);
}
}
}
if (NetworkClient.active)
{
DartController.SetSmokingState(smokerNetId, smoking);
}
}
}
internal static class DartSound
{
private static AudioClip _drag;
private static AudioClip _exhale;
private const string DragResource = "BigDart.sounds.drag.wav";
private const string ExhaleResource = "BigDart.sounds.exhale.wav";
internal static void Load()
{
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Expected O, but got Unknown
_drag = LoadClip("BigDart.sounds.drag.wav");
_exhale = LoadClip("BigDart.sounds.exhale.wav");
int num = 0;
if (IsAlive(_drag))
{
num++;
}
if (IsAlive(_exhale))
{
num++;
}
ManualLogSource logger = Plugin.Logger;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(25, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("BigDart: sounds loaded ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(num);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("/2");
}
logger.LogInfo(val);
}
internal static AudioSourceController DragStart(PlayerCharacter pc)
{
return Play(pc, LiveClip(ref _drag, "BigDart.sounds.drag.wav"));
}
internal static AudioSourceController Exhale(PlayerCharacter pc)
{
return Play(pc, LiveClip(ref _exhale, "BigDart.sounds.exhale.wav"));
}
private static bool IsAlive(AudioClip clip)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
if ((Object)clip != (Object)null)
{
return clip.samples > 0;
}
return false;
}
private static AudioClip LiveClip(ref AudioClip clip, string resource)
{
if (!IsAlive(clip))
{
clip = LoadClip(resource);
}
return clip;
}
internal static void Stop(AudioSourceController controller)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
if ((Object)controller != (Object)null)
{
controller.FadeOut(0.15f);
}
}
private static AudioSourceController Play(PlayerCharacter pc, AudioClip clip)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Expected O, but got Unknown
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Expected O, but got Unknown
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Expected O, but got Unknown
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Expected O, but got Unknown
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Expected O, but got Unknown
string text = null;
if ((Object)clip == (Object)null)
{
text = "clip null";
}
else if ((Object)pc == (Object)null)
{
text = "pc null";
}
else if ((Object)(object)pc.playerAudio == (Object)null)
{
text = "playerAudio null";
}
else if ((Object)pc.kernal == (Object)null)
{
text = "kernal null";
}
else if ((Object)pc.playerAudio.kickSound == (Object)null)
{
text = "kickSound null";
}
bool flag = default(bool);
if (text != null)
{
if (DartConfig.DebugLog.Value)
{
ManualLogSource logger = Plugin.Logger;
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(24, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("BigDart: sound skipped: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text);
}
logger.LogInfo(val);
}
return null;
}
AudioSourceController result = pc.playerAudio.kickSound.Play(pc.kernal.position, (Object)null, (IAudioRTPCXProvider)null, true, pc.kernal, 0.0, -1f, clip, (FuncOneOut<XAxisType, float, bool>)null, (List<IAudioVolume>)null, (Func<AudioRandomContainer, int>)null);
if (DartConfig.DebugLog.Value)
{
ManualLogSource logger2 = Plugin.Logger;
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(16, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("BigDart: played ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((Object)clip).name);
}
logger2.LogInfo(val);
}
return result;
}
private static AudioClip LoadClip(string resourceName)
{
//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
//IL_01b9: Expected O, but got Unknown
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Expected O, but got Unknown
bool flag = default(bool);
try
{
using Stream stream = typeof(DartSound).Assembly.GetManifestResourceStream(resourceName);
if (stream == null)
{
ManualLogSource logger = Plugin.Logger;
BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(38, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("BigDart: embedded resource ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(resourceName);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" not found.");
}
logger.LogWarning(val);
return null;
}
using BinaryReader binaryReader = new BinaryReader(stream);
if (new string(binaryReader.ReadChars(4)) != "RIFF")
{
return null;
}
binaryReader.ReadInt32();
if (new string(binaryReader.ReadChars(4)) != "WAVE" || new string(binaryReader.ReadChars(4)) != "fmt ")
{
return null;
}
int num = binaryReader.ReadInt32();
short num2 = binaryReader.ReadInt16();
short num3 = binaryReader.ReadInt16();
int num4 = binaryReader.ReadInt32();
binaryReader.ReadInt32();
binaryReader.ReadInt16();
short num5 = binaryReader.ReadInt16();
if (num > 16)
{
binaryReader.ReadBytes(num - 16);
}
if (new string(binaryReader.ReadChars(4)) != "data" || num2 != 1 || num5 != 16)
{
return null;
}
int num6 = binaryReader.ReadInt32() / 2;
float[] array = new float[num6];
for (int i = 0; i < num6; i++)
{
array[i] = (float)binaryReader.ReadInt16() / 32768f;
}
AudioClip obj = AudioClip.Create(resourceName, num6 / num3, (int)num3, num4, false);
obj.SetData(Il2CppStructArray<float>.op_Implicit(array), 0);
((Object)obj).hideFlags = (HideFlags)32;
return obj;
}
catch (Exception ex)
{
ManualLogSource logger2 = Plugin.Logger;
BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(25, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("BigDart: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(resourceName);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" decode failed: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
}
logger2.LogWarning(val);
return null;
}
}
}
internal sealed class DartInstance
{
internal PlayerCharacter pc;
internal Transform mouthAnchor;
internal Transform handAnchor;
internal bool hasHand;
internal GameObject root;
internal Transform filter;
internal Transform cig;
internal Transform ash;
internal Transform ember;
internal Material emberMat;
internal Light emberLight;
internal float burn;
internal SmokePuff[] smoke;
internal int smokeNext;
internal Vector3 emberBaseScale;
internal float currentInv = 1f;
internal bool atMouth;
internal float emberGlow;
internal float poseBlend;
internal bool viewPoseActive;
internal float nextWispAt;
internal float exhaleAt;
internal int exhalesLeft;
internal List<EyeTinted> eyeTints;
internal float nextEyeCheckAt;
internal Transform worldHandAnchor;
internal AudioSourceController sound;
internal float exhaleSoundAt;
}
internal sealed class EyeTinted
{
internal Material mat;
internal Color color;
internal Color emission;
}
internal struct SmokePuff
{
internal GameObject go;
internal Material mat;
internal Vector3 velocity;
internal float age;
internal float lifetime;
internal float wobblePhase;
internal float baseSize;
internal bool active;
}
internal static class DartVisual
{
private const float CigLength = 0.1f;
private const float CigRadius = 0.01f;
private const float FilterLength = 0.03f;
private const float AshLength = 0.012f;
private const float BurnSeconds = 240f;
private const float BurnKeepFraction = 0.53f;
private const float EmberLightRange = 0.35f;
private const float EmberLightIntensity = 1.2f;
private const float EmberLightBaseIntensity = 0.15f;
private static readonly Color EmberSmoulder = new Color(0.55f, 0.12f, 0.02f);
private static readonly Color EmberDrag = new Color(1f, 0.35f, 0.05f);
private const float HandForwardOffset = 0.05f;
private const float WispIntervalSeconds = 1.1f;
private const float SmokeLifetimeSeconds = 5f;
private const float SmokeRiseSpeed = 0.15f;
private const float SmokeAlpha = 0.66f;
private const int SmokePoolSize = 28;
private const float WispSize = 0.045f;
private const float PlumeSize = 0.07f;
private const float PlumeForwardSpeed = 0.4f;
private const float SmokeGrowTo = 2.5f;
private const float ExhaleSoundDelaySeconds = 1.8f;
private const float ExhaleDelaySeconds = 2.8f;
private const float EyeTintStrength = 0.25f;
private const string PuffTemplateName = "HeadPuffParticle";
private const string NoseFallbackName = "animatingNose";
private const string NoseMeshFallbackName = "nose_mesh";
private const int ExhaleBurstMin = 1;
private const int ExhaleBurstMax = 8;
private const float ExhaleSpacing = 0.4f;
private static Shader _unlit;
private static Mesh _quadMesh;
private static Material _puffTemplate;
private static Material _cigMaterial;
private static Material _filterMaterial;
private static Material _ashMaterial;
private static Material _emberMaterial;
private static Shader _lit;
private const float EyeCheckSeconds = 1f;
private static PropertyInfo _tpBodyActive;
private static bool _tpBodyActiveQueried;
private const float NightSaturation = 0.1f;
private const float DayAmbientMix = 0.35f;
private static Transform FindLip(PlayerCharacter pc)
{
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Expected O, but got Unknown
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Expected O, but got Unknown
if ((Object)(object)pc == (Object)null)
{
return null;
}
if (pc.lips != null)
{
Transform lipTransform = pc.lips.lipTransform;
if ((Object)lipTransform != (Object)null)
{
return lipTransform;
}
}
Transform kernal = pc.kernal;
if ((Object)kernal == (Object)null)
{
return null;
}
Il2CppArrayBase<Transform> componentsInChildren = ((Component)kernal).GetComponentsInChildren<Transform>(true);
Transform result = null;
for (int i = 0; i < componentsInChildren.Count; i++)
{
Transform val = componentsInChildren[i];
if (((Object)val).name == "animatingNose")
{
return val;
}
if (((Object)val).name == "nose_mesh")
{
result = val;
}
}
return result;
}
private static Shader GetUnlitShader()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
if ((Object)_unlit != (Object)null)
{
return _unlit;
}
_unlit = Shader.Find("Universal Render Pipeline/Unlit") ?? Shader.Find("Unlit/Color") ?? Shader.Find("UI/Default") ?? Shader.Find("Sprites/Default") ?? Shader.Find("Legacy Shaders/Diffuse");
return _unlit;
}
private static Shader GetLitShader()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
if ((Object)_lit != (Object)null)
{
return _lit;
}
_lit = Shader.Find("Universal Render Pipeline/Simple Lit") ?? Shader.Find("Universal Render Pipeline/Lit") ?? GetUnlitShader();
return _lit;
}
private static Material MakeMaterial(Color color)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
return MakeMaterial(color, GetUnlitShader());
}
private static Material MakeMaterial(Color color, Shader shader)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
if ((Object)shader == (Object)null)
{
return null;
}
Material val = new Material(shader);
val.color = color;
val.SetColor("_Color", color);
val.SetColor("_BaseColor", color);
if (val.HasFloat("_Smoothness"))
{
val.SetFloat("_Smoothness", 0.1f);
}
return val;
}
private static void DressPrimitive(GameObject go, Transform parent, Material mat, int layer)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Expected O, but got Unknown
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Expected O, but got Unknown
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Expected O, but got Unknown
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Expected O, but got Unknown
Collider component = go.GetComponent<Collider>();
if ((Object)component != (Object)null)
{
Object.Destroy((Object)component);
}
MeshRenderer component2 = go.GetComponent<MeshRenderer>();
if ((Object)component2 != (Object)null)
{
if ((Object)mat != (Object)null)
{
((Renderer)component2).sharedMaterial = mat;
}
((Renderer)component2).shadowCastingMode = (ShadowCastingMode)0;
}
go.layer = layer;
go.transform.SetParent(parent, false);
}
internal static DartInstance Attach(PlayerCharacter pc)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Expected O, but got Unknown
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Expected O, but got Unknown
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Expected O, but got Unknown
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Expected O, but got Unknown
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Expected O, but got Unknown
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Expected O, but got Unknown
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_0151: Unknown result type (might be due to invalid IL or missing references)
//IL_015d: Unknown result type (might be due to invalid IL or missing references)
//IL_0164: Expected O, but got Unknown
//IL_024e: Unknown result type (might be due to invalid IL or missing references)
//IL_0259: Expected O, but got Unknown
//IL_0297: Unknown result type (might be due to invalid IL or missing references)
//IL_029c: Unknown result type (might be due to invalid IL or missing references)
//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
//IL_0308: Unknown result type (might be due to invalid IL or missing references)
//IL_030d: 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_026c: Expected O, but got Unknown
//IL_0277: Unknown result type (might be due to invalid IL or missing references)
//IL_0282: Expected O, but got Unknown
Transform val = FindLip(pc);
if ((Object)val == (Object)null)
{
return null;
}
Transform val2 = null;
if (pc.gestures != null)
{
val2 = pc.gestures.RightHand;
}
bool flag = (Object)val2 != (Object)null;
if ((Object)_cigMaterial == (Object)null)
{
_cigMaterial = MakeMaterial(new Color(0.92f, 0.9f, 0.85f), GetLitShader());
}
if ((Object)_filterMaterial == (Object)null)
{
_filterMaterial = MakeMaterial(new Color(0.78f, 0.62f, 0.4f), GetLitShader());
}
if ((Object)_ashMaterial == (Object)null)
{
_ashMaterial = MakeMaterial(new Color(0.55f, 0.55f, 0.52f), GetLitShader());
}
if ((Object)_emberMaterial == (Object)null)
{
_emberMaterial = MakeMaterial(new Color(1f, 0.35f, 0.05f));
}
int layer = ((Component)val).gameObject.layer;
DartInstance dartInstance = new DartInstance
{
pc = pc,
mouthAnchor = val,
handAnchor = (flag ? val2 : val),
hasHand = flag,
emberBaseScale = new Vector3(0.019f, 0.009f, 0.019f)
};
GameObject val3 = new GameObject("BigDart");
val3.layer = layer;
dartInstance.root = val3;
GameObject val4 = GameObject.CreatePrimitive((PrimitiveType)2);
((Object)val4).name = "BigDartFilter";
DressPrimitive(val4, val3.transform, _filterMaterial, layer);
dartInstance.filter = val4.transform;
GameObject val5 = GameObject.CreatePrimitive((PrimitiveType)2);
((Object)val5).name = "BigDartBody";
DressPrimitive(val5, val3.transform, _cigMaterial, layer);
dartInstance.cig = val5.transform;
GameObject val6 = GameObject.CreatePrimitive((PrimitiveType)2);
((Object)val6).name = "BigDartAsh";
DressPrimitive(val6, val3.transform, _ashMaterial, layer);
dartInstance.ash = val6.transform;
GameObject val7 = GameObject.CreatePrimitive((PrimitiveType)0);
((Object)val7).name = "BigDartEmber";
DressPrimitive(val7, val3.transform, null, layer);
dartInstance.ember = val7.transform;
if ((Object)_emberMaterial != (Object)null)
{
dartInstance.emberMat = new Material(_emberMaterial);
MeshRenderer component = val7.GetComponent<MeshRenderer>();
if ((Object)component != (Object)null)
{
((Renderer)component).sharedMaterial = dartInstance.emberMat;
}
}
GameObject val8 = new GameObject("BigDartEmberLight")
{
layer = layer
};
val8.transform.SetParent(val3.transform, false);
Light val9 = val8.AddComponent<Light>();
val9.type = (LightType)2;
val9.color = new Color(1f, 0.45f, 0.15f);
val9.intensity = 0f;
val9.shadows = (LightShadows)0;
dartInstance.emberLight = val9;
InitSmoke(dartInstance, pc, layer);
Place(dartInstance, Vector3.zero, Vector3.zero, flag ? dartInstance.handAnchor : dartInstance.mouthAnchor);
if (pc.arms != null)
{
dartInstance.worldHandAnchor = pc.arms.rightHand;
}
dartInstance.nextWispAt = Time.time + NextWispDelay();
TintEyes(dartInstance);
return dartInstance;
}
private static void TintEyes(DartInstance instance)
{
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Expected O, but got Unknown
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Expected O, but got Unknown
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Expected O, but got Unknown
//IL_010c: Expected O, but got Unknown
//IL_0155: Unknown result type (might be due to invalid IL or missing references)
//IL_015a: Unknown result type (might be due to invalid IL or missing references)
//IL_0168: Unknown result type (might be due to invalid IL or missing references)
//IL_016d: Unknown result type (might be due to invalid IL or missing references)
//IL_016e: Unknown result type (might be due to invalid IL or missing references)
//IL_018f: Unknown result type (might be due to invalid IL or missing references)
//IL_0194: Unknown result type (might be due to invalid IL or missing references)
//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
if (instance.pc.playerEyes == null)
{
return;
}
Il2CppReferenceArray<Renderer> renderers = instance.pc.playerEyes.renderers;
if (renderers == null)
{
return;
}
int submeshIndex = instance.pc.playerEyes.submeshIndex;
float num = Mathf.Clamp01(0.25f);
Color val = default(Color);
((Color)(ref val))..ctor(1f, 1f - 0.5f * num, 1f - 0.4f * num);
if (instance.eyeTints == null)
{
instance.eyeTints = new List<EyeTinted>();
}
for (int i = 0; i < ((Il2CppArrayBase<Renderer>)(object)renderers).Length; i++)
{
Renderer val2 = ((Il2CppArrayBase<Renderer>)(object)renderers)[i];
if ((Object)val2 == (Object)null)
{
continue;
}
Il2CppReferenceArray<Material> sharedMaterials = val2.sharedMaterials;
if (sharedMaterials == null || submeshIndex < 0 || submeshIndex >= ((Il2CppArrayBase<Material>)(object)sharedMaterials).Length)
{
continue;
}
Material val3 = ((Il2CppArrayBase<Material>)(object)sharedMaterials)[submeshIndex];
if ((Object)val3 == (Object)null)
{
continue;
}
bool flag = false;
for (int j = 0; j < instance.eyeTints.Count; j++)
{
if ((Object)instance.eyeTints[j].mat == (Object)val3)
{
flag = true;
break;
}
}
if (!flag)
{
EyeTinted eyeTinted = new EyeTinted
{
mat = val3
};
if (val3.HasColor("_Color"))
{
eyeTinted.color = val3.GetColor("_Color");
val3.SetColor("_Color", eyeTinted.color * val);
}
if (val3.HasColor("_EmissionColor"))
{
eyeTinted.emission = val3.GetColor("_EmissionColor");
val3.SetColor("_EmissionColor", eyeTinted.emission * val);
}
instance.eyeTints.Add(eyeTinted);
}
}
}
private static void RestoreEyes(DartInstance instance)
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Expected O, but got Unknown
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
if (instance.eyeTints == null)
{
return;
}
for (int i = 0; i < instance.eyeTints.Count; i++)
{
EyeTinted eyeTinted = instance.eyeTints[i];
if (!((Object)eyeTinted.mat == (Object)null))
{
if (eyeTinted.mat.HasColor("_Color"))
{
eyeTinted.mat.SetColor("_Color", eyeTinted.color);
}
if (eyeTinted.mat.HasColor("_EmissionColor"))
{
eyeTinted.mat.SetColor("_EmissionColor", eyeTinted.emission);
}
}
}
instance.eyeTints.Clear();
}
private static void Place(DartInstance instance, Vector3 offsetMeters, Vector3 euler, Transform anchor)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
float num = (instance.currentInv = 1f / Mathf.Max(anchor.lossyScale.x, 0.001f));
Transform transform = instance.root.transform;
transform.SetParent(anchor, false);
transform.localPosition = offsetMeters * num;
transform.localRotation = Quaternion.Euler(euler);
transform.localScale = Vector3.one;
instance.cig.localRotation = Quaternion.identity;
instance.ember.localScale = instance.emberBaseScale * num;
LayoutSegments(instance);
}
private static void LayoutSegments(DartInstance instance)
{
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
//IL_0134: Unknown result type (might be due to invalid IL or missing references)
float currentInv = instance.currentInv;
float num = -0.05f;
float num2 = 0.058f * Mathf.Lerp(1f, 0.53f, instance.burn);
instance.filter.localScale = new Vector3(0.02f, 0.015f, 0.02f) * currentInv;
instance.filter.localPosition = new Vector3(0f, (num + 0.015f) * currentInv, 0f);
instance.cig.localScale = new Vector3(0.02f, num2 * 0.5f, 0.02f) * currentInv;
instance.cig.localPosition = new Vector3(0f, (num + 0.03f + num2 * 0.5f) * currentInv, 0f);
instance.ash.localScale = new Vector3(0.02f, 0.006f, 0.02f) * currentInv;
instance.ash.localPosition = new Vector3(0f, (num + 0.03f + num2 + 0.006f) * currentInv, 0f);
instance.ember.localPosition = new Vector3(0f, (num + 0.03f + num2 + 0.012f) * currentInv, 0f);
}
private static bool IsExternalCamera()
{
if (!_tpBodyActiveQueried)
{
_tpBodyActiveQueried = true;
Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
foreach (Assembly assembly in assemblies)
{
if (!(assembly.GetName().Name != "ThirdPerson"))
{
Type type = assembly.GetType("ThirdPerson.PlayerBody");
_tpBodyActive = ((type != null) ? type.GetProperty("Active") : null);
break;
}
}
}
if (_tpBodyActive != null)
{
return (bool)_tpBodyActive.GetValue(null);
}
return false;
}
private static void AimForward(DartInstance instance)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Expected O, but got Unknown
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Expected O, but got Unknown
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Expected O, but got Unknown
//IL_0062: Expected O, but got Unknown
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: Unknown result type (might be due to invalid IL or missing references)
//IL_011b: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: Unknown result type (might be due to invalid IL or missing references)
//IL_013a: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
Transform transform = ((Component)instance.pc).transform;
if ((Object)transform == (Object)null)
{
return;
}
Transform val = (IsExternalCamera() ? instance.worldHandAnchor : instance.handAnchor);
if (!((Object)val == (Object)null))
{
Transform transform2 = instance.root.transform;
if ((Object)transform2.parent != (Object)val)
{
transform2.SetParent(val, true);
}
if (IsExternalCamera())
{
Vector3 val2 = instance.pc.cameraTransform.forward;
val2.y = 0f;
val2 = ((((Vector3)(ref val2)).sqrMagnitude < 0.001f) ? transform.forward : ((Vector3)(ref val2)).normalized);
transform2.position = val.position + val2 * 0.05f;
transform2.rotation = Quaternion.LookRotation(val2, Vector3.up) * Quaternion.Euler(90f, 0f, 0f);
}
else
{
transform2.position = val.position + transform.forward * 0.05f;
transform2.rotation = Quaternion.LookRotation(transform.forward, transform.up) * Quaternion.Euler(90f, 0f, 0f);
}
}
}
private static bool InitSmokeAssets(PlayerCharacter pc)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected O, but got Unknown
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Expected O, but got Unknown
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Expected O, but got Unknown
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Expected O, but got Unknown
if ((Object)_puffTemplate != (Object)null)
{
return true;
}
Transform kernal = pc.kernal;
if ((Object)kernal == (Object)null)
{
return false;
}
Il2CppArrayBase<ParticleSystem> componentsInChildren = ((Component)kernal).GetComponentsInChildren<ParticleSystem>(true);
for (int i = 0; i < componentsInChildren.Count; i++)
{
if (!(((Object)componentsInChildren[i]).name != "HeadPuffParticle"))
{
Material sharedMaterial = ((Renderer)((Component)componentsInChildren[i]).GetComponent<ParticleSystemRenderer>()).sharedMaterial;
if ((Object)sharedMaterial == (Object)null)
{
break;
}
_puffTemplate = new Material(sharedMaterial.shader);
_puffTemplate.SetTexture("_MainTex", sharedMaterial.GetTexture("_MainTex"));
GameObject obj = GameObject.CreatePrimitive((PrimitiveType)5);
_quadMesh = obj.GetComponent<MeshFilter>().sharedMesh;
Object.Destroy((Object)obj);
return true;
}
}
Plugin.Logger.LogWarning((object)"BigDart: HeadPuffParticle not found on player prefab; smoke disabled.");
return false;
}
private static void InitSmoke(DartInstance instance, PlayerCharacter pc, int layer)
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Expected O, but got Unknown
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Expected O, but got Unknown
if (InitSmokeAssets(pc))
{
instance.smoke = new SmokePuff[28];
for (int i = 0; i < 28; i++)
{
GameObject val = new GameObject("BigDartPuff");
val.layer = layer;
val.AddComponent<MeshFilter>().sharedMesh = _quadMesh;
MeshRenderer obj = val.AddComponent<MeshRenderer>();
Material mat = (((Renderer)obj).sharedMaterial = new Material(_puffTemplate));
((Renderer)obj).shadowCastingMode = (ShadowCastingMode)0;
val.SetActive(false);
instance.smoke[i] = new SmokePuff
{
go = val,
mat = mat
};
}
}
}
private static void SpawnPuff(DartInstance instance, Vector3 origin, Vector3 velocity, float size, float lifetime)
{
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
if (instance.smoke != null)
{
int smokeNext = instance.smokeNext;
instance.smokeNext = (instance.smokeNext + 1) % instance.smoke.Length;
instance.smoke[smokeNext].age = 0f;
instance.smoke[smokeNext].lifetime = lifetime;
instance.smoke[smokeNext].velocity = velocity;
instance.smoke[smokeNext].wobblePhase = Random.value * 6.283f;
instance.smoke[smokeNext].baseSize = size;
instance.smoke[smokeNext].active = true;
instance.smoke[smokeNext].go.transform.position = origin;
instance.smoke[smokeNext].go.SetActive(true);
}
}
private static void TickSmoke(DartInstance instance, float dt)
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Expected O, but got Unknown
//IL_0119: Unknown result type (might be due to invalid IL or missing references)
//IL_011e: Unknown result type (might be due to invalid IL or missing references)
//IL_0128: Unknown result type (might be due to invalid IL or missing references)
//IL_0134: Unknown result type (might be due to invalid IL or missing references)
//IL_0139: Unknown result type (might be due to invalid IL or missing references)
//IL_015a: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: Unknown result type (might be due to invalid IL or missing references)
//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
//IL_01f3: 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_0204: Unknown result type (might be due to invalid IL or missing references)
//IL_022d: Unknown result type (might be due to invalid IL or missing references)
//IL_0238: Unknown result type (might be due to invalid IL or missing references)
//IL_0243: Expected O, but got Unknown
//IL_0289: Unknown result type (might be due to invalid IL or missing references)
//IL_028e: Unknown result type (might be due to invalid IL or missing references)
//IL_0293: Unknown result type (might be due to invalid IL or missing references)
//IL_0297: Unknown result type (might be due to invalid IL or missing references)
//IL_029e: Unknown result type (might be due to invalid IL or missing references)
//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
//IL_0249: Unknown result type (might be due to invalid IL or missing references)
//IL_024f: Unknown result type (might be due to invalid IL or missing references)
//IL_0254: Unknown result type (might be due to invalid IL or missing references)
//IL_0259: Unknown result type (might be due to invalid IL or missing references)
if (instance.smoke == null)
{
return;
}
Transform val = null;
List<PlayerCharacter> allPlayerCharacters = PlayerCharacter.allPlayerCharacters;
if (allPlayerCharacters != null)
{
for (int i = 0; i < allPlayerCharacters.Count; i++)
{
PlayerCharacter val2 = allPlayerCharacters[i];
if ((Object)val2 != (Object)null && ((NetworkBehaviour)val2).isLocalPlayer)
{
val = val2.cameraTransform;
break;
}
}
}
Color val4 = default(Color);
for (int j = 0; j < instance.smoke.Length; j++)
{
if (!instance.smoke[j].active)
{
continue;
}
instance.smoke[j].age += dt;
if (instance.smoke[j].age >= instance.smoke[j].lifetime)
{
instance.smoke[j].active = false;
instance.smoke[j].go.SetActive(false);
continue;
}
float num = instance.smoke[j].age / instance.smoke[j].lifetime;
instance.smoke[j].velocity = Vector3.Lerp(instance.smoke[j].velocity, Vector3.up * 0.15f, dt * 0.6f);
Transform transform = instance.smoke[j].go.transform;
transform.position += instance.smoke[j].velocity * dt + new Vector3(Mathf.Sin(instance.smoke[j].age * 1.9f + instance.smoke[j].wobblePhase), 0f, Mathf.Cos(instance.smoke[j].age * 1.6f + instance.smoke[j].wobblePhase * 1.3f)) * (0.05f * dt);
transform.localScale = Vector3.one * (instance.smoke[j].baseSize * Mathf.Lerp(1f, 2.5f, num));
if ((Object)val != (Object)null)
{
transform.rotation = Quaternion.LookRotation(transform.position - val.position);
}
float num2 = Mathf.Min(num * 8f, 1f) * (1f - num) * 0.66f;
Color val3 = SmokeTint(instance, transform.position);
((Color)(ref val4))..ctor(val3.r, val3.g, val3.b, num2);
instance.smoke[j].mat.SetColor("_TintColor", val4);
instance.smoke[j].mat.SetColor("_Color", val4);
}
}
private static void EmitPuff(ParticleSystem ps, Vector3 origin, Vector3 velocity, float sizeMeters, int count, Color tint, float alphaScale)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
float num = Mathf.Max(((Component)ps).transform.lossyScale.x, 0.001f);
float num2 = sizeMeters / num;
byte b = (byte)(Mathf.Clamp01(0.66f * alphaScale) * 255f);
Color32 val = default(Color32);
((Color32)(ref val))..ctor((byte)(Mathf.Clamp01(tint.r) * 255f), (byte)(Mathf.Clamp01(tint.g) * 255f), (byte)(Mathf.Clamp01(tint.b) * 255f), b);
for (int i = 0; i < count; i++)
{
Vector3 val2 = origin + Random.insideUnitSphere * (0.025f / num);
ps.Emit(val2, velocity, num2 * Random.Range(0.8f, 1.2f), 5f * Random.Range(0.85f, 1.15f), val);
}
}
private static Color SmokeTint(DartInstance instance, Vector3 origin)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Expected O, but got Unknown
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
Color ambientLight = RenderSettings.ambientLight;
float num = ambientLight.r * 0.3f + ambientLight.g * 0.5f + ambientLight.b * 0.2f;
float num2 = Mathf.Clamp01((num - 0.15f) / 0.35f);
Color val = Color.Lerp(new Color(num, num, num), ambientLight, 0.1f);
Color val2 = Color.Lerp(Color.white, ambientLight, 0.35f);
Color val3 = Color.Lerp(val, val2, num2);
if ((Object)instance.emberLight != (Object)null && instance.emberLight.intensity > 0.001f)
{
float num3 = Vector3.Distance(origin, instance.ember.position);
float num4 = instance.emberLight.intensity * 0.8f / (1f + num3 * num3 * 400f);
val3 += instance.emberLight.color * Mathf.Min(num4, 0.9f);
}
val3.a = 1f;
return val3;
}
private static float NextWispDelay()
{
return 1.1f * Random.Range(0.75f, 1.25f);
}
internal static bool IsDragging(PlayerCharacter pc)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
if (pc.gestures == null)
{
return false;
}
PlayerGestures gestures = pc.gestures;
if (!gestures.rightArmPointing)
{
return gestures.rightArmWavingState.isActive;
}
return true;
}
internal static void Tick(DartInstance instance)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
//IL_01f3: Expected O, but got Unknown
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Expected O, but got Unknown
//IL_012b: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_013b: Unknown result type (might be due to invalid IL or missing references)
//IL_0140: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: Unknown result type (might be due to invalid IL or missing references)
//IL_0155: Unknown result type (might be due to invalid IL or missing references)
//IL_015b: Unknown result type (might be due to invalid IL or missing references)
//IL_0165: Unknown result type (might be due to invalid IL or missing references)
//IL_016a: Unknown result type (might be due to invalid IL or missing references)
//IL_016f: Unknown result type (might be due to invalid IL or missing references)
//IL_017e: Unknown result type (might be due to invalid IL or missing references)
//IL_0183: Unknown result type (might be due to invalid IL or missing references)
//IL_018b: Unknown result type (might be due to invalid IL or missing references)
//IL_0196: Unknown result type (might be due to invalid IL or missing references)
//IL_019c: Unknown result type (might be due to invalid IL or missing references)
//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
//IL_027b: Unknown result type (might be due to invalid IL or missing references)
//IL_0280: Unknown result type (might be due to invalid IL or missing references)
//IL_0291: Unknown result type (might be due to invalid IL or missing references)
//IL_029c: Expected O, but got Unknown
//IL_0206: Unknown result type (might be due to invalid IL or missing references)
//IL_020b: Unknown result type (might be due to invalid IL or missing references)
//IL_03f4: Unknown result type (might be due to invalid IL or missing references)
//IL_03ff: Expected O, but got Unknown
//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
//IL_043a: Unknown result type (might be due to invalid IL or missing references)
//IL_0445: Expected O, but got Unknown
//IL_0408: Unknown result type (might be due to invalid IL or missing references)
//IL_0413: Unknown result type (might be due to invalid IL or missing references)
//IL_042a: 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_04a0: Expected O, but got Unknown
//IL_0447: Unknown result type (might be due to invalid IL or missing references)
//IL_044c: Unknown result type (might be due to invalid IL or missing references)
//IL_0457: Unknown result type (might be due to invalid IL or missing references)
//IL_045c: Unknown result type (might be due to invalid IL or missing references)
//IL_0464: Unknown result type (might be due to invalid IL or missing references)
//IL_0476: 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_02b6: Unknown result type (might be due to invalid IL or missing references)
//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0303: Unknown result type (might be due to invalid IL or missing references)
//IL_030d: Unknown result type (might be due to invalid IL or missing references)
//IL_0312: Unknown result type (might be due to invalid IL or missing references)
//IL_04ea: Unknown result type (might be due to invalid IL or missing references)
//IL_050c: Unknown result type (might be due to invalid IL or missing references)
//IL_0534: Unknown result type (might be due to invalid IL or missing references)
if ((Object)instance.root == (Object)null || (Object)instance.pc == (Object)null)
{
return;
}
float time = Time.time;
bool flag = instance.hasHand && IsDragging(instance.pc);
if (flag && !instance.atMouth)
{
instance.atMouth = true;
DartSound.Stop(instance.sound);
instance.sound = DartSound.DragStart(instance.pc);
instance.exhaleAt = 0f;
instance.exhaleSoundAt = 0f;
instance.exhalesLeft = 0;
}
else if (!flag && instance.atMouth)
{
instance.atMouth = false;
DartSound.Stop(instance.sound);
instance.sound = null;
instance.exhaleSoundAt = time + 1.8f;
instance.exhaleAt = time + 2.8f;
instance.exhalesLeft = Random.Range(1, 9);
}
AimForward(instance);
if (((NetworkBehaviour)instance.pc).isLocalPlayer)
{
if (instance.poseBlend > 0.001f && !IsExternalCamera())
{
Transform cameraTransform = instance.pc.cameraTransform;
if ((Object)cameraTransform != (Object)null)
{
Vector3 val = cameraTransform.position + cameraTransform.forward * 0.28f + cameraTransform.up * -0.12f + cameraTransform.right * 0.06f;
Transform transform = instance.root.transform;
transform.position = Vector3.Lerp(transform.position, val, instance.poseBlend);
transform.rotation = Quaternion.Slerp(transform.rotation, cameraTransform.rotation * Quaternion.Euler(75f, 10f, 0f), instance.poseBlend);
instance.viewPoseActive = true;
}
}
else if (instance.viewPoseActive)
{
instance.viewPoseActive = false;
Transform anchor = (((Object)instance.worldHandAnchor != (Object)null) ? instance.worldHandAnchor : instance.handAnchor);
Place(instance, Vector3.zero, Vector3.zero, anchor);
}
}
if (instance.exhaleSoundAt > 0f && time >= instance.exhaleSoundAt)
{
instance.exhaleSoundAt = 0f;
DartSound.Stop(instance.sound);
instance.sound = DartSound.Exhale(instance.pc);
}
if (instance.exhaleAt > 0f && time >= instance.exhaleAt)
{
if (instance.smoke != null)
{
Vector3 val2 = Vector3.up;
Transform transform2 = ((Component)instance.pc).transform;
if ((Object)transform2 != (Object)null)
{
val2 = transform2.forward;
}
for (int i = 0; i < 3; i++)
{
SpawnPuff(instance, instance.mouthAnchor.position + Random.insideUnitSphere * 0.02f, val2 * 0.4f * Random.Range(0.75f, 1.25f) + Vector3.up * 0.1f + Random.insideUnitSphere * 0.08f, 0.07f * Random.Range(0.8f, 1.2f), 5f * Random.Range(0.85f, 1.15f));
}
}
instance.exhalesLeft--;
instance.exhaleAt = ((instance.exhalesLeft > 0) ? (time + 0.4f) : 0f);
}
if (instance.atMouth && instance.burn < 1f)
{
instance.burn = Mathf.Min(1f, instance.burn + Time.deltaTime / 240f);
LayoutSegments(instance);
}
float num = (instance.atMouth ? 1f : 0f);
instance.emberGlow = Mathf.MoveTowards(instance.emberGlow, num, 4f * Time.deltaTime);
if ((Object)instance.ember != (Object)null)
{
instance.ember.localScale = instance.emberBaseScale * instance.currentInv * (1f + 0.45f * instance.emberGlow);
}
if ((Object)instance.emberMat != (Object)null)
{
Color val3 = Color.Lerp(EmberSmoulder, EmberDrag, instance.emberGlow);
instance.emberMat.color = val3;
instance.emberMat.SetColor("_Color", val3);
instance.emberMat.SetColor("_BaseColor", val3);
}
if ((Object)instance.emberLight != (Object)null)
{
instance.emberLight.intensity = Mathf.Lerp(0.15f, 1.2f, instance.emberGlow);
instance.emberLight.range = 0.35f * instance.currentInv;
((Component)instance.emberLight).transform.localPosition = instance.ember.localPosition;
}
if (instance.smoke != null && time >= instance.nextWispAt)
{
SpawnPuff(instance, instance.ember.position, new Vector3(Random.Range(-0.02f, 0.02f), 0.15f, Random.Range(-0.02f, 0.02f)), 0.045f * Random.Range(0.8f, 1.2f), 5f * Random.Range(0.85f, 1.15f));
instance.nextWispAt = time + NextWispDelay();
}
TickSmoke(instance, Time.deltaTime);
if (time >= instance.nextEyeCheckAt)
{
instance.nextEyeCheckAt = time + 1f;
TintEyes(instance);
}
}
internal static void Detach(DartInstance instance)
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Expected O, but got Unknown
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected O, but got Unknown
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Expected O, but got Unknown
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Expected O, but got Unknown
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Expected O, but got Unknown
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Expected O, but got Unknown
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Expected O, but got Unknown
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Expected O, but got Unknown
if (instance == null)
{
return;
}
if ((Object)instance.root != (Object)null)
{
Object.Destroy((Object)instance.root);
}
if (instance.smoke != null)
{
for (int i = 0; i < instance.smoke.Length; i++)
{
if ((Object)instance.smoke[i].go != (Object)null)
{
Object.Destroy((Object)instance.smoke[i].go);
}
if ((Object)instance.smoke[i].mat != (Object)null)
{
Object.Destroy((Object)instance.smoke[i].mat);
}
}
instance.smoke = null;
}
DartSound.Stop(instance.sound);
instance.sound = null;
RestoreEyes(instance);
if ((Object)instance.emberMat != (Object)null)
{
Object.Destroy((Object)instance.emberMat);
}
instance.emberMat = null;
instance.root = null;
instance.ember = null;
instance.pc = null;
}
internal static bool IsGone(DartInstance instance)
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Expected O, but got Unknown
if (instance != null)
{
return (Object)instance.root == (Object)null;
}
return true;
}
}
[HarmonyPatch(typeof(PlayerArms), "LateUpdate")]
internal static class HandPosePatch
{
private const float BlendSpeed = 6f;
private const float PoleDistance = 0.15f;
private static void Postfix(PlayerArms __instance)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Expected O, but got Unknown
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Expected O, but got Unknown
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Expected O, but got Unknown
//IL_0284: Unknown result type (might be due to invalid IL or missing references)
//IL_028b: Unknown result type (might be due to invalid IL or missing references)
//IL_0295: 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_02a9: Unknown result type (might be due to invalid IL or missing references)
//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_011b: Expected O, but got Unknown
//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
//IL_01b3: Expected O, but got Unknown
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Unknown result type (might be due to invalid IL or missing references)
//IL_014e: Unknown result type (might be due to invalid IL or missing references)
//IL_0155: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: Unknown result type (might be due to invalid IL or missing references)
//IL_0164: Unknown result type (might be due to invalid IL or missing references)
//IL_0169: Unknown result type (might be due to invalid IL or missing references)
//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
//IL_018c: Unknown result type (might be due to invalid IL or missing references)
//IL_01ec: 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_01f1: Unknown result type (might be due to invalid IL or missing references)
//IL_01f3: 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_01fa: 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_0203: Unknown result type (might be due to invalid IL or missing references)
//IL_0208: Unknown result type (might be due to invalid IL or missing references)
//IL_0210: Unknown result type (might be due to invalid IL or missing references)
//IL_0215: Unknown result type (might be due to invalid IL or missing references)
//IL_021c: Unknown result type (might be due to invalid IL or missing references)
//IL_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_022d: Unknown result type (might be due to invalid IL or missing references)
//IL_0232: Unknown result type (might be due to invalid IL or missing references)
//IL_0237: 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_0246: Unknown result type (might be due to invalid IL or missing references)
//IL_024b: Unknown result type (might be due to invalid IL or missing references)
//IL_0263: Unknown result type (might be due to invalid IL or missing references)
List<PlayerCharacter> allPlayerCharacters = PlayerCharacter.allPlayerCharacters;
if (allPlayerCharacters == null)
{
return;
}
for (int i = 0; i < allPlayerCharacters.Count; i++)
{
PlayerCharacter val = allPlayerCharacters[i];
if ((Object)val == (Object)null || val.arms == null || ((Il2CppObjectBase)val.arms).Pointer != ((Il2CppObjectBase)__instance).Pointer)
{
continue;
}
DartInstance dartInstance = DartController.FindInstance(val);
if (dartInstance == null || !dartInstance.hasHand)
{
break;
}
bool flag = DartVisual.IsDragging(val);
if (val.poser != null && (Object)val.poser.playerHoldingMe != (Object)null)
{
flag = false;
}
if (val.hands != null && (Object)val.hands.heldProp != (Object)null)
{
flag = false;
}
dartInstance.poseBlend = Mathf.MoveTowards(dartInstance.poseBlend, flag ? 1f : 0f, 6f * Time.deltaTime);
if (dartInstance.poseBlend <= 0.001f)
{
break;
}
float poseBlend = dartInstance.poseBlend;
Transform transform = ((Component)val).transform;
if (((NetworkBehaviour)val).isLocalPlayer)
{
Transform cameraTransform = val.cameraTransform;
if ((Object)cameraTransform != (Object)null)
{
Vector3 target = cameraTransform.position + cameraTransform.forward * 0.28f + cameraTransform.up * -0.17f + cameraTransform.right * 0.06f;
PoseHand((val.gestures != null) ? val.gestures.RightHand : null, val.arms.localRightArmSpline, target, transform, poseBlend);
}
Vector3 val2 = (((Object)cameraTransform != (Object)null) ? cameraTransform.forward : transform.forward);
val2.y = 0f;
val2 = ((((Vector3)(ref val2)).sqrMagnitude < 0.001f) ? transform.forward : ((Vector3)(ref val2)).normalized);
Vector3 val3 = Vector3.Cross(Vector3.up, val2);
Vector3 normalized = ((Vector3)(ref val3)).normalized;
Vector3 target2 = dartInstance.mouthAnchor.position + val2 * 0.06f + normalized * 0.05f + Vector3.down * 0.03f;
PoseHand(val.arms.rightHand, val.arms.rightArmLimbSpline, target2, transform, poseBlend, 0.18f, 0.2f, 0.05f);
}
else
{
Vector3 target3 = dartInstance.mouthAnchor.position + transform.forward * 0.02f + Vector3.down * 0.03f;
PoseHand((val.gestures != null) ? val.gestures.RightHand : null, val.arms.rightArmLimbSpline, target3, transform, poseBlend);
}
break;
}
}
private static void PoseHand(Transform hand, LimbSpline spline, Vector3 target, Transform body, float blend, float poleOut = -1f, float poleDown = 0f, float poleFwd = 0f)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Expected O, but got Unknown
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Expected O, but got Unknown
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Expected O, but got Unknown
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Expected O, but got Unknown
//IL_0057: Expected O, but got Unknown
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Expected O, but got Unknown
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_011b: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: Unknown result type (might be due to invalid IL or missing references)
//IL_012d: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_013a: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: Unknown result type (might be due to invalid IL or missing references)
//IL_0142: Unknown result type (might be due to invalid IL or missing references)
if ((Object)hand == (Object)null || (Object)spline == (Object)null)
{
return;
}
hand.position = Vector3.Lerp(hand.position, target, blend);
Transform endTransform = spline.endTransform;
if ((Object)endTransform != (Object)null && (Object)endTransform != (Object)hand)
{
endTransform.position = hand.position;
}
Transform handleTransform = spline.handleTransform;
Transform startTransform = spline.startTransform;
if ((Object)handleTransform != (Object)null && (Object)startTransform != (Object)null)
{
Vector3 val;
if (poleOut >= 0f)
{
val = startTransform.position + body.right * poleOut + Vector3.down * poleDown + body.forward * poleFwd;
}
else
{
Vector3 val2 = (startTransform.position + hand.position) * 0.5f;
Vector3 val3 = Vector3.down * 0.7f + body.right * 0.4f;
Vector3 normalized = ((Vector3)(ref val3)).normalized;
val = val2 + normalized * 0.15f;
}
handleTransform.position = Vector3.Lerp(handleTransform.position, val, blend);
}
spline.Refresh();
}
}
[BepInPlugin("com.zaddish.bigdart", "BigDart", "1.1.0")]
public sealed class Plugin : BasePlugin
{
public const string Guid = "com.zaddish.bigdart";
public const string Name = "BigDart";
public const string Version = "1.1.0";
internal static ManualLogSource Logger;
public override void Load()
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Expected O, but got Unknown
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Expected O, but got Unknown
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Expected O, but got Unknown
Logger = ((BasePlugin)this).Log;
DartConfig.Init(new ConfigFile(Path.Combine(Paths.ConfigPath, "BigDart.cfg"), true));
ClassInjector.RegisterTypeInIl2Cpp<DartController>();
((BasePlugin)this).AddComponent<DartController>();
DartSound.Load();
Harmony val = new Harmony("com.zaddish.bigdart");
val.PatchAll(typeof(HandPosePatch));
DartNet.Install(val);
ManualLogSource logger = Logger;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(9, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("BigDart");
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("1.1.0");
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" loaded.");
}
logger.LogInfo(val2);
}
}
internal static class SpeedBuff
{
private static bool _active;
private static float _expiresAt;
private static PlayerCharacter _appliedTo;
private static float _forward;
private static float _sprint;
private static float _crouch;
private static float _crouchSprint;
private static float _swim;
private static float _swimSprint;
internal static void StartOrRefresh(PlayerCharacter pc)
{
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Expected O, but got Unknown
_expiresAt = Time.time + DartConfig.BuffDurationSeconds.Value;
if (!_active)
{
_active = true;
ApplyTo(pc);
}
else if (!IsAlive(_appliedTo))
{
ApplyTo(pc);
}
if (DartConfig.DebugLog.Value)
{
ManualLogSource logger = Plugin.Logger;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(20, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("BigDart: buzz until ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(_expiresAt, "F0");
}
logger.LogInfo(val);
}
}
internal static void Tick(PlayerCharacter localPlayer)
{
if (!_active)
{
return;
}
if (Time.time >= _expiresAt)
{
Restore();
_active = false;
_appliedTo = null;
if (DartConfig.DebugLog.Value)
{
Plugin.Logger.LogInfo((object)"BigDart: buzz over");
}
}
else if (IsAlive(localPlayer) && (!IsAlive(_appliedTo) || ((Il2CppObjectBase)localPlayer).Pointer != ((Il2CppObjectBase)_appliedTo).Pointer))
{
ApplyTo(localPlayer);
}
}
private static void ApplyTo(PlayerCharacter pc)
{
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Expected O, but got Unknown
if (!IsAlive(pc) || pc.tunings == null)
{
_appliedTo = null;
return;
}
PlayerTunings tunings = pc.tunings;
_forward = tunings.forwardSpeed;
_sprint = tunings.forwardSprintSpeed;
_crouch = tunings.crouchForwardSpeed;
_crouchSprint = tunings.crouchForwardSprintSpeed;
_swim = tunings.swimForwardSpeed;
_swimSprint = tunings.swimForwardSprintSpeed;
float value = DartConfig.SpeedMultiplier.Value;
tunings.forwardSpeed = _forward * value;
tunings.forwardSprintSpeed = _sprint * value;
tunings.crouchForwardSpeed = _crouch * value;
tunings.crouchForwardSprintSpeed = _crouchSprint * value;
tunings.swimForwardSpeed = _swim * value;
tunings.swimForwardSprintSpeed = _swimSprint * value;
_appliedTo = pc;
if (DartConfig.DebugLog.Value)
{
ManualLogSource logger = Plugin.Logger;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(19, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("BigDart: speed ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(_forward, "F2");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" -> ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(tunings.forwardSpeed, "F2");
}
logger.LogInfo(val);
}
}
private static void Restore()
{
if (IsAlive(_appliedTo) && _appliedTo.tunings != null)
{
PlayerTunings tunings = _appliedTo.tunings;
tunings.forwardSpeed = _forward;
tunings.forwardSprintSpeed = _sprint;
tunings.crouchForwardSpeed = _crouch;
tunings.crouchForwardSprintSpeed = _crouchSprint;
tunings.swimForwardSpeed = _swim;
tunings.swimForwardSprintSpeed = _swimSprint;
}
}
internal static void Reset()
{
if (_active)
{
Restore();
}
_active = false;
_appliedTo = null;
}
private static bool IsAlive(PlayerCharacter pc)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
return (Object)pc != (Object)null;
}
}
}