using System;
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Resources;
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;
[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("com.github.Alobal.PeakPunch")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+8b42054079ab874de12d79b4c229623e8e5cb476")]
[assembly: AssemblyProduct("com.github.Alobal.PeakPunch")]
[assembly: AssemblyTitle("PeakPunch")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.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 PeakPunch
{
[BepInPlugin("com.github.Alobal.PeakPunch", "PeakPunch", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
private readonly Harmony _harmony = new Harmony("com.github.Alobal.PeakPunch");
public const string Id = "com.github.Alobal.PeakPunch";
internal static ManualLogSource Log { get; private set; }
public static string Name => "PeakPunch";
public static string Version => "1.0.0";
private void Awake()
{
Log = ((BaseUnityPlugin)this).Logger;
Log.LogInfo((object)("Plugin " + Name + " 加载成功!!!!!!!!!!"));
_harmony.PatchAll();
}
}
}
namespace PeakPunch.Properties
{
[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[DebuggerNonUserCode]
[CompilerGenerated]
internal class Resources
{
private static ResourceManager resourceMan;
private static CultureInfo resourceCulture;
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static ResourceManager ResourceManager
{
get
{
if (resourceMan == null)
{
ResourceManager resourceManager = new ResourceManager("PeakPunch.Properties.Resources", typeof(Resources).Assembly);
resourceMan = resourceManager;
}
return resourceMan;
}
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
internal Resources()
{
}
}
}
namespace PeakPunch.patches
{
[HarmonyPatch(typeof(CharacterInteractible))]
internal class CharacterInteractiblePatch
{
[HarmonyPatch("GetInteractionText")]
[HarmonyPostfix]
private static void GetInteractionTextPatch(ref string __result, CharacterInteractible __instance)
{
if (!(__result != "") && CanBeClimbed(__instance.character))
{
__result = "爬上去!";
}
}
[HarmonyPatch("Interact")]
[HarmonyPostfix]
private static void InteractPatch(CharacterInteractible __instance, ref Character interactor)
{
if (!__instance.CarriedByLocalCharacter() && (__instance.IsCannibal() || !__instance.CanBeCarried()) && CanBeClimbed(__instance.character) && CanClimb(interactor))
{
((MonoBehaviourPun)interactor).photonView.RPC("RPCA_PassOut", ((MonoBehaviourPun)__instance.character.player).photonView.Owner, Array.Empty<object>());
__instance.character.refs.carriying.StartCarry(interactor);
}
}
[HarmonyPatch("IsPrimaryInteractible")]
[HarmonyPostfix]
private static void IsPrimaryInteractiblePatch(CharacterInteractible __instance, ref bool __result, ref Character interactor)
{
if (!__result && CanBeClimbed(__instance.character) && CanClimb(interactor))
{
__result = true;
}
}
private static bool CanBeClimbed(Character ___character)
{
if (___character.IsLocal)
{
return false;
}
if (___character.data.dead)
{
return false;
}
if (___character.player.backpackSlot.hasBackpack)
{
return false;
}
if (IsCharacterDoingIllegalCarryActions(___character))
{
return false;
}
if (Object.op_Implicit((Object)(object)___character.data.carriedPlayer))
{
return false;
}
if (Object.op_Implicit((Object)(object)___character.data.carrier))
{
return false;
}
if (Object.op_Implicit((Object)(object)___character.data.currentItem) && ___character.data.currentItem.canUseOnFriend)
{
return false;
}
if (___character.refs.customization.isCannibalizable)
{
return false;
}
return true;
}
private static bool CanClimb(Character ___character)
{
if (___character.refs.interactible.CanBeCarried())
{
return true;
}
if (!___character.IsLocal)
{
return false;
}
if (___character.data.dead)
{
return false;
}
if (Object.op_Implicit((Object)(object)___character.data.currentItem))
{
return false;
}
if (Object.op_Implicit((Object)(object)___character.data.carrier))
{
return false;
}
if (Object.op_Implicit((Object)(object)___character.data.currentItem) && ___character.data.currentItem.canUseOnFriend)
{
return false;
}
if (___character.refs.customization.isCannibalizable)
{
return false;
}
return true;
}
[HarmonyPatch(typeof(CharacterCarrying), "RPCA_Drop")]
[HarmonyPrefix]
private static bool RPCA_DropPrefix(PhotonView targetView)
{
Character component = ((Component)targetView).GetComponent<Character>();
if (!targetView.IsMine)
{
return true;
}
if (!((Component)targetView).GetComponent<Character>().data.fullyPassedOut)
{
targetView.RPC("RPCA_UnPassOut", ((MonoBehaviourPun)component.data.carrier).photonView.Owner, Array.Empty<object>());
}
return true;
}
private static bool IsCharacterDoingIllegalCarryActions(Character character)
{
if (!character.data.isSprinting && !character.data.isJumping && !character.data.isClimbingAnything && !character.data.isCrouching)
{
return character.data.isReaching;
}
return true;
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}