using System;
using System.Collections;
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.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("PRZ_AlwaysKickFriendAss")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("PRZ_AlwaysKickFriendAss")]
[assembly: AssemblyTitle("PRZ_AlwaysKickFriendAss")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[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 PRZ_AlwaysKickFriendAss
{
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public static class KKeyKickMode
{
private static float lastKickTime;
public static bool Prefix(Character ___character, ref bool __result)
{
if ((Object)(object)___character == (Object)null || (Object)(object)___character.data == (Object)null)
{
return true;
}
if (Input.GetKeyDown((KeyCode)107))
{
lastKickTime = Time.time;
}
bool flag = Time.time - lastKickTime < 0.3f;
if (___character.data.isKicking || flag)
{
__result = true;
return false;
}
return true;
}
}
[HarmonyPatch(typeof(CharacterGrabbing), "Start")]
public static class BoostKick
{
public static void Postfix(CharacterGrabbing __instance)
{
__instance.kickForce = 100f;
__instance.kickRange = 50f;
__instance.kickRagdollTime = 3f;
}
}
public class AssGUI : MonoBehaviour
{
public static AssGUI Instance;
private GUIStyle normalStyle;
private bool isEnglish = true;
private bool showPanel = false;
private Rect panelRect = new Rect(0f, 0f, 360f, 200f);
private bool positionSet = false;
private string powerInput = "1";
private void Awake()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
Instance = this;
normalStyle = new GUIStyle();
normalStyle.fontSize = 16;
normalStyle.normal.textColor = Color.white;
}
public void TogglePanel()
{
showPanel = !showPanel;
}
public void ToggleLang()
{
isEnglish = !isEnglish;
}
private void OnGUI()
{
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Expected O, but got Unknown
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
if (showPanel)
{
if (!positionSet)
{
panelRect = new Rect((float)(Screen.width - 370), 10f, 360f, 200f);
positionSet = true;
}
panelRect = GUI.Window(0, panelRect, new WindowFunction(DrawPanel), "PRZ - AKFA v2.2.0");
}
}
private void DrawPanel(int windowID)
{
//IL_002d: 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_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_0152: Unknown result type (might be due to invalid IL or missing references)
//IL_0197: Unknown result type (might be due to invalid IL or missing references)
//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
//IL_01f6: 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_0212: Unknown result type (might be due to invalid IL or missing references)
//IL_0217: Unknown result type (might be due to invalid IL or missing references)
//IL_021b: Unknown result type (might be due to invalid IL or missing references)
//IL_0220: 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_023c: 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_025c: Unknown result type (might be due to invalid IL or missing references)
//IL_0261: Unknown result type (might be due to invalid IL or missing references)
//IL_0265: 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_0281: Unknown result type (might be due to invalid IL or missing references)
//IL_0286: Unknown result type (might be due to invalid IL or missing references)
//IL_028a: Unknown result type (might be due to invalid IL or missing references)
//IL_028f: Unknown result type (might be due to invalid IL or missing references)
//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
//IL_0357: Unknown result type (might be due to invalid IL or missing references)
//IL_03fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0433: Unknown result type (might be due to invalid IL or missing references)
Plugin instance = Plugin.Instance;
if ((Object)(object)instance == (Object)null)
{
return;
}
GUI.Label(new Rect(10f, 30f, 80f, 25f), isEnglish ? "Power:" : "力度:", normalStyle);
powerInput = GUI.TextField(new Rect(90f, 30f, 80f, 25f), powerInput);
if (float.TryParse(powerInput, out var result))
{
if (result < 0.5f)
{
result = 0.5f;
powerInput = "0.5";
}
else if (result > 500f)
{
result = 500f;
powerInput = "500";
}
Plugin.KickPower = result;
}
GUI.Label(new Rect(180f, 30f, 120f, 25f), "(0.5~500)", normalStyle);
string text = (instance.IsTracking ? "ON" : "OFF");
string text2 = "None";
Character currentTarget = instance.GetCurrentTarget();
if ((Object)(object)currentTarget != (Object)null)
{
text2 = currentTarget.characterName;
}
GUI.Label(new Rect(10f, 65f, 200f, 25f), isEnglish ? ("Track: " + text) : ("追踪: " + text), normalStyle);
GUI.Label(new Rect(10f, 95f, 340f, 25f), (isEnglish ? "Target: " : "目标: ") + text2, normalStyle);
KeyboardShortcut value = instance.KeyKick.Value;
string text3 = ((object)((KeyboardShortcut)(ref value)).MainKey/*cast due to .constrained prefix*/).ToString();
value = instance.KeyTrack.Value;
string text4 = ((object)((KeyboardShortcut)(ref value)).MainKey/*cast due to .constrained prefix*/).ToString();
value = instance.KeyTarget.Value;
string text5 = ((object)((KeyboardShortcut)(ref value)).MainKey/*cast due to .constrained prefix*/).ToString();
value = instance.KeyPull.Value;
string text6 = ((object)((KeyboardShortcut)(ref value)).MainKey/*cast due to .constrained prefix*/).ToString();
value = instance.KeyPanel.Value;
string text7 = ((object)((KeyboardShortcut)(ref value)).MainKey/*cast due to .constrained prefix*/).ToString();
value = instance.KeyLang.Value;
string text8 = ((object)((KeyboardShortcut)(ref value)).MainKey/*cast due to .constrained prefix*/).ToString();
GUI.Label(new Rect(10f, 125f, 340f, 25f), isEnglish ? ("[" + text3 + "]Kick [" + text6 + "]Pull [" + text5 + "]Target") : ("[" + text3 + "]踢 [" + text6 + "]拉 [" + text5 + "]换"), normalStyle);
GUI.Label(new Rect(10f, 150f, 340f, 25f), isEnglish ? ("[" + text4 + "]Track [" + text8 + "]Lang [" + text7 + "]Panel") : ("[" + text4 + "]追踪 [" + text8 + "]语言 [" + text7 + "]面板"), normalStyle);
GUI.Label(new Rect(10f, 175f, 340f, 25f), isEnglish ? "Keys: editable in cfg" : "按键:可在cfg中修改", normalStyle);
GUI.DragWindow(new Rect(0f, 0f, 360f, 200f));
}
}
[BepInPlugin("com.prz.alwayskickfriendass", "PRZ - AlwaysKickFriendAss", "2.2.0")]
[BepInProcess("Peak.exe")]
public class Plugin : BaseUnityPlugin
{
public static Plugin Instance;
public static float KickPower = 1f;
public ConfigEntry<KeyboardShortcut> KeyKick;
public ConfigEntry<KeyboardShortcut> KeyTrack;
public ConfigEntry<KeyboardShortcut> KeyTarget;
public ConfigEntry<KeyboardShortcut> KeyPull;
public ConfigEntry<KeyboardShortcut> KeyPanel;
public ConfigEntry<KeyboardShortcut> KeyLang;
private List<Character> playerList = new List<Character>();
private Character currentTarget;
private int targetIndex = 0;
private bool isTracking = false;
private float pauseEndTime = 0f;
public bool IsTracking => isTracking;
private void Awake()
{
//IL_001f: 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_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Expected O, but got Unknown
Instance = this;
KeyKick = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "Kick", new KeyboardShortcut((KeyCode)107, Array.Empty<KeyCode>()), "踢人 / Kick");
KeyTrack = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "Track", new KeyboardShortcut((KeyCode)117, Array.Empty<KeyCode>()), "开关追踪 / Toggle tracking");
KeyTarget = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "Target", new KeyboardShortcut((KeyCode)105, Array.Empty<KeyCode>()), "切换目标 / Switch target");
KeyPull = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "Pull", new KeyboardShortcut((KeyCode)106, Array.Empty<KeyCode>()), "拉回 / Pull back");
KeyPanel = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "Panel", new KeyboardShortcut((KeyCode)288, Array.Empty<KeyCode>()), "开关面板 / Toggle panel");
KeyLang = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "Lang", new KeyboardShortcut((KeyCode)108, Array.Empty<KeyCode>()), "切换语言 / Switch language");
Harmony val = new Harmony("com.prz.alwayskickfriendass");
val.PatchAll();
((Component)this).gameObject.AddComponent<AssGUI>();
((BaseUnityPlugin)this).Logger.LogInfo((object)"PRZ - AlwaysKickFriendAss v2.1.0 loaded!");
}
private void Update()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
KeyboardShortcut value = KeyKick.Value;
if (((KeyboardShortcut)(ref value)).IsDown())
{
TriggerKick();
}
value = KeyTrack.Value;
if (((KeyboardShortcut)(ref value)).IsDown())
{
ToggleTracking();
}
value = KeyTarget.Value;
if (((KeyboardShortcut)(ref value)).IsDown())
{
SwitchTarget();
}
value = KeyPull.Value;
if (((KeyboardShortcut)(ref value)).IsDown())
{
ManualPullBack();
}
value = KeyPanel.Value;
if (((KeyboardShortcut)(ref value)).IsDown() && (Object)(object)AssGUI.Instance != (Object)null)
{
AssGUI.Instance.TogglePanel();
}
value = KeyLang.Value;
if (((KeyboardShortcut)(ref value)).IsDown() && (Object)(object)AssGUI.Instance != (Object)null)
{
AssGUI.Instance.ToggleLang();
}
bool flag = Time.time < pauseEndTime;
if (isTracking && !flag && (Object)(object)currentTarget != (Object)null)
{
FollowTarget();
}
}
public Character GetCurrentTarget()
{
return currentTarget;
}
private void SwitchTarget()
{
playerList = ScanPlayers();
if (playerList.Count != 0)
{
targetIndex = (targetIndex + 1) % playerList.Count;
currentTarget = playerList[targetIndex];
}
}
private void ToggleTracking()
{
isTracking = !isTracking;
if (isTracking)
{
playerList = ScanPlayers();
if (playerList.Count > 0)
{
currentTarget = playerList[targetIndex % playerList.Count];
}
}
else
{
RestoreGravity();
}
}
private void ManualPullBack()
{
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: 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_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
Character localCharacter = GetLocalCharacter();
if ((Object)(object)currentTarget == (Object)null || (Object)(object)localCharacter == (Object)null)
{
((BaseUnityPlugin)this).Logger.LogWarning((object)"拉回失败: 没有目标或本地角色");
return;
}
if ((Object)(object)((MonoBehaviourPun)currentTarget).photonView == (Object)null)
{
((BaseUnityPlugin)this).Logger.LogWarning((object)"拉回失败: 目标没有 PhotonView");
return;
}
Vector3 worldPosition = GetWorldPosition(localCharacter);
Vector3 val = worldPosition + ((Component)localCharacter).transform.right * 1.1f + Vector3.up * 0.15f;
try
{
((MonoBehaviourPun)currentTarget).photonView.RPC("WarpPlayerRPC", (RpcTarget)0, new object[2] { val, false });
((BaseUnityPlugin)this).Logger.LogInfo((object)$"拉回 {currentTarget.characterName} 到 {val}");
}
catch (Exception ex)
{
((BaseUnityPlugin)this).Logger.LogError((object)("拉回失败: " + ex.Message));
}
}
private Vector3 GetWorldPosition(Character c)
{
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: 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)
Rigidbody[] componentsInChildren = ((Component)c).GetComponentsInChildren<Rigidbody>(true);
string[] array = new string[6] { "hip", "hips", "pelvis", "torso", "chest", "body" };
string[] array2 = array;
foreach (string value in array2)
{
Rigidbody[] array3 = componentsInChildren;
foreach (Rigidbody val in array3)
{
if (!((Object)(object)val == (Object)null) && ((Component)val).gameObject.activeInHierarchy && ((Object)val).name.ToLower().Contains(value))
{
return val.worldCenterOfMass;
}
}
}
if (componentsInChildren.Length != 0)
{
return componentsInChildren[0].worldCenterOfMass;
}
return ((Component)c).transform.position;
}
private List<Character> ScanPlayers()
{
List<Character> list = new List<Character>();
foreach (Character allCharacter in Character.AllCharacters)
{
if ((Object)(object)((MonoBehaviourPun)allCharacter).photonView != (Object)null && !((MonoBehaviourPun)allCharacter).photonView.IsMine)
{
list.Add(allCharacter);
}
}
return list;
}
private void FollowTarget()
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_0151: Unknown result type (might be due to invalid IL or missing references)
//IL_0156: Unknown result type (might be due to invalid IL or missing references)
//IL_0166: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
Character localCharacter = GetLocalCharacter();
if (!((Object)(object)localCharacter == (Object)null) && !((Object)(object)currentTarget == (Object)null))
{
Vector3 center = currentTarget.Center;
Vector3 center2 = localCharacter.Center;
Vector3 val = center - center2;
val.y = 0f;
float magnitude = ((Vector3)(ref val)).magnitude;
float num = ((magnitude > 15f) ? 100f : ((magnitude > 8f) ? 40f : ((!(magnitude > 3f)) ? 5f : 15f)));
Vector3 val2 = ((!(magnitude > 0.1f)) ? center : (center - ((Vector3)(ref val)).normalized * 0.5f));
val2.y += 0.9f;
Rigidbody val3 = ((Component)localCharacter).GetComponent<Rigidbody>();
if ((Object)(object)val3 == (Object)null)
{
val3 = ((Component)localCharacter).GetComponentInChildren<Rigidbody>();
}
if ((Object)(object)val3 != (Object)null)
{
val3.useGravity = false;
Vector3 val4 = val2 - center2;
Vector3 normalized = ((Vector3)(ref val4)).normalized;
val3.velocity = normalized * num;
}
else
{
((Component)localCharacter).transform.position = Vector3.Lerp(((Component)localCharacter).transform.position, val2, Time.deltaTime * (num / 10f));
}
}
}
private void RestoreGravity()
{
Character localCharacter = GetLocalCharacter();
if (!((Object)(object)localCharacter == (Object)null))
{
Rigidbody val = ((Component)localCharacter).GetComponent<Rigidbody>();
if ((Object)(object)val == (Object)null)
{
val = ((Component)localCharacter).GetComponentInChildren<Rigidbody>();
}
if ((Object)(object)val != (Object)null)
{
val.useGravity = true;
}
}
}
private void TriggerKick()
{
Character localCharacter = GetLocalCharacter();
if (!((Object)(object)localCharacter == (Object)null))
{
localCharacter.data.currentStamina = KickPower;
localCharacter.data.sincePressReach = 0f;
localCharacter.data.isKicking = false;
localCharacter.data.isGrounded = true;
((MonoBehaviour)this).StartCoroutine(DrainStamina(localCharacter));
pauseEndTime = Time.time + 3f;
}
}
private IEnumerator DrainStamina(Character local)
{
yield return (object)new WaitForSeconds(1f);
if ((Object)(object)local != (Object)null && (Object)(object)local.data != (Object)null)
{
local.data.currentStamina = 0f;
}
}
private Character GetLocalCharacter()
{
foreach (Character allCharacter in Character.AllCharacters)
{
PhotonView component = ((Component)allCharacter).gameObject.GetComponent<PhotonView>();
if ((Object)(object)component != (Object)null && component.IsMine)
{
return allCharacter;
}
}
return null;
}
}
}