using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using Photon.Realtime;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("FrogSkill")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+424319de71a9e63daff24b6e6b3e0762732d7e23")]
[assembly: AssemblyProduct("FrogSkill")]
[assembly: AssemblyTitle("FrogSkill")]
[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.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 FrogSkill
{
internal sealed class ModConfig
{
public ConfigEntry<bool> Enabled { get; }
public ConfigEntry<KeyCode> ActivationKey { get; }
public ConfigEntry<float> MaxDistance { get; }
public ConfigEntry<float> PullForce { get; }
public ConfigEntry<float> LiftForce { get; }
public ConfigEntry<float> MaxHookDuration { get; }
public ConfigEntry<float> StopDistance { get; }
public ConfigEntry<float> ExtraDragOther { get; }
public ConfigEntry<float> ExtraDragLetGo { get; }
public ConfigEntry<float> Cooldown { get; }
public ModConfig(ConfigFile config)
{
Enabled = config.Bind<bool>("General", "Enabled", true, "Enable the Scout tongue skill.");
ActivationKey = config.Bind<KeyCode>("Controls", "ActivationKey", (KeyCode)103, "Fire or release the tongue.");
MaxDistance = BindRange(config, "Tongue", "MaxDistance", 40f, 5f, 60f, "Maximum target distance in meters. Vanilla FrogTongue default: 40.");
PullForce = BindRange(config, "Tongue", "PullForce", 450f, 0f, 2000f, "Directional pull acceleration before the vanilla distance curve. Current Frog prefab default: 450.");
LiftForce = BindRange(config, "Tongue", "LiftForce", 30f, 0f, 500f, "Additional upward acceleration per vertical meter. FrogSkill default: 30; set to 0 for no supplemental lift.");
MaxHookDuration = BindRange(config, "Tongue", "MaxHookDuration", 1f, 0.5f, 10f, "Vanilla-style maximum hook time in seconds, including the 0.5 second target-turn phase. Current Frog prefab default: 1.");
StopDistance = BindRange(config, "Tongue", "StopDistance", 5f, 1f, 10f, "Release when the target reaches this distance. Vanilla FrogTongue default: 5.");
ExtraDragOther = BindRange(config, "Tongue", "ExtraDragOther", 0.95f, 0f, 1f, "Velocity retention applied each physics frame while pulling. Vanilla FrogTongue default: 0.95.");
ExtraDragLetGo = BindRange(config, "Tongue", "ExtraDragLetGo", 0.1f, 0f, 1f, "Velocity retention applied once when releasing. Vanilla FrogTongue default: 0.1.");
Cooldown = BindRange(config, "Tongue", "Cooldown", 0.5f, 0f, 60f, "Cooldown between tongue shots.");
}
private static ConfigEntry<float> BindRange(ConfigFile config, string section, string key, float value, float min, float max, string description)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Expected O, but got Unknown
return config.Bind<float>(section, key, value, new ConfigDescription(description, (AcceptableValueBase)(object)new AcceptableValueRange<float>(min, max), Array.Empty<object>()));
}
}
[BepInPlugin("com.github.lllei.FrogSkill", "FrogSkill", "1.0.0")]
public sealed class Plugin : BaseUnityPlugin
{
public const string PluginGuid = "com.github.lllei.FrogSkill";
public const string PluginName = "FrogSkill";
private Harmony? _harmony;
internal static Plugin? Instance { get; private set; }
internal ModConfig Settings { get; private set; }
internal ManualLogSource ModLogger => ((BaseUnityPlugin)this).Logger;
private void Awake()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected O, but got Unknown
Instance = this;
Settings = new ModConfig(((BaseUnityPlugin)this).Config);
_harmony = new Harmony("com.github.lllei.FrogSkill");
_harmony.PatchAll(typeof(CharacterStartPatch));
((BaseUnityPlugin)this).Logger.LogInfo((object)"FrogSkill 1.0.0 loaded. All players must install the mod for multiplayer use.");
}
private void OnDestroy()
{
Harmony? harmony = _harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
Instance = null;
}
}
[HarmonyPatch(typeof(Character), "Start")]
internal static class CharacterStartPatch
{
private static void Postfix(Character __instance)
{
if ((Object)(object)((Component)__instance).GetComponent<ScoutTongue>() == (Object)null)
{
((Component)__instance).gameObject.AddComponent<ScoutTongue>();
}
((MonoBehaviourPun)__instance).photonView.RefreshRpcMonoBehaviourCache();
}
}
public sealed class ScoutTongue : MonoBehaviour
{
private const string FireRpc = "RPCA_FrogSkillFire";
private const string MissRpc = "RPCA_FrogSkillMiss";
private const string ReleaseRpc = "RPCA_FrogSkillRelease";
private const float TongueTravelDuration = 0.25f;
private const float MissExtendDuration = 0.12f;
private const float MissRetractDuration = 0.12f;
private const float MissDistanceRatio = 0.35f;
private const float VanillaTargetTurnDuration = 0.5f;
private const float NetworkMaxDistance = 65f;
private static readonly Vector3 FallbackMouthLocalOffset = new Vector3(0f, 0.82f, 0.16f);
private static readonly Color TongueColor = new Color(0.85f, 0.18f, 0.28f, 1f);
private Character _caster;
private Renderer? _mouthRenderer;
private Character? _target;
private Rigidbody? _targetRig;
private LineRenderer? _line;
private Material? _lineMaterial;
private float _firedAt;
private float _pullStartedAt;
private float _nextFireTime;
private Vector3 _missEndpoint;
private bool _missActive;
private bool _pulling;
private ModConfig Config => Plugin.Instance.Settings;
private void Awake()
{
_caster = ((Component)this).GetComponent<Character>();
AnimatedMouth component = ((Component)this).GetComponent<AnimatedMouth>();
_mouthRenderer = (((Object)(object)component != (Object)null) ? component.mouthRenderer : null);
if ((Object)(object)_mouthRenderer == (Object)null && (Object)(object)_caster.refs?.customization?.refs != (Object)null)
{
_mouthRenderer = _caster.refs.customization.refs.mouthRenderer;
}
CreateTongueVisual();
}
private void Update()
{
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0143: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)_target != (Object)null && !IsValidActiveTarget())
{
ReleaseOrClear();
}
UpdateTongueVisual();
if (!_caster.IsLocal || (Object)(object)Plugin.Instance == (Object)null || !Config.Enabled.Value || !CanReadInput() || !Input.GetKeyDown(Config.ActivationKey.Value))
{
return;
}
if ((Object)(object)_target != (Object)null)
{
SendRelease();
}
else
{
if (Time.time < _nextFireTime || !CanCasterAttack() || !TryGetAim(out Character target, out Vector3 endpoint))
{
return;
}
if ((Object)(object)target != (Object)null)
{
if (VanillaFrogDragProfile.TryGet(Plugin.Instance.ModLogger, out VanillaFrogDragProfile _))
{
_nextFireTime = Time.time + Config.Cooldown.Value;
((MonoBehaviourPun)_caster).photonView.RPC("RPCA_FrogSkillFire", (RpcTarget)0, new object[1] { ((MonoBehaviourPun)target).photonView.ViewID });
}
}
else
{
_nextFireTime = Time.time + Config.Cooldown.Value;
((MonoBehaviourPun)_caster).photonView.RPC("RPCA_FrogSkillMiss", (RpcTarget)0, new object[1] { endpoint });
}
}
}
private void FixedUpdate()
{
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: 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_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: 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_00c9: 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_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_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_017b: Unknown result type (might be due to invalid IL or missing references)
//IL_017d: Unknown result type (might be due to invalid IL or missing references)
//IL_017f: 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_0190: Unknown result type (might be due to invalid IL or missing references)
//IL_0192: Unknown result type (might be due to invalid IL or missing references)
//IL_01be: Unknown result type (might be due to invalid IL or missing references)
//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
if (!_pulling || (Object)(object)_target == (Object)null || (Object)(object)_targetRig == (Object)null)
{
return;
}
if ((Object)(object)Plugin.Instance == (Object)null || !Config.Enabled.Value || !IsValidActiveTarget())
{
ReleaseOrClear();
return;
}
Vector3 mouthPosition = GetMouthPosition();
Vector3 val = mouthPosition - _target.Center;
float magnitude = ((Vector3)(ref val)).magnitude;
if (!VanillaFrogDragProfile.TryGet(Plugin.Instance.ModLogger, out VanillaFrogDragProfile profile))
{
ReleaseOrClear();
return;
}
Vector3 val2 = ((magnitude > 0.001f) ? (val / magnitude) : Vector3.zero);
float num = profile.PullStrengthCurve.Evaluate(magnitude);
Vector3 val3 = val2 * Config.PullForce.Value * num;
Vector3 val4 = Vector3.up * Mathf.Clamp(val.y, 0f, profile.MaxLiftDistance) * Config.LiftForce.Value;
_target.refs.movement.ApplyExtraDrag(Config.ExtraDragOther.Value, true);
_target.data.sinceGrounded = Mathf.Clamp(_target.data.sinceGrounded, 0f, 1f);
if (((MonoBehaviourPun)_caster).photonView.IsMine)
{
_target.AddForceToBodyPart(_targetRig, (val3 + val4) * 0.2f, val3 + val4);
float num2 = Mathf.Max(Time.fixedDeltaTime, Config.MaxHookDuration.Value - 0.5f);
if (Vector3.Distance(mouthPosition, _targetRig.position) < Config.StopDistance.Value || Time.time - _pullStartedAt > num2)
{
SendRelease();
}
}
}
[PunRPC]
public void RPCA_FrogSkillFire(int targetViewId, PhotonMessageInfo info)
{
//IL_0001: 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_006d: Unknown result type (might be due to invalid IL or missing references)
if (IsOwnerMessage(info.Sender) && !((Object)(object)_target != (Object)null))
{
PhotonView val = PhotonView.Find(targetViewId);
Character val2 = (((Object)(object)val == (Object)null) ? null : ((Component)val).GetComponent<Character>());
if (IsPermittedTarget(val2) && !((Object)(object)Plugin.Instance == (Object)null) && VanillaFrogDragProfile.TryGet(Plugin.Instance.ModLogger, out VanillaFrogDragProfile _) && !(Vector3.Distance(_caster.Center, val2.Center) > 65f))
{
ClearMiss();
_target = val2;
_targetRig = val2.refs.ragdoll.partDict[(BodypartType)2].Rig;
_firedAt = Time.time;
_pulling = false;
((Renderer)_line).enabled = true;
}
}
}
[PunRPC]
public void RPCA_FrogSkillMiss(Vector3 endpoint, PhotonMessageInfo info)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: 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_0037: Unknown result type (might be due to invalid IL or missing references)
if (IsOwnerMessage(info.Sender) && !((Object)(object)_target != (Object)null) && !(Vector3.Distance(_caster.Center, endpoint) > 65f))
{
_missEndpoint = endpoint;
_firedAt = Time.time;
_missActive = true;
((Renderer)_line).enabled = true;
}
}
[PunRPC]
public void RPCA_FrogSkillRelease(PhotonMessageInfo info)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
if (IsOwnerMessage(info.Sender))
{
ClearTarget();
}
}
private bool TryGetAim(out Character? target, out Vector3 endpoint)
{
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: 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_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0100: 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)
target = null;
endpoint = default(Vector3);
Camera val = (((Object)(object)MainCamera.instance != (Object)null) ? ((Component)MainCamera.instance).GetComponent<Camera>() : Camera.main);
if ((Object)(object)val == (Object)null)
{
return false;
}
Ray val2 = val.ScreenPointToRay(new Vector3((float)Screen.width * 0.5f, (float)Screen.height * 0.5f));
float num = Config.MaxDistance.Value * 0.35f;
endpoint = ((Ray)(ref val2)).GetPoint(num);
RaycastHit[] array = Physics.RaycastAll(val2, Config.MaxDistance.Value, LayerMask.op_Implicit(HelperFunctions.GetMask((LayerType)7)));
RaycastHit val3 = default(RaycastHit);
float num2 = float.MaxValue;
RaycastHit[] array2 = array;
Character val5 = default(Character);
for (int i = 0; i < array2.Length; i++)
{
RaycastHit val4 = array2[i];
if (!((Object)(object)((RaycastHit)(ref val4)).collider == (Object)null) && !(((RaycastHit)(ref val4)).distance >= num2))
{
CharacterRagdoll.TryGetCharacterFromCollider(((RaycastHit)(ref val4)).collider, ref val5);
if (!((Object)(object)val5 == (Object)(object)_caster))
{
num2 = ((RaycastHit)(ref val4)).distance;
val3 = val4;
}
}
}
if ((Object)(object)((RaycastHit)(ref val3)).collider != (Object)null && ((RaycastHit)(ref val3)).distance < num)
{
endpoint = ((RaycastHit)(ref val3)).point;
}
Character val6 = default(Character);
if ((Object)(object)((RaycastHit)(ref val3)).collider == (Object)null || !CharacterRagdoll.TryGetCharacterFromCollider(((RaycastHit)(ref val3)).collider, ref val6) || !IsPermittedTarget(val6))
{
return true;
}
target = val6;
return true;
}
private bool IsValidActiveTarget()
{
if (IsPermittedTarget(_target) && (Object)(object)_targetRig != (Object)null)
{
return !_caster.data.dead;
}
return false;
}
private bool IsPermittedTarget(Character? target)
{
if ((Object)(object)target == (Object)null || (Object)(object)target == (Object)(object)_caster)
{
return false;
}
if ((target.isZombie || (!target.isBot && !target.isScoutmaster)) && (Object)(object)target.data != (Object)null && !target.data.dead && !target.data.fullyPassedOut && (Object)(object)target.refs?.ragdoll != (Object)null)
{
return target.refs.ragdoll.partDict.ContainsKey((BodypartType)2);
}
return false;
}
private bool CanCasterAttack()
{
if ((Object)(object)_caster.data != (Object)null && !_caster.data.dead && !_caster.data.fullyPassedOut)
{
return !_caster.warping;
}
return false;
}
private static bool CanReadInput()
{
if (Time.timeScale > 0f && (Object)(object)GUIManager.instance != (Object)null && !GUIManager.instance.windowBlockingInput)
{
return !GUIManager.instance.wheelActive;
}
return false;
}
private bool IsOwnerMessage(Player sender)
{
if (sender != null && ((MonoBehaviourPun)_caster).photonView.Owner != null)
{
return sender.ActorNumber == ((MonoBehaviourPun)_caster).photonView.Owner.ActorNumber;
}
return false;
}
private void SendRelease()
{
if ((Object)(object)((MonoBehaviourPun)_caster).photonView != (Object)null)
{
((MonoBehaviourPun)_caster).photonView.RPC("RPCA_FrogSkillRelease", (RpcTarget)0, Array.Empty<object>());
}
}
private void ReleaseOrClear()
{
if (((MonoBehaviourPun)_caster).photonView.IsMine)
{
SendRelease();
}
else
{
ClearTarget();
}
}
private void ClearTarget()
{
if (_pulling && (Object)(object)_target != (Object)null && (Object)(object)_target.refs?.movement != (Object)null)
{
float num = (((Object)(object)Plugin.Instance == (Object)null) ? 0.1f : Config.ExtraDragLetGo.Value);
_target.refs.movement.ApplyExtraDrag(num, true);
_target.data.sinceGrounded = 0f;
}
_pulling = false;
_targetRig = null;
_target = null;
if ((Object)(object)_line != (Object)null && !_missActive)
{
((Renderer)_line).enabled = false;
}
}
private void ClearMiss()
{
_missActive = false;
if ((Object)(object)_line != (Object)null && (Object)(object)_target == (Object)null)
{
((Renderer)_line).enabled = false;
}
}
private Vector3 GetMouthPosition()
{
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)_mouthRenderer != (Object)null)
{
Bounds bounds = _mouthRenderer.bounds;
return ((Bounds)(ref bounds)).center;
}
return _caster.refs.head.transform.TransformPoint(FallbackMouthLocalOffset);
}
private void CreateTongueVisual()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Expected O, but got Unknown
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Expected O, but got Unknown
GameObject val = new GameObject("FrogSkill Tongue");
val.transform.SetParent(((Component)this).transform, false);
_line = val.AddComponent<LineRenderer>();
_line.useWorldSpace = true;
_line.positionCount = 2;
_line.startWidth = 0.075f;
_line.endWidth = 0.035f;
_line.numCapVertices = 4;
Shader val2 = Shader.Find("Sprites/Default");
if ((Object)(object)val2 != (Object)null)
{
_lineMaterial = new Material(val2);
((Renderer)_line).material = _lineMaterial;
}
_line.startColor = TongueColor;
_line.endColor = TongueColor;
((Renderer)_line).enabled = false;
}
private void UpdateTongueVisual()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: 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_006c: 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_00c1: 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_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)_line == (Object)null || !((Renderer)_line).enabled)
{
return;
}
Vector3 mouthPosition = GetMouthPosition();
if (_missActive)
{
float num = Time.time - _firedAt;
float num2 = Mathf.Clamp01(num / 0.12f);
float num3 = Mathf.Clamp01((num - 0.12f) / 0.12f);
_line.SetPosition(0, mouthPosition);
_line.SetPosition(1, Vector3.Lerp(mouthPosition, _missEndpoint, num2 * (1f - num3)));
if (num3 >= 1f)
{
ClearMiss();
}
}
else if (!((Object)(object)_target == (Object)null))
{
float num4 = Mathf.Clamp01((Time.time - _firedAt) / 0.25f);
_line.SetPosition(0, mouthPosition);
_line.SetPosition(1, Vector3.Lerp(mouthPosition, _target.Center, num4));
if (num4 >= 1f && !_pulling)
{
BeginPull();
}
}
}
private void BeginPull()
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)_target == (Object)null)
{
return;
}
_pulling = true;
_pullStartedAt = Time.time;
Vector3 val = GetMouthPosition() - _target.Center;
val.y = 0f;
if (((Vector3)(ref val)).sqrMagnitude > 0.0001f)
{
_target.data.lookValues = Vector2.op_Implicit(DirectionToLook(((Vector3)(ref val)).normalized));
}
if (((MonoBehaviourPun)_target).photonView.IsMine)
{
_target.refs.climbing.StopAnyClimbing();
GamefeelHandler instance = GamefeelHandler.instance;
if (instance != null)
{
instance.AddPerlinShake(5f, 0.2f, 15f);
}
}
_target.RPCA_Fall(1f, 0f);
}
private static Vector3 DirectionToLook(Vector3 direction)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: 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)
Quaternion val = Quaternion.LookRotation(direction, Vector3.up);
Vector3 eulerAngles = ((Quaternion)(ref val)).eulerAngles;
while (eulerAngles.x > 180f)
{
eulerAngles.x -= 360f;
}
return new Vector3(eulerAngles.y, 0f - eulerAngles.x, 0f);
}
private void OnDestroy()
{
ClearTarget();
ClearMiss();
if ((Object)(object)_lineMaterial != (Object)null)
{
Object.Destroy((Object)(object)_lineMaterial);
}
}
}
internal sealed class VanillaFrogDragProfile
{
private const float RetryInterval = 5f;
private static VanillaFrogDragProfile? _cached;
private static float _nextSearchTime;
private static bool _missingLogged;
public AnimationCurve PullStrengthCurve { get; }
public float MaxLiftDistance { get; }
private VanillaFrogDragProfile(FrogTongue source)
{
PullStrengthCurve = CloneCurve(source.pullStrengthCurve);
MaxLiftDistance = source.maxLiftDistance;
}
public static bool TryGet(ManualLogSource logger, out VanillaFrogDragProfile profile)
{
if (_cached != null)
{
profile = _cached;
return true;
}
if (Time.unscaledTime < _nextSearchTime)
{
profile = null;
return false;
}
_nextSearchTime = Time.unscaledTime + 5f;
FrogTongue[] array = Resources.FindObjectsOfTypeAll<FrogTongue>();
foreach (FrogTongue val in array)
{
if (!((Object)(object)val == (Object)null) && val.pullStrengthCurve != null && val.pullStrengthCurve.length != 0)
{
_cached = new VanillaFrogDragProfile(val);
_missingLogged = false;
logger.LogInfo((object)("Captured vanilla FrogTongue drag profile from " + ((Object)((Component)val).gameObject).name + ": " + $"curve keys={_cached.PullStrengthCurve.length}, max lift distance={_cached.MaxLiftDistance}."));
profile = _cached;
return true;
}
}
if (!_missingLogged)
{
_missingLogged = true;
logger.LogWarning((object)"A loaded FrogTongue prefab was not found yet; tongue firing is unavailable until the vanilla pull curve can be captured.");
}
profile = null;
return false;
}
private static AnimationCurve CloneCurve(AnimationCurve source)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
return new AnimationCurve(source.keys)
{
preWrapMode = source.preWrapMode,
postWrapMode = source.postWrapMode
};
}
}
internal static class BuildInfo
{
internal const string Version = "1.0.0";
}
}