using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
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 PEAKLib.Core;
using PEAKLib.Items.UnityEditor;
using Photon.Pun;
using PvPEAK.BoxingGlove.GameObjects;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.InputSystem.Utilities;
[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.HuFlungDu.PvPEAK.BoxingGlove")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("com.github.HuFlungDu.PvPEAK.BoxingGlove")]
[assembly: AssemblyTitle("PvPEAK.BoxingGlove")]
[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 PvPEAK.BoxingGlove
{
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.github.HuFlungDu.PvPEAK.BoxingGlove", "PvPEAK.BoxingGlove", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
internal static ManualLogSource Logger;
private readonly Harmony _harmony = new Harmony("com.github.HuFlungDu.PvPEAK.BoxingGlove");
public static GameObject? prefab;
public static PeakBundle? item_bundle;
public static DebugObject? debug_object;
public const string Id = "com.github.HuFlungDu.PvPEAK.BoxingGlove";
public static string Name => "PvPEAK.BoxingGlove";
public static string Version => "1.0.0";
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
Logger.LogInfo((object)"Plugin com.github.HuFlungDu.PvPEAK.BoxingGlove is loaded!");
BundleLoader.LoadBundleWithName((BaseUnityPlugin)(object)this, "pvpeak-boxingglove.peakbundle", (Action<PeakBundle>)delegate(PeakBundle peakBundle)
{
item_bundle = peakBundle;
UnityItemContent val = peakBundle.LoadAsset<UnityItemContent>("BoxingGlove");
SFX_Instance val2 = peakBundle.LoadAsset<SFX_Instance>("SFXI Boing");
SFX_Instance val3 = peakBundle.LoadAsset<SFX_Instance>("SFXI Punch");
prefab = val.ItemPrefab;
BoxingGloveSFXReference boxingGloveSFXReference = prefab.AddComponent<BoxingGloveSFXReference>();
boxingGloveSFXReference.boing = (SFX_Instance[])(object)new SFX_Instance[1] { val2 };
boxingGloveSFXReference.punch = (SFX_Instance[])(object)new SFX_Instance[1] { val3 };
prefab.AddComponent<PvPEAK.BoxingGlove.GameObjects.BoxingGlove>();
peakBundle.Mod.RegisterContent();
});
Utility.CreateLocalization();
}
private void OnDestroy()
{
Object.Destroy((Object)(object)((Component)debug_object).gameObject);
Object.Destroy((Object)(object)prefab);
}
}
public static class Utility
{
public static List<Vector3> GetEvenlySpacedPointsAroundCampfire(int numPoints, float innerRadius, float outerRadius, Vector3 campfirePosition, Vector3 campfireAngles, Segment advanceToSegment)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: 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_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
List<Vector3> list = new List<Vector3>();
Quaternion val = Quaternion.Euler(campfireAngles);
Vector3 val2 = default(Vector3);
for (int i = 0; i < numPoints; i++)
{
float num = outerRadius;
if (i % 2 == 0)
{
num = innerRadius;
}
float num2 = (float)i * MathF.PI * 2f / (float)numPoints;
float num3 = num * Mathf.Cos(num2);
float num4 = num * Mathf.Sin(num2);
((Vector3)(ref val2))..ctor(num3, 0f, num4);
Vector3 val3 = val * val2;
Vector3 val4 = campfirePosition + val3;
val4.y += -0.05f;
Vector3 val5 = SetToGround(val4);
if (Vector3.Distance(val4, val5) <= 1f)
{
val4 = val5;
}
list.Add(val4);
}
return list;
}
private static Vector3 SetToGround(Vector3 vector)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
return HelperFunctions.GetGroundPos(vector, (LayerType)1, 0f);
}
public static Item Add(Item item, Vector3 position, Quaternion rotation)
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
Plugin.Logger.LogInfo((object)$"Spawn item: {((Object)item).name} at {position}");
if (!PhotonNetwork.IsConnected)
{
return null;
}
return PhotonNetwork.InstantiateItemRoom(((Object)item).name, position, rotation).GetComponent<Item>();
}
public static void CreateLocalization()
{
LocalizedText.mainTable["NAME_BOXING GLOVE"] = new List<string>(15)
{
"BOXING GLOVE", "GANT DE BOXE", "GUANTONE DA BOXE", "BOXHANDSCHUH", "GUANTE DE BOXEO", "GUANTE DE BOXEO", "LUVA DE BOXE", "БОКСЕРСКАЯ ПЕРЧАТКА", "БОКСЕРСЬКА РУКАВИЧКА", "拳击手套",
"拳擊手套", "ボクシンググローブ", "복싱 글러브", "RĘKAWICA BOKSERSKA", "BOKS ELDİVENİ"
};
LocalizedText.mainTable["PUNCH"] = new List<string>(15)
{
"Punch", "Punch", "Punch", "Stempel", "Puñetazo", "Puñetazo", "Soco", "Ударить кулаком", "удар", "冲床",
"沖床", "パンチ", "펀치", "Dziurkacz", "Yumruk"
};
}
}
}
namespace PvPEAK.BoxingGlove.patches
{
public class DebugSpawnPatch
{
[HarmonyPatch(typeof(Campfire), "Awake")]
[HarmonyPostfix]
public static void Postfix(Campfire __instance)
{
if (PhotonNetwork.IsMasterClient && ((Object)((Component)((Component)__instance).gameObject.transform.parent).gameObject).name.ToLower().Contains("wings"))
{
SpawnBeachItems(__instance);
}
}
public static void SpawnBeachItems(Campfire campfire)
{
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: 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_00ac: Unknown result type (might be due to invalid IL or missing references)
Item component = Plugin.prefab.GetComponent<Item>();
BotSpawner component2 = GameObject.Find("BotSpawner").GetComponent<BotSpawner>();
if (!((Object)(object)component != (Object)null))
{
return;
}
foreach (Vector3 item in Utility.GetEvenlySpacedPointsAroundCampfire(4, 4f, 4f, ((Component)campfire).gameObject.transform.position, ((Component)campfire).gameObject.transform.eulerAngles, campfire.advanceToSegment))
{
Vector3 position = item + new Vector3(0f, 10f, 0f);
Quaternion rotation = Quaternion.Euler(0f, Random.Range(0f, 360f), 0f);
Item val = Utility.Add(component, position, rotation);
}
}
}
}
namespace PvPEAK.BoxingGlove.GameObjects
{
internal class BoxingGlove : ItemComponent
{
public Animator? anim;
public Item? item;
public BoxingGloveSFXReference sfx;
public Action_ReduceUses actionReduceUses;
public bool punching;
public float ragdollTime = 5f;
public float punchForce = 200f;
public float punchRange = 0.5f;
public void Awake()
{
((ItemComponent)this).Awake();
anim = ((Component)this).GetComponent<Animator>();
item = ((Component)this).GetComponent<Item>();
sfx = ((Component)this).GetComponent<BoxingGloveSFXReference>();
item.OnPrimaryFinishedCast = (Action)Delegate.Combine(item.OnPrimaryFinishedCast, new Action(OnPrimaryFinishedCast));
actionReduceUses = ((Component)this).GetComponent<Action_ReduceUses>();
}
public void OnPrimaryFinishedCast()
{
if (((MonoBehaviourPun)item).photonView.IsMine)
{
((MonoBehaviourPun)item).photonView.RPC("Punch_RPC", (RpcTarget)0, Array.Empty<object>());
}
}
[PunRPC]
public void Punch_RPC()
{
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
anim.SetTrigger("Punch");
punching = true;
for (int i = 0; i < sfx.boing.Length; i++)
{
sfx.boing[i].Play(((Component)this).transform.position);
}
}
public void OnPunchFinished()
{
punching = false;
}
public void OnPunchAnimationFinished()
{
if (((MonoBehaviourPun)item).photonView.IsMine)
{
((ItemActionBase)actionReduceUses).RunAction();
}
}
public override void OnInstanceDataSet()
{
}
public void OnCollisionEnter(Collision coll)
{
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: 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)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: 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_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
Character componentInParent = coll.gameObject.GetComponentInParent<Character>();
Plugin.Logger.LogInfo((object)"Colliding");
if (!Object.op_Implicit((Object)(object)componentInParent))
{
return;
}
Plugin.Logger.LogInfo((object)$"Colliding with ${componentInParent}");
if (!((MonoBehaviourPun)item).photonView.IsMine || !punching || !((Object)(object)item.holderCharacter != (Object)(object)componentInParent))
{
return;
}
Vector3 val = item.holderCharacter.Center - componentInParent.Center;
Vector3 normalized = ((Vector3)(ref val)).normalized;
componentInParent.Fall(ragdollTime, 0f);
Plugin.Logger.LogInfo((object)$"Force direction: {normalized}");
componentInParent.AddForceAtPosition(-normalized * punchForce, ((ContactPoint)(ref coll.contacts[0])).point, punchRange);
((MonoBehaviourPun)item).photonView.RPC("PunchSFX_RPC", (RpcTarget)0, Array.Empty<object>());
if (!componentInParent.isBot && !componentInParent.isZombie && !componentInParent.isScoutmaster)
{
componentInParent.view.RPC("RPCA_PassOut", (RpcTarget)0, Array.Empty<object>());
for (int i = 0; i < item.totalUses; i++)
{
((ItemActionBase)actionReduceUses).RunAction();
}
}
}
[PunRPC]
public void PunchSFX_RPC()
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
for (int i = 0; i < sfx.punch.Length; i++)
{
sfx.punch[i].Play(((Component)this).transform.position);
}
}
}
public class BoxingGloveSFXReference : MonoBehaviour
{
public SFX_Instance[] boing;
public SFX_Instance[] punch;
}
public class DebugObject : MonoBehaviour
{
private void Update()
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
if (!((ButtonControl)Keyboard.current.anyKey).wasPressedThisFrame)
{
return;
}
Enumerator<KeyControl> enumerator = Keyboard.current.allKeys.GetEnumerator();
try
{
while (enumerator.MoveNext())
{
KeyControl current = enumerator.Current;
Plugin.Logger.LogDebug((object)((InputControl)current).path);
if (((ButtonControl)current).wasPressedThisFrame && ((InputControl)current).path == "<Keyboard>/f3")
{
Plugin.Logger.LogInfo((object)"Pressed debug key");
}
}
}
finally
{
((IDisposable)enumerator).Dispose();
}
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}