using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using ExitGames.Client.Photon;
using HarmonyLib;
using Photon.Pun;
using Photon.Realtime;
using UnityEngine;
using UnityEngine.SceneManagement;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Getting Yolked")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Getting Yolked")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("41234e88-2c24-4a63-8949-297cd0d3ef85")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[BepInPlugin("tony4twentys.Getting_Yolked", "Getting Yolked", "2.0.0")]
[BepInProcess("PEAK.exe")]
public class GettingYolkedPlugin : BaseUnityPlugin
{
[CompilerGenerated]
private sealed class <BoostStamina>d__75 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public Character character;
private float <boost>5__1;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <BoostStamina>d__75(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(0.25f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<boost>5__1 = syncedExtraStaminaFromEgg;
character.AddExtraStamina(<boost>5__1);
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <PeriodicFartingCoroutine>d__76 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public Character character;
private float <endTime>5__1;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <PeriodicFartingCoroutine>d__76(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
if ((Object)(object)character == (Object)null)
{
return false;
}
<endTime>5__1 = Time.time + syncedFartDuration;
break;
case 1:
<>1__state = -1;
break;
}
if (Time.time < <endTime>5__1 && (Object)(object)character != (Object)null && !character.data.dead)
{
if (Random.value < syncedFartChance)
{
TryFart(character);
}
<>2__current = (object)new WaitForSeconds(syncedFartCheckInterval);
<>1__state = 1;
return true;
}
Instance.activeFartingCoroutine = null;
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <RetryConfigSyncCoroutine>d__72 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public GettingYolkedPlugin <>4__this;
private int <attempts>5__1;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <RetryConfigSyncCoroutine>d__72(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Expected O, but got Unknown
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<attempts>5__1 = 0;
break;
case 1:
<>1__state = -1;
break;
case 2:
<>1__state = -1;
break;
}
while (<attempts>5__1 < 1)
{
<attempts>5__1++;
if (!PhotonNetwork.IsConnectedAndReady)
{
<>2__current = (object)new WaitForSeconds(1f);
<>1__state = 1;
return true;
}
<>4__this.AttemptConfigSync(forceSync: true);
if (<attempts>5__1 < 1)
{
<>2__current = (object)new WaitForSeconds(1f);
<>1__state = 2;
return true;
}
}
<>4__this.configSyncRetryCoroutine = null;
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
public static ConfigEntry<float> ExtraStaminaFromEgg;
public static ConfigEntry<bool> EnableExtraStamina;
public static ConfigEntry<bool> EnableFarting;
public static ConfigEntry<int> FartEggThreshold;
public static ConfigEntry<float> FartTimeWindow;
public static ConfigEntry<float> FartCheckInterval;
public static ConfigEntry<float> FartChance;
public static ConfigEntry<float> FartDuration;
public static ConfigEntry<bool> EnableClimbingSpeed;
public static ConfigEntry<float> CookedEggClimbingSpeedMultiplier;
public static ConfigEntry<float> CookedEggClimbingSpeedDuration;
public static ConfigEntry<bool> EnableJumpHeight;
public static ConfigEntry<float> CookedEggJumpHeightMultiplier;
public static ConfigEntry<float> CookedEggJumpHeightDuration;
public static ConfigEntry<bool> EnableSprintStaminaUsage;
public static ConfigEntry<float> RawEggSprintStaminaUsage;
public static ConfigEntry<float> RawEggSprintStaminaUsageDuration;
public static ConfigEntry<bool> EnableWeightReduction;
public static ConfigEntry<float> CookedEggWeightReductionMultiplier;
public static ConfigEntry<float> CookedEggWeightReductionDuration;
public static ConfigEntry<bool> EnableJumpStaminaUsage;
public static ConfigEntry<float> RawEggJumpStaminaUsage;
public static ConfigEntry<float> RawEggJumpStaminaUsageSprinting;
public static ConfigEntry<float> RawEggJumpStaminaUsageDuration;
internal static ManualLogSource Log;
internal static GettingYolkedPlugin Instance;
internal static float syncedExtraStaminaFromEgg;
internal static bool syncedEnableExtraStamina;
internal static bool syncedEnableFarting;
internal static int syncedFartEggThreshold;
internal static float syncedFartTimeWindow;
internal static float syncedFartCheckInterval;
internal static float syncedFartChance;
internal static float syncedFartDuration;
internal static bool syncedEnableClimbingSpeed;
internal static float syncedCookedEggClimbingSpeedMultiplier;
internal static float syncedCookedEggClimbingSpeedDuration;
internal static bool syncedEnableJumpHeight;
internal static float syncedCookedEggJumpHeightMultiplier;
internal static float syncedCookedEggJumpHeightDuration;
internal static bool syncedEnableSprintStaminaUsage;
internal static float syncedRawEggSprintStaminaUsage;
internal static float syncedRawEggSprintStaminaUsageDuration;
internal static bool syncedEnableJumpStaminaUsage;
internal static float syncedRawEggJumpStaminaUsage;
internal static float syncedRawEggJumpStaminaUsageSprinting;
internal static float syncedRawEggJumpStaminaUsageDuration;
internal static bool syncedEnableWeightReduction;
internal static float syncedCookedEggWeightReductionMultiplier;
internal static float syncedCookedEggWeightReductionDuration;
internal PhotonView view;
internal Coroutine configSyncRetryCoroutine;
private bool wasConnectedAndReady;
private bool wasMasterClient;
private bool wasInRoom;
internal const string ROOM_PROP_KEY = "GettingYolkedConfig";
internal const string HANDSHAKE_KEY = "GettingYolkedHandshake";
internal const int HANDSHAKE_VERSION = 1;
internal static bool isHandshakeValid;
private List<float> recentEggConsumptionTimes = new List<float>();
private Coroutine activeFartingCoroutine = null;
internal static float climbingSpeedBonusEndTime;
internal static float weightReductionEndTime;
internal static STATUSTYPE cachedWeightStatusType;
internal static Action<ItemSlot[]> itemsChangedHandler;
internal static float jumpHeightBonusEndTime;
private void Awake()
{
//IL_0506: Unknown result type (might be due to invalid IL or missing references)
//IL_050c: Expected O, but got Unknown
Instance = this;
Log = ((BaseUnityPlugin)this).Logger;
EnableExtraStamina = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EnableExtraStamina", true, "Enable extra stamina boost when eating eggs (vanilla default is 0.1).");
ExtraStaminaFromEgg = ((BaseUnityPlugin)this).Config.Bind<float>("General", "ExtraStaminaFromEgg", 0.2f, "Amount of stamina to restore when eating an egg (vanilla default is 0.1).");
EnableFarting = ((BaseUnityPlugin)this).Config.Bind<bool>("Farting", "EnableFarting", true, "Enable farting when eating too many eggs.");
FartEggThreshold = ((BaseUnityPlugin)this).Config.Bind<int>("Farting", "FartEggThreshold", 2, "Number of eggs that must be eaten within the time window to trigger farting.");
FartTimeWindow = ((BaseUnityPlugin)this).Config.Bind<float>("Farting", "FartTimeWindow", 60f, "Time window in seconds for egg consumption tracking. Eggs must be eaten within this time window to trigger farting (e.g., 60 = eggs must be eaten within 60 seconds of each other).");
FartCheckInterval = ((BaseUnityPlugin)this).Config.Bind<float>("Farting", "FartCheckInterval", 30f, "Interval in seconds between fart chance checks (e.g., 30 = check every 30 seconds).");
FartChance = ((BaseUnityPlugin)this).Config.Bind<float>("Farting", "FartChance", 0.3f, "Chance to fart on each check (0.3 = 30% chance, 0.5 = 50% chance).");
FartDuration = ((BaseUnityPlugin)this).Config.Bind<float>("Farting", "FartDuration", 300f, "Duration in seconds that the periodic farting will continue after triggering.");
EnableClimbingSpeed = ((BaseUnityPlugin)this).Config.Bind<bool>("Cooked Eggs", "EnableClimbingSpeed", true, "Enable climbing speed bonus when eating cooked eggs.");
CookedEggClimbingSpeedMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Cooked Eggs", "ClimbingSpeedMultiplier", 2f, "Multiplier for climbing speed when consuming cooked eggs (2.0 = double speed, 1.5 = 1.5x speed).");
CookedEggClimbingSpeedDuration = ((BaseUnityPlugin)this).Config.Bind<float>("Cooked Eggs", "ClimbingSpeedDuration", 30f, "Duration in seconds that the climbing speed bonus lasts after eating a cooked egg.");
EnableSprintStaminaUsage = ((BaseUnityPlugin)this).Config.Bind<bool>("Raw Eggs", "EnableSprintStaminaUsage", true, "Enable reduced sprint stamina usage when eating raw eggs.");
RawEggSprintStaminaUsage = ((BaseUnityPlugin)this).Config.Bind<float>("Raw Eggs", "SprintStaminaUsage", 0.01f, "Stamina usage per second while sprinting after eating raw eggs (default is 0.025, lower = less stamina drain).");
RawEggSprintStaminaUsageDuration = ((BaseUnityPlugin)this).Config.Bind<float>("Raw Eggs", "SprintStaminaUsageDuration", 30f, "Duration in seconds that the sprint stamina usage bonus lasts after eating a raw egg.");
EnableJumpStaminaUsage = ((BaseUnityPlugin)this).Config.Bind<bool>("Raw Eggs", "EnableJumpStaminaUsage", true, "Enable reduced jump stamina usage when eating raw eggs.");
RawEggJumpStaminaUsage = ((BaseUnityPlugin)this).Config.Bind<float>("Raw Eggs", "JumpStaminaUsage", 0.01f, "Jump stamina usage after eating raw eggs (vanilla is 0.05).");
RawEggJumpStaminaUsageSprinting = ((BaseUnityPlugin)this).Config.Bind<float>("Raw Eggs", "JumpStaminaUsageSprinting", 0.05f, "Jump stamina usage while sprinting after eating raw eggs (vanilla is 0.15).");
RawEggJumpStaminaUsageDuration = ((BaseUnityPlugin)this).Config.Bind<float>("Raw Eggs", "JumpStaminaUsageDuration", 30f, "Duration in seconds that the jump stamina usage reduction lasts after eating a raw egg.");
EnableJumpHeight = ((BaseUnityPlugin)this).Config.Bind<bool>("Cooked Eggs", "EnableJumpHeight", true, "Enable jump height bonus when eating cooked eggs.");
CookedEggJumpHeightMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Cooked Eggs", "JumpHeightMultiplier", 5f, "Multiplier for jump height when consuming cooked eggs (5.0 = 5x jump height, 2.0 = double jump height).");
CookedEggJumpHeightDuration = ((BaseUnityPlugin)this).Config.Bind<float>("Cooked Eggs", "JumpHeightDuration", 30f, "Duration in seconds that the jump height bonus lasts after eating a cooked egg.");
EnableWeightReduction = ((BaseUnityPlugin)this).Config.Bind<bool>("Cooked Eggs", "EnableWeightReduction", true, "Enable weight reduction when eating cooked eggs (items feel lighter).");
CookedEggWeightReductionMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Cooked Eggs", "WeightReductionMultiplier", 0.5f, "Multiplier for item weight when consuming cooked eggs (0.5 = half weight, 0.25 = quarter weight).");
CookedEggWeightReductionDuration = ((BaseUnityPlugin)this).Config.Bind<float>("Cooked Eggs", "WeightReductionDuration", 30f, "Duration in seconds that the weight reduction lasts after eating a cooked egg.");
syncedEnableExtraStamina = EnableExtraStamina.Value;
syncedExtraStaminaFromEgg = ExtraStaminaFromEgg.Value;
syncedEnableFarting = EnableFarting.Value;
syncedFartEggThreshold = FartEggThreshold.Value;
syncedFartTimeWindow = FartTimeWindow.Value;
syncedFartCheckInterval = FartCheckInterval.Value;
syncedFartChance = FartChance.Value;
syncedFartDuration = FartDuration.Value;
syncedEnableClimbingSpeed = EnableClimbingSpeed.Value;
syncedCookedEggClimbingSpeedMultiplier = CookedEggClimbingSpeedMultiplier.Value;
syncedCookedEggClimbingSpeedDuration = CookedEggClimbingSpeedDuration.Value;
syncedEnableJumpHeight = EnableJumpHeight.Value;
syncedCookedEggJumpHeightMultiplier = CookedEggJumpHeightMultiplier.Value;
syncedCookedEggJumpHeightDuration = CookedEggJumpHeightDuration.Value;
syncedEnableSprintStaminaUsage = EnableSprintStaminaUsage.Value;
syncedRawEggSprintStaminaUsage = RawEggSprintStaminaUsage.Value;
syncedRawEggSprintStaminaUsageDuration = RawEggSprintStaminaUsageDuration.Value;
syncedEnableJumpStaminaUsage = EnableJumpStaminaUsage.Value;
syncedRawEggJumpStaminaUsage = RawEggJumpStaminaUsage.Value;
syncedRawEggJumpStaminaUsageSprinting = RawEggJumpStaminaUsageSprinting.Value;
syncedRawEggJumpStaminaUsageDuration = RawEggJumpStaminaUsageDuration.Value;
syncedEnableWeightReduction = EnableWeightReduction.Value;
syncedCookedEggWeightReductionMultiplier = CookedEggWeightReductionMultiplier.Value;
syncedCookedEggWeightReductionDuration = CookedEggWeightReductionDuration.Value;
if (!PhotonNetwork.InRoom)
{
isHandshakeValid = true;
Log.LogInfo((object)"[Getting Yolked] Single player mode - handshake valid");
}
else if (PhotonNetwork.IsMasterClient)
{
isHandshakeValid = true;
Log.LogInfo((object)"[Getting Yolked] Host mode - handshake valid");
}
Harmony val = new Harmony("tony4twentys.getting_yolked");
val.PatchAll();
Log.LogInfo((object)"\ud83e\udd5a Getting Yolked mod initialized!");
SceneManager.activeSceneChanged += OnSceneChanged;
}
private void OnSceneChanged(Scene oldScene, Scene newScene)
{
if (configSyncRetryCoroutine != null)
{
((MonoBehaviour)this).StopCoroutine(configSyncRetryCoroutine);
configSyncRetryCoroutine = null;
}
configSyncRetryCoroutine = ((MonoBehaviour)this).StartCoroutine(RetryConfigSyncCoroutine());
}
private void Update()
{
bool isConnectedAndReady = PhotonNetwork.IsConnectedAndReady;
bool isMasterClient = PhotonNetwork.IsMasterClient;
bool inRoom = PhotonNetwork.InRoom;
if (isConnectedAndReady && !wasConnectedAndReady)
{
Log.LogInfo((object)"[Getting Yolked] PhotonNetwork became connected and ready - triggering sync");
AttemptConfigSync(forceSync: true);
}
if (!inRoom && wasInRoom)
{
Log.LogInfo((object)"[Getting Yolked] Left room - invalidating handshake");
isHandshakeValid = false;
}
if (inRoom && !wasInRoom)
{
Log.LogInfo((object)"[Getting Yolked] Joined room - triggering sync and handshake check");
isHandshakeValid = false;
AttemptConfigSync(forceSync: true);
}
if (isMasterClient && !wasMasterClient)
{
Log.LogInfo((object)"[Getting Yolked] Became master client - triggering sync");
isHandshakeValid = true;
AttemptConfigSync(forceSync: true);
}
wasConnectedAndReady = isConnectedAndReady;
wasMasterClient = isMasterClient;
wasInRoom = inRoom;
if (recentEggConsumptionTimes.Count > 0)
{
float currentTime = Time.time;
recentEggConsumptionTimes.RemoveAll((float time) => currentTime - time > syncedFartTimeWindow);
}
}
private void OnDestroy()
{
if (activeFartingCoroutine != null)
{
((MonoBehaviour)this).StopCoroutine(activeFartingCoroutine);
activeFartingCoroutine = null;
}
}
internal void AttemptConfigSync(bool forceSync = false)
{
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Expected O, but got Unknown
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Expected O, but got Unknown
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: Expected O, but got Unknown
//IL_0114: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Expected O, but got Unknown
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Expected O, but got Unknown
//IL_014a: Unknown result type (might be due to invalid IL or missing references)
//IL_0164: Expected O, but got Unknown
//IL_0165: Unknown result type (might be due to invalid IL or missing references)
//IL_017f: Expected O, but got Unknown
//IL_0180: Unknown result type (might be due to invalid IL or missing references)
//IL_019a: Expected O, but got Unknown
//IL_019b: Unknown result type (might be due to invalid IL or missing references)
//IL_01b5: Expected O, but got Unknown
//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
//IL_01d0: Expected O, but got Unknown
//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
//IL_01eb: Expected O, but got Unknown
//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
//IL_0206: Expected O, but got Unknown
//IL_0207: Unknown result type (might be due to invalid IL or missing references)
//IL_0221: Expected O, but got Unknown
//IL_0222: Unknown result type (might be due to invalid IL or missing references)
//IL_023c: Expected O, but got Unknown
//IL_023d: Unknown result type (might be due to invalid IL or missing references)
//IL_0257: Expected O, but got Unknown
//IL_0258: Unknown result type (might be due to invalid IL or missing references)
//IL_0272: Expected O, but got Unknown
//IL_0273: Unknown result type (might be due to invalid IL or missing references)
//IL_028d: Expected O, but got Unknown
//IL_028e: Unknown result type (might be due to invalid IL or missing references)
//IL_02a8: Expected O, but got Unknown
//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
//IL_02c3: Expected O, but got Unknown
//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
//IL_02de: Expected O, but got Unknown
//IL_02df: Unknown result type (might be due to invalid IL or missing references)
//IL_02f9: Expected O, but got Unknown
//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0314: Expected O, but got Unknown
//IL_0315: Unknown result type (might be due to invalid IL or missing references)
//IL_032f: Expected O, but got Unknown
//IL_0330: Unknown result type (might be due to invalid IL or missing references)
//IL_034a: Expected O, but got Unknown
//IL_034b: Unknown result type (might be due to invalid IL or missing references)
//IL_0365: Expected O, but got Unknown
//IL_0368: Expected O, but got Unknown
if (!PhotonNetwork.IsConnectedAndReady)
{
return;
}
if ((Object)(object)view == (Object)null)
{
try
{
view = ((Component)this).gameObject.GetComponent<PhotonView>();
if ((Object)(object)view == (Object)null)
{
view = ((Component)this).gameObject.AddComponent<PhotonView>();
}
if (view.ViewID == 0)
{
view.ViewID = 999998;
}
}
catch (Exception ex)
{
Log.LogWarning((object)("[Getting Yolked] Could not setup PhotonView: " + ex.Message));
return;
}
}
bool inRoom = PhotonNetwork.InRoom;
bool isMasterClient = PhotonNetwork.IsMasterClient;
if (isMasterClient && inRoom)
{
try
{
Hashtable val = new Hashtable();
((Dictionary<object, object>)val).Add((object)"GettingYolkedHandshake", (object)1);
((Dictionary<object, object>)val).Add((object)"GettingYolkedConfig_EnableExtraStamina", (object)EnableExtraStamina.Value);
((Dictionary<object, object>)val).Add((object)"GettingYolkedConfig_ExtraStaminaFromEgg", (object)ExtraStaminaFromEgg.Value);
((Dictionary<object, object>)val).Add((object)"GettingYolkedConfig_EnableFarting", (object)EnableFarting.Value);
((Dictionary<object, object>)val).Add((object)"GettingYolkedConfig_FartEggThreshold", (object)FartEggThreshold.Value);
((Dictionary<object, object>)val).Add((object)"GettingYolkedConfig_FartTimeWindow", (object)FartTimeWindow.Value);
((Dictionary<object, object>)val).Add((object)"GettingYolkedConfig_FartCheckInterval", (object)FartCheckInterval.Value);
((Dictionary<object, object>)val).Add((object)"GettingYolkedConfig_FartChance", (object)FartChance.Value);
((Dictionary<object, object>)val).Add((object)"GettingYolkedConfig_FartDuration", (object)FartDuration.Value);
((Dictionary<object, object>)val).Add((object)"GettingYolkedConfig_EnableClimbingSpeed", (object)EnableClimbingSpeed.Value);
((Dictionary<object, object>)val).Add((object)"GettingYolkedConfig_CookedEggClimbingSpeedMultiplier", (object)CookedEggClimbingSpeedMultiplier.Value);
((Dictionary<object, object>)val).Add((object)"GettingYolkedConfig_CookedEggClimbingSpeedDuration", (object)CookedEggClimbingSpeedDuration.Value);
((Dictionary<object, object>)val).Add((object)"GettingYolkedConfig_EnableJumpHeight", (object)EnableJumpHeight.Value);
((Dictionary<object, object>)val).Add((object)"GettingYolkedConfig_CookedEggJumpHeightMultiplier", (object)CookedEggJumpHeightMultiplier.Value);
((Dictionary<object, object>)val).Add((object)"GettingYolkedConfig_CookedEggJumpHeightDuration", (object)CookedEggJumpHeightDuration.Value);
((Dictionary<object, object>)val).Add((object)"GettingYolkedConfig_EnableSprintStaminaUsage", (object)EnableSprintStaminaUsage.Value);
((Dictionary<object, object>)val).Add((object)"GettingYolkedConfig_RawEggSprintStaminaUsage", (object)RawEggSprintStaminaUsage.Value);
((Dictionary<object, object>)val).Add((object)"GettingYolkedConfig_RawEggSprintStaminaUsageDuration", (object)RawEggSprintStaminaUsageDuration.Value);
((Dictionary<object, object>)val).Add((object)"GettingYolkedConfig_EnableJumpStaminaUsage", (object)EnableJumpStaminaUsage.Value);
((Dictionary<object, object>)val).Add((object)"GettingYolkedConfig_RawEggJumpStaminaUsage", (object)RawEggJumpStaminaUsage.Value);
((Dictionary<object, object>)val).Add((object)"GettingYolkedConfig_RawEggJumpStaminaUsageSprinting", (object)RawEggJumpStaminaUsageSprinting.Value);
((Dictionary<object, object>)val).Add((object)"GettingYolkedConfig_RawEggJumpStaminaUsageDuration", (object)RawEggJumpStaminaUsageDuration.Value);
((Dictionary<object, object>)val).Add((object)"GettingYolkedConfig_EnableWeightReduction", (object)EnableWeightReduction.Value);
((Dictionary<object, object>)val).Add((object)"GettingYolkedConfig_CookedEggWeightReductionMultiplier", (object)CookedEggWeightReductionMultiplier.Value);
((Dictionary<object, object>)val).Add((object)"GettingYolkedConfig_CookedEggWeightReductionDuration", (object)CookedEggWeightReductionDuration.Value);
Hashtable val2 = val;
PhotonNetwork.CurrentRoom.SetCustomProperties(val2, (Hashtable)null, (WebFlags)null);
isHandshakeValid = true;
Log.LogInfo((object)"[Getting Yolked] Host updated room properties with config and handshake");
if ((Object)(object)view != (Object)null)
{
view.RPC("SyncHostSettings", (RpcTarget)1, new object[24]
{
EnableExtraStamina.Value, ExtraStaminaFromEgg.Value, EnableFarting.Value, FartEggThreshold.Value, FartTimeWindow.Value, FartCheckInterval.Value, FartChance.Value, FartDuration.Value, EnableClimbingSpeed.Value, CookedEggClimbingSpeedMultiplier.Value,
CookedEggClimbingSpeedDuration.Value, EnableJumpHeight.Value, CookedEggJumpHeightMultiplier.Value, CookedEggJumpHeightDuration.Value, EnableSprintStaminaUsage.Value, RawEggSprintStaminaUsage.Value, RawEggSprintStaminaUsageDuration.Value, EnableJumpStaminaUsage.Value, RawEggJumpStaminaUsage.Value, RawEggJumpStaminaUsageSprinting.Value,
RawEggJumpStaminaUsageDuration.Value, EnableWeightReduction.Value, CookedEggWeightReductionMultiplier.Value, CookedEggWeightReductionDuration.Value
});
Log.LogInfo((object)"[Getting Yolked] Host sent config sync RPC to clients");
}
return;
}
catch (Exception ex2)
{
Log.LogWarning((object)("[Getting Yolked] Failed to sync config as host: " + ex2.Message));
return;
}
}
if (!(!isMasterClient && inRoom))
{
return;
}
try
{
Hashtable customProperties = ((RoomInfo)PhotonNetwork.CurrentRoom).CustomProperties;
if (((Dictionary<object, object>)(object)customProperties).ContainsKey((object)"GettingYolkedHandshake"))
{
int num = (int)customProperties[(object)"GettingYolkedHandshake"];
isHandshakeValid = num == 1;
if (isHandshakeValid)
{
Log.LogInfo((object)$"[Getting Yolked] Handshake valid - host has mod (version {num})");
if (((Dictionary<object, object>)(object)customProperties).ContainsKey((object)"GettingYolkedConfig_ExtraStaminaFromEgg"))
{
ApplyConfigFromRoomProperties(customProperties);
Log.LogInfo((object)"[Getting Yolked] Client loaded config from room properties");
}
else if (forceSync && (Object)(object)view != (Object)null)
{
Log.LogInfo((object)"[Getting Yolked] Client requesting config from host (room properties not available)");
((MonoBehaviour)this).StartCoroutine(RetryConfigSyncCoroutine());
}
}
else
{
Log.LogWarning((object)$"[Getting Yolked] Handshake version mismatch (got {num}, expected {1}) - mod disabled");
}
}
else
{
isHandshakeValid = false;
Log.LogWarning((object)"[Getting Yolked] Handshake failed - host does not have the mod. Getting Yolked functionality disabled for anti-cheat.");
}
}
catch (Exception ex3)
{
Log.LogWarning((object)("[Getting Yolked] Failed to check room properties as client: " + ex3.Message));
isHandshakeValid = false;
}
}
internal void ApplyConfigFromRoomProperties(Hashtable roomProps)
{
try
{
if (!((Dictionary<object, object>)(object)roomProps).ContainsKey((object)"GettingYolkedHandshake"))
{
isHandshakeValid = false;
Log.LogWarning((object)"[Getting Yolked] Handshake missing in room properties - mod disabled");
return;
}
int num = (int)roomProps[(object)"GettingYolkedHandshake"];
isHandshakeValid = num == 1;
if (!isHandshakeValid)
{
Log.LogWarning((object)$"[Getting Yolked] Handshake version mismatch (got {num}, expected {1}) - mod disabled");
}
else if (((Dictionary<object, object>)(object)roomProps).ContainsKey((object)"GettingYolkedConfig_ExtraStaminaFromEgg"))
{
syncedEnableExtraStamina = (bool)roomProps[(object)"GettingYolkedConfig_EnableExtraStamina"];
syncedExtraStaminaFromEgg = (float)roomProps[(object)"GettingYolkedConfig_ExtraStaminaFromEgg"];
syncedEnableFarting = (bool)roomProps[(object)"GettingYolkedConfig_EnableFarting"];
syncedFartEggThreshold = (int)roomProps[(object)"GettingYolkedConfig_FartEggThreshold"];
syncedFartTimeWindow = (float)roomProps[(object)"GettingYolkedConfig_FartTimeWindow"];
syncedFartCheckInterval = (float)roomProps[(object)"GettingYolkedConfig_FartCheckInterval"];
syncedFartChance = (float)roomProps[(object)"GettingYolkedConfig_FartChance"];
syncedFartDuration = (float)roomProps[(object)"GettingYolkedConfig_FartDuration"];
syncedEnableClimbingSpeed = (bool)roomProps[(object)"GettingYolkedConfig_EnableClimbingSpeed"];
syncedCookedEggClimbingSpeedMultiplier = (float)roomProps[(object)"GettingYolkedConfig_CookedEggClimbingSpeedMultiplier"];
syncedCookedEggClimbingSpeedDuration = (float)roomProps[(object)"GettingYolkedConfig_CookedEggClimbingSpeedDuration"];
syncedEnableJumpHeight = (bool)roomProps[(object)"GettingYolkedConfig_EnableJumpHeight"];
syncedCookedEggJumpHeightMultiplier = (float)roomProps[(object)"GettingYolkedConfig_CookedEggJumpHeightMultiplier"];
syncedCookedEggJumpHeightDuration = (float)roomProps[(object)"GettingYolkedConfig_CookedEggJumpHeightDuration"];
syncedEnableSprintStaminaUsage = (bool)roomProps[(object)"GettingYolkedConfig_EnableSprintStaminaUsage"];
syncedRawEggSprintStaminaUsage = (float)roomProps[(object)"GettingYolkedConfig_RawEggSprintStaminaUsage"];
syncedRawEggSprintStaminaUsageDuration = (float)roomProps[(object)"GettingYolkedConfig_RawEggSprintStaminaUsageDuration"];
syncedEnableJumpStaminaUsage = (bool)roomProps[(object)"GettingYolkedConfig_EnableJumpStaminaUsage"];
syncedRawEggJumpStaminaUsage = (float)roomProps[(object)"GettingYolkedConfig_RawEggJumpStaminaUsage"];
syncedRawEggJumpStaminaUsageSprinting = (float)roomProps[(object)"GettingYolkedConfig_RawEggJumpStaminaUsageSprinting"];
syncedRawEggJumpStaminaUsageDuration = (float)roomProps[(object)"GettingYolkedConfig_RawEggJumpStaminaUsageDuration"];
syncedEnableWeightReduction = (bool)roomProps[(object)"GettingYolkedConfig_EnableWeightReduction"];
syncedCookedEggWeightReductionMultiplier = (float)roomProps[(object)"GettingYolkedConfig_CookedEggWeightReductionMultiplier"];
syncedCookedEggWeightReductionDuration = (float)roomProps[(object)"GettingYolkedConfig_CookedEggWeightReductionDuration"];
}
}
catch (Exception ex)
{
Log.LogWarning((object)("[Getting Yolked] Failed to apply config from room properties: " + ex.Message));
isHandshakeValid = false;
}
}
[IteratorStateMachine(typeof(<RetryConfigSyncCoroutine>d__72))]
internal IEnumerator RetryConfigSyncCoroutine()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <RetryConfigSyncCoroutine>d__72(0)
{
<>4__this = this
};
}
[PunRPC]
public void SyncHostSettings(bool enableExtraStamina, float extraStaminaFromEgg, bool enableFarting, int fartEggThreshold, float fartTimeWindow, float fartCheckInterval, float fartChance, float fartDuration, bool enableClimbingSpeed, float cookedEggClimbingSpeedMultiplier, float cookedEggClimbingSpeedDuration, bool enableJumpHeight, float cookedEggJumpHeightMultiplier, float cookedEggJumpHeightDuration, bool enableSprintStaminaUsage, float rawEggSprintStaminaUsage, float rawEggSprintStaminaUsageDuration, bool enableJumpStaminaUsage, float rawEggJumpStaminaUsage, float rawEggJumpStaminaUsageSprinting, float rawEggJumpStaminaUsageDuration, bool enableWeightReduction, float cookedEggWeightReductionMultiplier, float cookedEggWeightReductionDuration)
{
isHandshakeValid = true;
syncedEnableExtraStamina = enableExtraStamina;
syncedExtraStaminaFromEgg = extraStaminaFromEgg;
syncedEnableFarting = enableFarting;
syncedFartEggThreshold = fartEggThreshold;
syncedFartTimeWindow = fartTimeWindow;
syncedFartCheckInterval = fartCheckInterval;
syncedFartChance = fartChance;
syncedFartDuration = fartDuration;
syncedEnableClimbingSpeed = enableClimbingSpeed;
syncedCookedEggClimbingSpeedMultiplier = cookedEggClimbingSpeedMultiplier;
syncedCookedEggClimbingSpeedDuration = cookedEggClimbingSpeedDuration;
syncedEnableJumpHeight = enableJumpHeight;
syncedCookedEggJumpHeightMultiplier = cookedEggJumpHeightMultiplier;
syncedCookedEggJumpHeightDuration = cookedEggJumpHeightDuration;
syncedEnableSprintStaminaUsage = enableSprintStaminaUsage;
syncedRawEggSprintStaminaUsage = rawEggSprintStaminaUsage;
syncedRawEggSprintStaminaUsageDuration = rawEggSprintStaminaUsageDuration;
syncedEnableJumpStaminaUsage = enableJumpStaminaUsage;
syncedRawEggJumpStaminaUsage = rawEggJumpStaminaUsage;
syncedRawEggJumpStaminaUsageSprinting = rawEggJumpStaminaUsageSprinting;
syncedRawEggJumpStaminaUsageDuration = rawEggJumpStaminaUsageDuration;
syncedEnableWeightReduction = enableWeightReduction;
syncedCookedEggWeightReductionMultiplier = cookedEggWeightReductionMultiplier;
syncedCookedEggWeightReductionDuration = cookedEggWeightReductionDuration;
Log.LogInfo((object)"[Getting Yolked] Received synced config from host - Handshake valid");
}
public static void HandleEggConsumption(string itemName, Character character, Item item = null)
{
//IL_0347: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)Instance == (Object)null || (Object)(object)character == (Object)null || string.IsNullOrEmpty(itemName) || !isHandshakeValid)
{
return;
}
string text = itemName.Replace("(Clone)", string.Empty).Trim();
if (text.Contains(":"))
{
text = text.Split(new char[1] { ':' }).Last();
}
if (!text.ToLowerInvariant().Contains("egg"))
{
return;
}
int num = 0;
if ((Object)(object)item != (Object)null && item.HasData((DataEntryKey)1))
{
IntItemData data = item.GetData<IntItemData>((DataEntryKey)1);
num = data.Value;
}
if (syncedEnableFarting && character.IsLocal)
{
float currentTime = Time.time;
Instance.recentEggConsumptionTimes.Add(currentTime);
Instance.recentEggConsumptionTimes.RemoveAll((float time) => currentTime - time > syncedFartTimeWindow);
if (Instance.recentEggConsumptionTimes.Count >= syncedFartEggThreshold)
{
if (Instance.activeFartingCoroutine != null)
{
((MonoBehaviour)Instance).StopCoroutine(Instance.activeFartingCoroutine);
}
Instance.activeFartingCoroutine = ((MonoBehaviour)Instance).StartCoroutine(PeriodicFartingCoroutine(character));
Instance.recentEggConsumptionTimes.Clear();
}
}
if (num >= 2)
{
return;
}
if (num == 0 && character.IsLocal)
{
if (syncedEnableExtraStamina)
{
((MonoBehaviour)character).StartCoroutine(BoostStamina(character));
}
if (character.refs != null && (Object)(object)character.refs.movement != (Object)null)
{
if (syncedEnableSprintStaminaUsage)
{
SprintStaminaUsageBonusUpdater.ApplySprintStaminaUsageBonus(character.refs.movement, syncedRawEggSprintStaminaUsage, syncedRawEggSprintStaminaUsageDuration);
}
if (syncedEnableJumpStaminaUsage)
{
JumpStaminaUsageBonusUpdater.ApplyJumpStaminaUsageBonus(character.refs.movement, syncedRawEggJumpStaminaUsage, syncedRawEggJumpStaminaUsageSprinting, syncedRawEggJumpStaminaUsageDuration);
}
}
}
if (num == 1 && character.IsLocal)
{
if (syncedEnableClimbingSpeed)
{
climbingSpeedBonusEndTime = Time.time + syncedCookedEggClimbingSpeedDuration;
ClimbingSpeedBonusUpdater.ApplyClimbingSpeedBonus(character, syncedCookedEggClimbingSpeedMultiplier, syncedCookedEggClimbingSpeedDuration);
}
if (syncedEnableJumpHeight && character.refs != null && (Object)(object)character.refs.movement != (Object)null)
{
jumpHeightBonusEndTime = Time.time + syncedCookedEggJumpHeightDuration;
JumpHeightBonusUpdater.ApplyJumpHeightBonus(character.refs.movement, syncedCookedEggJumpHeightMultiplier, syncedCookedEggJumpHeightDuration);
}
if (syncedEnableWeightReduction && character.refs != null && (Object)(object)character.refs.afflictions != (Object)null && (Object)(object)character.player != (Object)null)
{
weightReductionEndTime = Time.time + syncedCookedEggWeightReductionDuration;
cachedWeightStatusType = (STATUSTYPE)0;
SubscribeToInventoryChanges(character, subscribe: true);
ApplyWeightReductionFromInventory(character);
}
}
}
[IteratorStateMachine(typeof(<BoostStamina>d__75))]
private static IEnumerator BoostStamina(Character character)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <BoostStamina>d__75(0)
{
character = character
};
}
[IteratorStateMachine(typeof(<PeriodicFartingCoroutine>d__76))]
private static IEnumerator PeriodicFartingCoroutine(Character character)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <PeriodicFartingCoroutine>d__76(0)
{
character = character
};
}
private static void TryFart(Character character)
{
//IL_001b: 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_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)character == (Object)null)
{
return;
}
try
{
GameUtils.instance.SpawnResourceAtPositionNetworked("VFX_SporeExploExploEdibleSpawn", character.Center, (RpcTarget)1);
GameUtils.instance.RPC_SpawnResourceAtPosition("VFX_SporeExploExploEdibleSpawn_NoKnockback", character.Center);
float num = 100f;
character.AddForceToBodyPart(character.GetBodypartRig((BodypartType)0), Vector3.zero, Vector3.up * num);
}
catch (Exception ex)
{
Log.LogWarning((object)("[Getting Yolked] Failed to trigger fart: " + ex.Message));
}
}
private static void SubscribeToInventoryChanges(Character character, bool subscribe)
{
if ((Object)(object)character == (Object)null || (Object)(object)character.player == (Object)null)
{
return;
}
try
{
if (subscribe)
{
if (itemsChangedHandler == null)
{
itemsChangedHandler = delegate
{
if (Time.time < weightReductionEndTime && syncedEnableWeightReduction)
{
Character localCharacter = Character.localCharacter;
if ((Object)(object)localCharacter != (Object)null && localCharacter.refs != null && (Object)(object)localCharacter.refs.afflictions != (Object)null)
{
ApplyWeightReductionFromInventory(localCharacter);
}
}
};
}
character.player.itemsChangedAction = (Action<ItemSlot[]>)Delegate.Combine(character.player.itemsChangedAction, itemsChangedHandler);
}
else if (itemsChangedHandler != null && character.player.itemsChangedAction != null)
{
character.player.itemsChangedAction = (Action<ItemSlot[]>)Delegate.Remove(character.player.itemsChangedAction, itemsChangedHandler);
}
}
catch (Exception ex)
{
Log.LogWarning((object)("[Getting Yolked] Failed to subscribe/unsubscribe from inventory changes: " + ex.Message));
}
}
private static void ApplyWeightReductionFromInventory(Character character)
{
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Invalid comparison between Unknown and I4
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Invalid comparison between Unknown and I4
if ((Object)(object)character == (Object)null || character.refs == null || (Object)(object)character.refs.afflictions == (Object)null || (Object)(object)character.player == (Object)null || !syncedEnableWeightReduction)
{
return;
}
if (Time.time >= weightReductionEndTime)
{
SubscribeToInventoryChanges(character, subscribe: false);
cachedWeightStatusType = (STATUSTYPE)0;
return;
}
try
{
CharacterAfflictions afflictions = character.refs.afflictions;
if ((int)cachedWeightStatusType == 0)
{
Type typeFromHandle = typeof(STATUSTYPE);
List<STATUSTYPE> source = Enum.GetValues(typeFromHandle).Cast<STATUSTYPE>().ToList();
cachedWeightStatusType = ((IEnumerable<STATUSTYPE>)source).FirstOrDefault((Func<STATUSTYPE, bool>)((STATUSTYPE st) => ((object)(STATUSTYPE)(ref st)).ToString().ToLowerInvariant().Contains("weight") || ((object)(STATUSTYPE)(ref st)).ToString().ToLowerInvariant().Contains("carry")));
if ((int)cachedWeightStatusType == 0)
{
Log.LogWarning((object)"[Getting Yolked] Weight status type not found!");
return;
}
}
afflictions.UpdateWeight();
}
catch (Exception ex)
{
Log.LogWarning((object)("[Getting Yolked] Failed to apply weight reduction from inventory: " + ex.Message));
}
}
}
[HarmonyPatch(typeof(CharacterAfflictions), "UpdateWeight")]
public static class Patch_CharacterAfflictions_UpdateWeight
{
[HarmonyPostfix]
public static void Postfix(CharacterAfflictions __instance)
{
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Invalid comparison between Unknown and I4
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: 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_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Invalid comparison between Unknown and I4
try
{
if (!GettingYolkedPlugin.syncedEnableWeightReduction || Time.time >= GettingYolkedPlugin.weightReductionEndTime)
{
return;
}
Character component = ((Component)__instance).GetComponent<Character>();
if ((Object)(object)component == (Object)null || !component.IsLocal)
{
return;
}
if ((int)GettingYolkedPlugin.cachedWeightStatusType == 0)
{
Type typeFromHandle = typeof(STATUSTYPE);
List<STATUSTYPE> source = Enum.GetValues(typeFromHandle).Cast<STATUSTYPE>().ToList();
GettingYolkedPlugin.cachedWeightStatusType = ((IEnumerable<STATUSTYPE>)source).FirstOrDefault((Func<STATUSTYPE, bool>)((STATUSTYPE st) => ((object)(STATUSTYPE)(ref st)).ToString().ToLowerInvariant().Contains("weight") || ((object)(STATUSTYPE)(ref st)).ToString().ToLowerInvariant().Contains("carry")));
if ((int)GettingYolkedPlugin.cachedWeightStatusType == 0)
{
return;
}
}
float currentStatus = __instance.GetCurrentStatus(GettingYolkedPlugin.cachedWeightStatusType);
float num = currentStatus * GettingYolkedPlugin.syncedCookedEggWeightReductionMultiplier;
float num2 = num - currentStatus;
if (Mathf.Abs(num2) > 0.001f)
{
GettingYolkedPlugin.Log.LogInfo((object)$"[Getting Yolked] UpdateWeight patch: total={currentStatus}, halved={num}, diff={num2}");
__instance.AdjustStatus(GettingYolkedPlugin.cachedWeightStatusType, num2, false);
}
}
catch (Exception ex)
{
GettingYolkedPlugin.Log.LogWarning((object)("[Getting Yolked] UpdateWeight patch failed: " + ex.Message));
}
}
}
[HarmonyPatch(typeof(Item))]
public static class Patch_Item_Consume
{
[HarmonyPostfix]
[HarmonyPatch("Consume")]
public static void Postfix(Item __instance, int consumerID)
{
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Invalid comparison between Unknown and I4
if ((Object)(object)__instance == (Object)null)
{
return;
}
PhotonView photonView = PhotonNetwork.GetPhotonView(consumerID);
if ((Object)(object)photonView == (Object)null)
{
return;
}
Character component = ((Component)photonView).GetComponent<Character>();
if ((Object)(object)component == (Object)null || !((MonoBehaviourPun)component).photonView.IsMine)
{
return;
}
bool flag = false;
float num = 0f;
ItemActionBase[] components = ((Component)__instance).GetComponents<ItemActionBase>();
ItemActionBase[] array = components;
foreach (ItemActionBase val in array)
{
Action_RestoreHunger val2 = (Action_RestoreHunger)(object)((val is Action_RestoreHunger) ? val : null);
if (val2 != null && val2.restorationAmount > 0f)
{
num += val2.restorationAmount;
flag = true;
continue;
}
Action_ModifyStatus val3 = (Action_ModifyStatus)(object)((val is Action_ModifyStatus) ? val : null);
if (val3 != null && (int)val3.statusType == 1 && val3.changeAmount < 0f)
{
num += 0f - val3.changeAmount;
flag = true;
}
}
if (flag && num > 0f)
{
GettingYolkedPlugin.HandleEggConsumption(((Object)__instance).name, component, __instance);
}
}
}
[HarmonyPatch(typeof(RunManager), "StartRun")]
public static class Patch_RunManager_StartRun
{
public static void Postfix()
{
GettingYolkedPlugin instance = GettingYolkedPlugin.Instance;
if ((Object)(object)instance == (Object)null)
{
Debug.LogError((object)"[Getting Yolked] Instance not found!");
return;
}
GettingYolkedPlugin.Log.LogInfo((object)"[Getting Yolked] Run started - triggering config sync retry");
if (instance.configSyncRetryCoroutine != null)
{
((MonoBehaviour)instance).StopCoroutine(instance.configSyncRetryCoroutine);
instance.configSyncRetryCoroutine = null;
}
instance.configSyncRetryCoroutine = ((MonoBehaviour)instance).StartCoroutine(instance.RetryConfigSyncCoroutine());
}
}
[HarmonyPatch]
public static class Patch_PhotonCallbacks
{
private static MethodBase TargetMethod_OnPlayerEnteredRoom()
{
Type type = Type.GetType("ReconnectHandler, Assembly-CSharp");
if (type != null)
{
return type.GetMethod("OnPlayerEnteredRoom", BindingFlags.Instance | BindingFlags.Public);
}
return null;
}
[HarmonyPostfix]
public static void Postfix_OnPlayerEnteredRoom(Player newPlayer)
{
GettingYolkedPlugin instance = GettingYolkedPlugin.Instance;
if ((Object)(object)instance == (Object)null)
{
return;
}
if (PhotonNetwork.IsMasterClient && PhotonNetwork.IsConnectedAndReady)
{
GettingYolkedPlugin.Log.LogInfo((object)("[Getting Yolked] Player " + (((newPlayer != null) ? newPlayer.UserId : null) ?? "unknown") + " entered room - sending config and handshake"));
instance.AttemptConfigSync(forceSync: true);
}
else if (!PhotonNetwork.IsMasterClient && newPlayer != null)
{
string userId = newPlayer.UserId;
Player localPlayer = PhotonNetwork.LocalPlayer;
if (userId == ((localPlayer != null) ? localPlayer.UserId : null))
{
GettingYolkedPlugin.Log.LogInfo((object)"[Getting Yolked] Local player entered room - re-validating handshake");
GettingYolkedPlugin.isHandshakeValid = false;
instance.AttemptConfigSync(forceSync: true);
}
}
}
private static MethodBase TargetMethod_OnMasterClientSwitched()
{
Type type = Type.GetType("ReconnectHandler, Assembly-CSharp");
if (type != null)
{
return type.GetMethod("OnMasterClientSwitched", BindingFlags.Instance | BindingFlags.Public);
}
return null;
}
[HarmonyPostfix]
public static void Postfix_OnMasterClientSwitched(Player newMasterClient)
{
GettingYolkedPlugin instance = GettingYolkedPlugin.Instance;
if ((Object)(object)instance == (Object)null)
{
return;
}
GettingYolkedPlugin.Log.LogInfo((object)("[Getting Yolked] Master client switched to " + (((newMasterClient != null) ? newMasterClient.UserId : null) ?? "unknown") + " - resetting handshake and triggering sync"));
if (PhotonNetwork.IsConnectedAndReady)
{
if (PhotonNetwork.IsMasterClient)
{
GettingYolkedPlugin.isHandshakeValid = true;
}
else
{
GettingYolkedPlugin.isHandshakeValid = false;
}
((MonoBehaviour)instance).StartCoroutine(instance.RetryConfigSyncCoroutine());
}
}
}
[HarmonyPatch(typeof(Room))]
public static class Patch_Room_SetCustomProperties
{
[HarmonyPostfix]
[HarmonyPatch("SetCustomProperties", new Type[] { typeof(Hashtable) })]
public static void Postfix(Room _, Hashtable propertiesToSet)
{
GettingYolkedPlugin instance = GettingYolkedPlugin.Instance;
if (!((Object)(object)instance == (Object)null) && propertiesToSet != null && ((Dictionary<object, object>)(object)propertiesToSet).ContainsKey((object)"GettingYolkedConfig_ExtraStaminaFromEgg") && !PhotonNetwork.IsMasterClient && PhotonNetwork.IsConnectedAndReady)
{
GettingYolkedPlugin.Log.LogInfo((object)"[Getting Yolked] Room properties updated by host - applying config");
Room currentRoom = PhotonNetwork.CurrentRoom;
Hashtable val = ((currentRoom != null) ? ((RoomInfo)currentRoom).CustomProperties : null);
if (val != null)
{
instance.ApplyConfigFromRoomProperties(val);
}
}
}
}
[HarmonyPatch]
public static class Patch_OnRoomPropertiesUpdate
{
private static MethodBase TargetMethod()
{
Type type = Type.GetType("ReconnectHandler, Assembly-CSharp");
if (type != null)
{
return type.GetMethod("OnRoomPropertiesUpdate", BindingFlags.Instance | BindingFlags.Public);
}
return null;
}
[HarmonyPostfix]
public static void Postfix(Hashtable propertiesThatChanged)
{
GettingYolkedPlugin instance = GettingYolkedPlugin.Instance;
if ((Object)(object)instance == (Object)null || PhotonNetwork.IsMasterClient || !PhotonNetwork.IsConnectedAndReady)
{
return;
}
Room currentRoom = PhotonNetwork.CurrentRoom;
Hashtable val = ((currentRoom != null) ? ((RoomInfo)currentRoom).CustomProperties : null);
if (val == null)
{
return;
}
bool flag = ((Dictionary<object, object>)(object)propertiesThatChanged)?.ContainsKey((object)"GettingYolkedHandshake") ?? false;
bool flag2 = propertiesThatChanged != null && (((Dictionary<object, object>)(object)propertiesThatChanged).ContainsKey((object)"GettingYolkedConfig_ExtraStaminaFromEgg") || ((Dictionary<object, object>)(object)propertiesThatChanged).Keys.Cast<object>().Any((object k) => k != null && (k.ToString()?.StartsWith("GettingYolkedConfig_")).GetValueOrDefault()));
if (flag || propertiesThatChanged != null)
{
if (!((Dictionary<object, object>)(object)val).ContainsKey((object)"GettingYolkedHandshake"))
{
GettingYolkedPlugin.isHandshakeValid = false;
GettingYolkedPlugin.Log.LogWarning((object)"[Getting Yolked] Handshake missing - host does not have mod. Getting Yolked disabled.");
return;
}
int num = (int)val[(object)"GettingYolkedHandshake"];
GettingYolkedPlugin.isHandshakeValid = num == 1;
if (!GettingYolkedPlugin.isHandshakeValid)
{
GettingYolkedPlugin.Log.LogWarning((object)$"[Getting Yolked] Handshake version mismatch (got {num}, expected {1}) - mod disabled");
GettingYolkedPlugin.isHandshakeValid = false;
return;
}
GettingYolkedPlugin.Log.LogInfo((object)$"[Getting Yolked] Handshake validated from room properties (version {num})");
}
if (GettingYolkedPlugin.isHandshakeValid && flag2 && ((Dictionary<object, object>)(object)val).ContainsKey((object)"GettingYolkedConfig_ExtraStaminaFromEgg"))
{
GettingYolkedPlugin.Log.LogInfo((object)"[Getting Yolked] Room properties update detected - applying config");
instance.ApplyConfigFromRoomProperties(val);
}
}
}
[HarmonyPatch]
public static class Patch_PhotonShim_OnConnectedToMaster
{
private static MethodBase TargetMethod()
{
Type type = Type.GetType("Crab.Network.PhotonShim, Assembly-CSharp");
if (type != null)
{
return type.GetMethod("OnConnectedToMaster", BindingFlags.Instance | BindingFlags.Public);
}
return null;
}
[HarmonyPostfix]
public static void Postfix()
{
GettingYolkedPlugin instance = GettingYolkedPlugin.Instance;
if (!((Object)(object)instance == (Object)null))
{
GettingYolkedPlugin.Log.LogInfo((object)"[Getting Yolked] Connected to Photon master - triggering sync");
if (PhotonNetwork.IsConnectedAndReady)
{
((MonoBehaviour)instance).StartCoroutine(instance.RetryConfigSyncCoroutine());
}
}
}
}
[HarmonyPatch]
public static class Patch_OnJoinedRoom
{
private static MethodBase TargetMethod()
{
Type type = Type.GetType("ReconnectHandler, Assembly-CSharp");
if (type != null)
{
MethodInfo method = type.GetMethod("OnJoinedRoom", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
if (method != null)
{
return method;
}
}
Type type2 = Type.GetType("Crab.Network.PhotonShim, Assembly-CSharp");
if (type2 != null)
{
MethodInfo method2 = type2.GetMethod("OnJoinedRoom", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
if (method2 != null)
{
return method2;
}
}
return null;
}
[HarmonyPostfix]
public static void Postfix()
{
GettingYolkedPlugin instance = GettingYolkedPlugin.Instance;
if (!((Object)(object)instance == (Object)null) && PhotonNetwork.IsConnectedAndReady && PhotonNetwork.InRoom)
{
GettingYolkedPlugin.Log.LogInfo((object)"[Getting Yolked] OnJoinedRoom detected - resetting handshake and triggering config sync");
if (!PhotonNetwork.IsMasterClient)
{
GettingYolkedPlugin.isHandshakeValid = false;
}
else
{
GettingYolkedPlugin.isHandshakeValid = true;
}
((MonoBehaviour)instance).StartCoroutine(instance.RetryConfigSyncCoroutine());
}
}
}
public static class ClimbingSpeedBonusUpdater
{
[CompilerGenerated]
private sealed class <RestoreClimbingSpeedAfterDelay>d__3 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public Character character;
public float delay;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <RestoreClimbingSpeedAfterDelay>d__3(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(delay);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
if ((Object)(object)character != (Object)null && character.refs != null)
{
if ((Object)(object)character.refs.climbing != (Object)null)
{
character.refs.climbing.climbSpeedMod = 1f;
}
if ((Object)(object)character.refs.ropeHandling != (Object)null)
{
character.refs.ropeHandling.climbSpeedMod = 1f;
}
if ((Object)(object)character.refs.vineClimbing != (Object)null)
{
character.refs.vineClimbing.climbSpeedMod = 1f;
}
}
activeRestoreCoroutine = null;
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
private const float DEFAULT_CLIMB_SPEED_MOD = 1f;
private static Coroutine activeRestoreCoroutine;
public static void ApplyClimbingSpeedBonus(Character character, float multiplier, float duration)
{
if (!((Object)(object)character == (Object)null) && character.IsLocal && character.refs != null)
{
if (activeRestoreCoroutine != null)
{
((MonoBehaviour)GettingYolkedPlugin.Instance).StopCoroutine(activeRestoreCoroutine);
activeRestoreCoroutine = null;
}
if ((Object)(object)character.refs.climbing != (Object)null)
{
character.refs.climbing.climbSpeedMod = 1f * multiplier;
}
if ((Object)(object)character.refs.ropeHandling != (Object)null)
{
character.refs.ropeHandling.climbSpeedMod = 1f * multiplier;
}
if ((Object)(object)character.refs.vineClimbing != (Object)null)
{
character.refs.vineClimbing.climbSpeedMod = 1f * multiplier;
}
activeRestoreCoroutine = ((MonoBehaviour)GettingYolkedPlugin.Instance).StartCoroutine(RestoreClimbingSpeedAfterDelay(character, duration));
}
}
[IteratorStateMachine(typeof(<RestoreClimbingSpeedAfterDelay>d__3))]
private static IEnumerator RestoreClimbingSpeedAfterDelay(Character character, float delay)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <RestoreClimbingSpeedAfterDelay>d__3(0)
{
character = character,
delay = delay
};
}
}
[HarmonyPatch]
public static class Patch_CharacterRopeHandling
{
private static Dictionary<object, float> originalValues = new Dictionary<object, float>();
private static MethodBase TargetMethod()
{
Type type = Type.GetType("CharacterRopeHandling, Assembly-CSharp");
if (type != null)
{
MethodInfo method = type.GetMethod("Update", BindingFlags.Instance | BindingFlags.Public);
if (method != null)
{
return method;
}
return type.GetMethod("FixedUpdate", BindingFlags.Instance | BindingFlags.Public);
}
return null;
}
[HarmonyPrefix]
public static bool Prefix(object __instance)
{
FieldInfo field = __instance.GetType().GetField("climbSpeedMod", BindingFlags.Instance | BindingFlags.Public);
if (field == null)
{
return true;
}
if (!originalValues.ContainsKey(__instance))
{
originalValues[__instance] = (float)field.GetValue(__instance);
}
FieldInfo field2 = __instance.GetType().GetField("character", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
if (field2 != null)
{
object value = field2.GetValue(__instance);
if (value != null)
{
PropertyInfo property = value.GetType().GetProperty("IsLocal", BindingFlags.Instance | BindingFlags.Public);
if (property != null && (bool)property.GetValue(value))
{
if (Time.time < GettingYolkedPlugin.climbingSpeedBonusEndTime)
{
float num = originalValues[__instance];
float num2 = num * GettingYolkedPlugin.syncedCookedEggClimbingSpeedMultiplier;
field.SetValue(__instance, num2);
}
else if (originalValues.ContainsKey(__instance))
{
field.SetValue(__instance, originalValues[__instance]);
}
}
}
}
return true;
}
[HarmonyPostfix]
public static void Postfix(object __instance)
{
FieldInfo field = __instance.GetType().GetField("climbSpeedMod", BindingFlags.Instance | BindingFlags.Public);
if (field != null && originalValues.ContainsKey(__instance))
{
field.SetValue(__instance, originalValues[__instance]);
}
}
}
[HarmonyPatch]
public static class Patch_CharacterVineClimbing
{
private static Dictionary<object, float> originalValues = new Dictionary<object, float>();
private static MethodBase TargetMethod()
{
Type type = Type.GetType("CharacterVineClimbing, Assembly-CSharp");
if (type != null)
{
MethodInfo method = type.GetMethod("Update", BindingFlags.Instance | BindingFlags.Public);
if (method != null)
{
return method;
}
return type.GetMethod("FixedUpdate", BindingFlags.Instance | BindingFlags.Public);
}
return null;
}
[HarmonyPrefix]
public static bool Prefix(object __instance)
{
FieldInfo field = __instance.GetType().GetField("climbSpeedMod", BindingFlags.Instance | BindingFlags.Public);
if (field == null)
{
return true;
}
if (!originalValues.ContainsKey(__instance))
{
originalValues[__instance] = (float)field.GetValue(__instance);
}
FieldInfo field2 = __instance.GetType().GetField("character", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
if (field2 != null)
{
object value = field2.GetValue(__instance);
if (value != null)
{
PropertyInfo property = value.GetType().GetProperty("IsLocal", BindingFlags.Instance | BindingFlags.Public);
if (property != null && (bool)property.GetValue(value))
{
if (Time.time < GettingYolkedPlugin.climbingSpeedBonusEndTime)
{
float num = originalValues[__instance];
float num2 = num * GettingYolkedPlugin.syncedCookedEggClimbingSpeedMultiplier;
field.SetValue(__instance, num2);
}
else if (originalValues.ContainsKey(__instance))
{
field.SetValue(__instance, originalValues[__instance]);
}
}
}
}
return true;
}
[HarmonyPostfix]
public static void Postfix(object __instance)
{
FieldInfo field = __instance.GetType().GetField("climbSpeedMod", BindingFlags.Instance | BindingFlags.Public);
if (field != null && originalValues.ContainsKey(__instance))
{
field.SetValue(__instance, originalValues[__instance]);
}
}
}
public static class JumpHeightBonusUpdater
{
[CompilerGenerated]
private sealed class <RestoreJumpHeightAfterDelay>d__3 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public CharacterMovement characterMovement;
public float delay;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <RestoreJumpHeightAfterDelay>d__3(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(delay);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
if ((Object)(object)characterMovement != (Object)null && originalJumpImpulses.ContainsKey(characterMovement))
{
characterMovement.jumpImpulse = originalJumpImpulses[characterMovement];
originalJumpImpulses.Remove(characterMovement);
}
activeRestoreCoroutine = null;
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
private static Dictionary<CharacterMovement, float> originalJumpImpulses = new Dictionary<CharacterMovement, float>();
private static Coroutine activeRestoreCoroutine = null;
public static void ApplyJumpHeightBonus(CharacterMovement characterMovement, float multiplier, float duration)
{
if (!((Object)(object)characterMovement == (Object)null) && !((Object)(object)characterMovement.character == (Object)null) && characterMovement.character.IsLocal)
{
if (activeRestoreCoroutine != null)
{
((MonoBehaviour)GettingYolkedPlugin.Instance).StopCoroutine(activeRestoreCoroutine);
activeRestoreCoroutine = null;
}
if (!originalJumpImpulses.ContainsKey(characterMovement))
{
originalJumpImpulses[characterMovement] = characterMovement.jumpImpulse;
}
float num = originalJumpImpulses[characterMovement];
characterMovement.jumpImpulse = num * multiplier;
activeRestoreCoroutine = ((MonoBehaviour)GettingYolkedPlugin.Instance).StartCoroutine(RestoreJumpHeightAfterDelay(characterMovement, duration));
}
}
[IteratorStateMachine(typeof(<RestoreJumpHeightAfterDelay>d__3))]
private static IEnumerator RestoreJumpHeightAfterDelay(CharacterMovement characterMovement, float delay)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <RestoreJumpHeightAfterDelay>d__3(0)
{
characterMovement = characterMovement,
delay = delay
};
}
}
public static class SprintStaminaUsageBonusUpdater
{
[CompilerGenerated]
private sealed class <RestoreSprintStaminaUsageAfterDelay>d__3 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public CharacterMovement characterMovement;
public float delay;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <RestoreSprintStaminaUsageAfterDelay>d__3(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(delay);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
if ((Object)(object)characterMovement != (Object)null && originalSprintStaminaUsages.ContainsKey(characterMovement))
{
characterMovement.sprintStaminaUsage = originalSprintStaminaUsages[characterMovement];
originalSprintStaminaUsages.Remove(characterMovement);
}
activeRestoreCoroutine = null;
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
private static Dictionary<CharacterMovement, float> originalSprintStaminaUsages = new Dictionary<CharacterMovement, float>();
private static Coroutine activeRestoreCoroutine = null;
public static void ApplySprintStaminaUsageBonus(CharacterMovement characterMovement, float sprintStaminaUsage, float duration)
{
if (!((Object)(object)characterMovement == (Object)null) && !((Object)(object)characterMovement.character == (Object)null) && characterMovement.character.IsLocal)
{
if (activeRestoreCoroutine != null)
{
((MonoBehaviour)GettingYolkedPlugin.Instance).StopCoroutine(activeRestoreCoroutine);
activeRestoreCoroutine = null;
}
if (!originalSprintStaminaUsages.ContainsKey(characterMovement))
{
originalSprintStaminaUsages[characterMovement] = characterMovement.sprintStaminaUsage;
}
float num = originalSprintStaminaUsages[characterMovement];
characterMovement.sprintStaminaUsage = sprintStaminaUsage;
activeRestoreCoroutine = ((MonoBehaviour)GettingYolkedPlugin.Instance).StartCoroutine(RestoreSprintStaminaUsageAfterDelay(characterMovement, duration));
}
}
[IteratorStateMachine(typeof(<RestoreSprintStaminaUsageAfterDelay>d__3))]
private static IEnumerator RestoreSprintStaminaUsageAfterDelay(CharacterMovement characterMovement, float delay)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <RestoreSprintStaminaUsageAfterDelay>d__3(0)
{
characterMovement = characterMovement,
delay = delay
};
}
}
public static class JumpStaminaUsageBonusUpdater
{
[CompilerGenerated]
private sealed class <RestoreJumpStaminaUsageAfterDelay>d__4 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public CharacterMovement characterMovement;
public float delay;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <RestoreJumpStaminaUsageAfterDelay>d__4(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(delay);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
if ((Object)(object)characterMovement != (Object)null)
{
if (originalJumpStaminaUsages.ContainsKey(characterMovement))
{
characterMovement.jumpStaminaUsage = originalJumpStaminaUsages[characterMovement];
originalJumpStaminaUsages.Remove(characterMovement);
}
if (originalJumpStaminaUsageSprintings.ContainsKey(characterMovement))
{
characterMovement.jumpStaminaUsageSprinting = originalJumpStaminaUsageSprintings[characterMovement];
originalJumpStaminaUsageSprintings.Remove(characterMovement);
}
}
activeRestoreCoroutine = null;
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
private static Dictionary<CharacterMovement, float> originalJumpStaminaUsages = new Dictionary<CharacterMovement, float>();
private static Dictionary<CharacterMovement, float> originalJumpStaminaUsageSprintings = new Dictionary<CharacterMovement, float>();
private static Coroutine activeRestoreCoroutine = null;
public static void ApplyJumpStaminaUsageBonus(CharacterMovement characterMovement, float jumpStaminaUsage, float jumpStaminaUsageSprinting, float duration)
{
if (!((Object)(object)characterMovement == (Object)null) && !((Object)(object)characterMovement.character == (Object)null) && characterMovement.character.IsLocal)
{
if (activeRestoreCoroutine != null)
{
((MonoBehaviour)GettingYolkedPlugin.Instance).StopCoroutine(activeRestoreCoroutine);
activeRestoreCoroutine = null;
}
if (!originalJumpStaminaUsages.ContainsKey(characterMovement))
{
originalJumpStaminaUsages[characterMovement] = characterMovement.jumpStaminaUsage;
}
if (!originalJumpStaminaUsageSprintings.ContainsKey(characterMovement))
{
originalJumpStaminaUsageSprintings[characterMovement] = characterMovement.jumpStaminaUsageSprinting;
}
characterMovement.jumpStaminaUsage = jumpStaminaUsage;
characterMovement.jumpStaminaUsageSprinting = jumpStaminaUsageSprinting;
activeRestoreCoroutine = ((MonoBehaviour)GettingYolkedPlugin.Instance).StartCoroutine(RestoreJumpStaminaUsageAfterDelay(characterMovement, duration));
}
}
[IteratorStateMachine(typeof(<RestoreJumpStaminaUsageAfterDelay>d__4))]
private static IEnumerator RestoreJumpStaminaUsageAfterDelay(CharacterMovement characterMovement, float delay)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <RestoreJumpStaminaUsageAfterDelay>d__4(0)
{
characterMovement = characterMovement,
delay = delay
};
}
}