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.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using UnityEngine;
using UnityEngine.InputSystem;
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.2.0")]
[assembly: AssemblyInformationalVersion("0.1.2")]
[assembly: AssemblyProduct("my.pahsiv.MyLegDay")]
[assembly: AssemblyTitle("MyLegDay")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.2.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;
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_008a: 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_031c: Unknown result type (might be due to invalid IL or missing references)
//IL_0326: Expected O, but got Unknown
//IL_0154: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Expected O, but got Unknown
//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0200: Unknown result type (might be due to invalid IL or missing references)
//IL_023e: Unknown result type (might be due to invalid IL or missing references)
//IL_0243: Unknown result type (might be due to invalid IL or missing references)
//IL_0247: Unknown result type (might be due to invalid IL or missing references)
//IL_024c: Unknown result type (might be due to invalid IL or missing references)
//IL_0251: Unknown result type (might be due to invalid IL or missing references)
//IL_0276: Unknown result type (might be due to invalid IL or missing references)
//IL_028e: Unknown result type (might be due to invalid IL or missing references)
//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
//IL_02e2: 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;
grabbing.kickRagdollTime = 0.1f;
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);
}
}
float currentStamina = 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_0310;
}
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 });
grabbing.kickImpactSFX.Play(val);
float num2 = 3f;
item.Fall(grabbing.kickRagdollTime, 0f);
Vector3 val2 = lookDirection * grabbing.kickForce * num2;
val2.y += 100f;
item.AddForceAtPosition(val2, val, grabbing.kickRange);
}
}
goto IL_0310;
case 2:
{
<>1__state = -1;
grabbing.kickParticle.Play();
return false;
}
IL_0310:
<>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;
}
__instance.character.data.isKicking = false;
((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(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)
{
Utilities.Notification("Leg day skipped! <sprite=15>", "FF8C00", sound: true);
}
else
{
Utilities.Notification("Happy " + Utilities.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)
{
Utilities.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)
{
Utilities.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.2")]
public class Plugin : BaseUnityPlugin
{
[CompilerGenerated]
private sealed class <EnableKickReminder>d__15 : 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__15(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;
Utilities.Notification("Happy " + Utilities.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 static ConfigEntry<KeyCode> AirportKick;
private static InputAction? AirportKickAction;
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.2";
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();
Utilities.VerifyPatch(val);
SceneManager.sceneLoaded += OnSceneLoaded;
AirportKick = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "Kick Hotkey", (KeyCode)120, "Press to kick in Airport!");
AirportKick.SettingChanged += AirportKick_SettingChanged;
InitializeAirportKickAction();
Log.LogMessage((object)(" Plugin " + Name + " " + Version + " is loaded!"));
}
private void AirportKick_SettingChanged(object sender, EventArgs e)
{
InitializeAirportKickAction();
}
private void InitializeAirportKickAction()
{
//IL_0020: 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_003f: Expected O, but got Unknown
if (AirportKickAction != null)
{
AirportKickAction.Disable();
AirportKickAction.Dispose();
}
string text = Utilities.ConvertKeyCodeToInputPath(AirportKick.Value);
AirportKickAction = new InputAction("AirportKick", (InputActionType)1, text, (string)null, (string)null, (string)null);
AirportKickAction.performed += AirportKickAction_performed;
AirportKickAction.Enable();
}
private void AirportKickAction_performed(CallbackContext obj)
{
if (!MasterDisable && !OwnDisable && inAirport)
{
Character.localCharacter.refs.view.RPC("RPCA_Kick", (RpcTarget)0, Array.Empty<object>());
}
}
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__15))]
private IEnumerator EnableKickReminder()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <EnableKickReminder>d__15(0);
}
}
public static class Utilities
{
public static void VerifyPatch(Harmony harmony)
{
IEnumerable<MethodBase> patchedMethods = harmony.GetPatchedMethods();
Plugin.Log.LogMessage((object)$" Total patched methods: {patchedMethods.Count()}");
foreach (MethodBase item in patchedMethods)
{
Plugin.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
{
Plugin.Log.LogWarning((object)"AddMessage method not found.");
}
}
public static string AddColor(string text, string color)
{
return "<color=#" + color + ">" + text + "</color>";
}
public static string ConvertKeyCodeToInputPath(KeyCode keyCode)
{
string text = ((object)(KeyCode)(ref keyCode)).ToString();
if (text.StartsWith("Keypad"))
{
text = text.Replace("Keypad", "numpad");
}
return "<Keyboard>/" + text.ToLower();
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}