using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using UnityEngine;
using UnityEngine.SceneManagement;
using Zorro.Core.Serizalization;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("my.pahsiv.MyLegDay")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.1.1.0")]
[assembly: AssemblyInformationalVersion("0.1.1")]
[assembly: AssemblyProduct("my.pahsiv.MyLegDay")]
[assembly: AssemblyTitle("MyLegDay")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.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]
[Microsoft.CodeAnalysis.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]
[Microsoft.CodeAnalysis.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 BepInEx
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class BepInAutoPluginAttribute : Attribute
{
public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace BepInEx.Preloader.Core.Patching
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class PatcherAutoPluginAttribute : Attribute
{
public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace MyLegDay
{
internal class Patch
{
[HarmonyPatch(typeof(CharacterGrabbing), "KickCast")]
public static class KickCast_Patch
{
[CompilerGenerated]
private sealed class <CustomKickRoutine>d__1 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public CharacterGrabbing grabbing;
private List<Character> <characters>5__2;
private float <currentStamina>5__3;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <CustomKickRoutine>d__1(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<characters>5__2 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_032b: Unknown result type (might be due to invalid IL or missing references)
//IL_0335: Expected O, but got Unknown
//IL_0148: Unknown result type (might be due to invalid IL or missing references)
//IL_0152: Expected O, but got Unknown
//IL_019f: Unknown result type (might be due to invalid IL or missing references)
//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
//IL_01db: Unknown result type (might be due to invalid IL or missing references)
//IL_01df: Unknown result type (might be due to invalid IL or missing references)
//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
//IL_0232: Unknown result type (might be due to invalid IL or missing references)
//IL_0237: Unknown result type (might be due to invalid IL or missing references)
//IL_023b: Unknown result type (might be due to invalid IL or missing references)
//IL_0240: Unknown result type (might be due to invalid IL or missing references)
//IL_0245: Unknown result type (might be due to invalid IL or missing references)
//IL_026a: Unknown result type (might be due to invalid IL or missing references)
//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
//IL_02d7: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
{
<>1__state = -1;
grabbing.kickDelay = 0.3f;
grabbing.kickForce = 100f;
grabbing.kickAngle = 90f;
grabbing.kickRange = 5f;
grabbing.kickDistance = 2f;
float num3 = 25f;
bool flag = false;
Vector3 zero = Vector3.zero;
<characters>5__2 = new List<Character>(Character.AllCharacters);
if (Object.op_Implicit((Object)(object)ZombieManager.Instance))
{
foreach (MushroomZombie zombie in ZombieManager.Instance.zombies)
{
<characters>5__2.Add(zombie.character);
}
}
<currentStamina>5__3 = grabbing.character.data.currentStamina;
grabbing.character.refs.animator.SetTrigger("Kick");
if (grabbing.character.refs.view.IsMine)
{
<>2__current = (object)new WaitForSeconds(grabbing.kickDelay);
<>1__state = 1;
return true;
}
goto IL_031f;
}
case 1:
<>1__state = -1;
foreach (Character item in <characters>5__2)
{
if ((Object)(object)item == (Object)(object)grabbing.character)
{
continue;
}
float num = Vector3.Distance(grabbing.character.Center, item.Center);
Vector3 lookDirection = grabbing.character.data.lookDirection;
if (!(num > grabbing.kickDistance) && !(Vector3.Angle(lookDirection, item.Center - grabbing.character.Center) > grabbing.kickAngle))
{
if (item.IsStuck() && item.IsLocal)
{
item.UnStick();
}
Vector3 val = grabbing.character.Center + lookDirection * num;
grabbing.character.refs.view.RPC("RPCA_KickImpact", (RpcTarget)0, new object[1] { val });
float num2 = 1f + (<currentStamina>5__3 - 0.1f) * 2f;
item.Fall(grabbing.kickRagdollTime, 0f);
Vector3 val2 = lookDirection * grabbing.kickForce * num2;
val2.y += 100f;
item.AddForceAtPosition(val2, val, grabbing.kickRange);
item.refs.afflictions.SubtractStatus((STATUSTYPE)11, 1f, false, false);
}
}
goto IL_031f;
case 2:
{
<>1__state = -1;
grabbing.kickParticle.Play();
return false;
}
IL_031f:
<>2__current = (object)new WaitForSeconds(grabbing.kickDelay);
<>1__state = 2;
return true;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[HarmonyPrefix]
public static bool Prefix(CharacterGrabbing __instance)
{
if (Plugin.MasterDisable)
{
return true;
}
if (Plugin.OwnDisable)
{
return true;
}
if (!Plugin.inAirport)
{
return true;
}
((MonoBehaviour)__instance).StartCoroutine(CustomKickRoutine(__instance));
return false;
}
[IteratorStateMachine(typeof(<CustomKickRoutine>d__1))]
private static IEnumerator CustomKickRoutine(CharacterGrabbing grabbing)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <CustomKickRoutine>d__1(0)
{
grabbing = grabbing
};
}
}
[HarmonyPatch(typeof(CharacterGrabbing), "Update")]
public static class CharacterGrabbing_Update_Patch
{
[CompilerGenerated]
private sealed class <Transpiler>d__1 : IEnumerable<CodeInstruction>, IEnumerable, IEnumerator<CodeInstruction>, IEnumerator, IDisposable
{
private int <>1__state;
private CodeInstruction <>2__current;
private int <>l__initialThreadId;
private IEnumerable<CodeInstruction> instructions;
public IEnumerable<CodeInstruction> <>3__instructions;
private bool <found>5__2;
private IEnumerator<CodeInstruction> <>7__wrap2;
CodeInstruction IEnumerator<CodeInstruction>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <Transpiler>d__1(int <>1__state)
{
this.<>1__state = <>1__state;
<>l__initialThreadId = Environment.CurrentManagedThreadId;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
int num = <>1__state;
if (num == -3 || (uint)(num - 1) <= 9u)
{
try
{
}
finally
{
<>m__Finally1();
}
}
<>7__wrap2 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: Expected O, but got Unknown
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: Expected O, but got Unknown
//IL_016d: Unknown result type (might be due to invalid IL or missing references)
//IL_0177: Expected O, but got Unknown
//IL_0194: Unknown result type (might be due to invalid IL or missing references)
//IL_019e: Expected O, but got Unknown
//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
//IL_01d8: Expected O, but got Unknown
//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
//IL_01ff: Expected O, but got Unknown
//IL_021c: Unknown result type (might be due to invalid IL or missing references)
//IL_0226: Expected O, but got Unknown
//IL_0243: Unknown result type (might be due to invalid IL or missing references)
//IL_024d: Expected O, but got Unknown
try
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<found>5__2 = false;
<>7__wrap2 = instructions.GetEnumerator();
<>1__state = -3;
break;
case 1:
<>1__state = -3;
<>2__current = new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(Plugin), "inAirport"));
<>1__state = 2;
return true;
case 2:
<>1__state = -3;
<>2__current = new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(Plugin), "MasterDisable"));
<>1__state = 3;
return true;
case 3:
<>1__state = -3;
<>2__current = new CodeInstruction(OpCodes.Not, (object)null);
<>1__state = 4;
return true;
case 4:
<>1__state = -3;
<>2__current = new CodeInstruction(OpCodes.And, (object)null);
<>1__state = 5;
return true;
case 5:
<>1__state = -3;
<>2__current = new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(Plugin), "OwnDisable"));
<>1__state = 6;
return true;
case 6:
<>1__state = -3;
<>2__current = new CodeInstruction(OpCodes.Not, (object)null);
<>1__state = 7;
return true;
case 7:
<>1__state = -3;
<>2__current = new CodeInstruction(OpCodes.And, (object)null);
<>1__state = 8;
return true;
case 8:
<>1__state = -3;
<>2__current = new CodeInstruction(OpCodes.Or, (object)null);
<>1__state = 9;
return true;
case 9:
<>1__state = -3;
break;
case 10:
<>1__state = -3;
break;
}
if (<>7__wrap2.MoveNext())
{
CodeInstruction current = <>7__wrap2.Current;
if (!<found>5__2 && current.opcode == OpCodes.Call && current.operand is MethodInfo methodInfo && methodInfo.Name == "get_isKickMode")
{
<found>5__2 = true;
Plugin.Log.LogMessage((object)"Patched: isKickMode replaced with toggle.");
<>2__current = current;
<>1__state = 1;
return true;
}
<>2__current = current;
<>1__state = 10;
return true;
}
<>m__Finally1();
<>7__wrap2 = null;
if (!<found>5__2)
{
Plugin.Log.LogMessage((object)"WARNING: get_isKickMode not found!");
}
return false;
}
catch
{
//try-fault
((IDisposable)this).Dispose();
throw;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
private void <>m__Finally1()
{
<>1__state = -1;
if (<>7__wrap2 != null)
{
<>7__wrap2.Dispose();
}
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
[DebuggerHidden]
IEnumerator<CodeInstruction> IEnumerable<CodeInstruction>.GetEnumerator()
{
<Transpiler>d__1 <Transpiler>d__;
if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
{
<>1__state = 0;
<Transpiler>d__ = this;
}
else
{
<Transpiler>d__ = new <Transpiler>d__1(0);
}
<Transpiler>d__.instructions = <>3__instructions;
return <Transpiler>d__;
}
[DebuggerHidden]
IEnumerator IEnumerable.GetEnumerator()
{
return ((IEnumerable<CodeInstruction>)this).GetEnumerator();
}
}
[HarmonyPrefix]
public static bool Prefix(CharacterGrabbing __instance)
{
if (__instance._kickTime < 0.6f)
{
__instance._kickTime = 0.6f;
}
return true;
}
[IteratorStateMachine(typeof(<Transpiler>d__1))]
[HarmonyTranspiler]
public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <Transpiler>d__1(-2)
{
<>3__instructions = instructions
};
}
}
[HarmonyPatch(typeof(Item), "Interact")]
public static class Interact_Patch
{
[HarmonyPostfix]
public static void Postfix(Item __instance, Character interactor)
{
if (!Plugin.inAirport || Plugin.MasterDisable || (Object)(object)interactor != (Object)(object)Character.localCharacter)
{
return;
}
string name = ((Object)__instance).name;
if (name.ToLower().Contains("binoculars") || name.ToLower().Contains("lollipop_prop"))
{
if (!Plugin.OwnDisable)
{
Plugin.Notification("Leg day skipped! <sprite=15>", "FF8C00", sound: true);
}
else
{
Plugin.Notification("Happy " + Plugin.AddColor("Kicking", "FF0000") + " ! <sprite=6>", "00FFFF", sound: true);
}
Plugin.OwnDisable = !Plugin.OwnDisable;
}
}
}
[HarmonyPatch(typeof(Player), "SyncInventoryRPC")]
public class SyncInventoryRPC_Patch
{
[HarmonyPostfix]
public static void Postfix(Player __instance, byte[] data, bool forceSync)
{
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
if (!Plugin.inAirport || __instance.character.view.Owner != PhotonNetwork.MasterClient || data == null || data.Length == 0)
{
return;
}
InventorySyncData fromManagedArray = IBinarySerializable.GetFromManagedArray<InventorySyncData>(data);
if (fromManagedArray.tempSlot.ItemID != ushort.MaxValue && fromManagedArray.tempSlot.Data != null)
{
string itemName = GetItemName(fromManagedArray.tempSlot.ItemID);
if (itemName.ToLower().Contains("binoculars") || itemName.ToLower().Contains("lollipop_prop"))
{
if (!Plugin.MasterDisable)
{
Plugin.Notification("Leg day skipped by Master Client! <sprite=15>", "FF8C00", sound: true);
}
Plugin.MasterDisable = true;
}
}
for (int i = 0; i < fromManagedArray.slots.Length; i++)
{
SlotData val = fromManagedArray.slots[i];
if (val.ItemID == ushort.MaxValue)
{
continue;
}
string itemName2 = GetItemName(val.ItemID);
if (itemName2.ToLower().Contains("binoculars") || itemName2.ToLower().Contains("lollipop_prop"))
{
if (!Plugin.MasterDisable)
{
Plugin.Notification("Leg day skipped by Master Client! <sprite=15>", "FF8C00", sound: true);
}
Plugin.MasterDisable = true;
}
}
}
}
public static string GetItemName(ushort itemID)
{
Item val = default(Item);
if (ItemDatabase.TryGetItem(itemID, ref val))
{
return ((Object)val).name ?? "Unknown";
}
return "Not Found";
}
}
[BepInPlugin("my.pahsiv.MyLegDay", "MyLegDay", "0.1.1")]
public class Plugin : BaseUnityPlugin
{
[CompilerGenerated]
private sealed class <EnableKickReminder>d__10 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <EnableKickReminder>d__10(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(5f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
Notification("Happy " + AddColor("Kicking", "FF0000") + " ! <sprite=6>", "00FFFF", sound: true);
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 string currentScene = "";
public static bool inAirport = false;
public static bool MasterDisable = false;
public static bool OwnDisable = false;
public const string Id = "my.pahsiv.MyLegDay";
internal static ManualLogSource Log { get; private set; } = null;
public static string Name => "MyLegDay";
public static string Version => "0.1.1";
private void Awake()
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Expected O, but got Unknown
Log = ((BaseUnityPlugin)this).Logger;
Harmony val = new Harmony("my.pahsiv.MyLegDay");
val.PatchAll();
VerifyPatch(val);
SceneManager.sceneLoaded += OnSceneLoaded;
Log.LogMessage((object)(" Plugin " + Name + " " + Version + " is loaded!"));
}
private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
currentScene = ((Scene)(ref scene)).name;
if (((Scene)(ref scene)).name == "Airport")
{
inAirport = true;
((MonoBehaviour)this).StartCoroutine(EnableKickReminder());
}
else if (((Scene)(ref scene)).name.Contains("Level_"))
{
inAirport = false;
}
else
{
inAirport = false;
MasterDisable = false;
OwnDisable = false;
}
}
[IteratorStateMachine(typeof(<EnableKickReminder>d__10))]
private IEnumerator EnableKickReminder()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <EnableKickReminder>d__10(0);
}
private void VerifyPatch(Harmony harmony)
{
IEnumerable<MethodBase> patchedMethods = harmony.GetPatchedMethods();
Log.LogMessage((object)$" Total patched methods: {patchedMethods.Count()}");
foreach (MethodBase item in patchedMethods)
{
Log.LogMessage((object)(" Patched: " + item.DeclaringType?.Name + "." + item.Name));
}
}
public static void Notification(string message, string color = "FFFFFF", bool sound = false)
{
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
PlayerConnectionLog val = Object.FindFirstObjectByType<PlayerConnectionLog>();
if ((Object)(object)val == (Object)null)
{
return;
}
string text = "<color=#" + color + ">" + message + "</color>";
MethodInfo method = typeof(PlayerConnectionLog).GetMethod("AddMessage", BindingFlags.Instance | BindingFlags.NonPublic);
if (method != null)
{
method.Invoke(val, new object[1] { text });
if ((Object)(object)val.sfxJoin != (Object)null && sound)
{
val.sfxJoin.Play(default(Vector3));
}
}
else
{
Log.LogMessage((object)"AddMessage method not found.");
}
}
public static string AddColor(string text, string color)
{
return "<color=#" + color + ">" + text + "</color>";
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}