using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.Rendering;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("qConquestMod")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("qConquestMod")]
[assembly: AssemblyTitle("qConquestMod")]
[assembly: AssemblyVersion("1.0.0.0")]
[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 qConquestMod
{
[HarmonyPatch(typeof(ENT_Player), "Movement")]
internal static class MovementPatch
{
private static bool Prefix(ENT_Player __instance)
{
return !Powers.FlightTick(__instance);
}
}
[HarmonyPatch(typeof(ENT_Player), "Jump")]
internal static class JumpPatch
{
private static void Postfix()
{
if (Plugin.Enabled.Value)
{
Sounds.Play(0.7f, 0.1f, "basic_move_sound_short_1", "basic_move_sound_short_2", "jump_exp");
}
}
}
[HarmonyPatch(typeof(ENT_Player), "Damage")]
internal static class PlayerDamagePatch
{
private static bool Prefix(ENT_Player __instance, ref bool __result)
{
if (!Plugin.Invulnerable.Value || !Powers.Active(__instance) || MassPatch.InMass)
{
return true;
}
__result = false;
return false;
}
}
[HarmonyPatch(typeof(ENT_Player), "Kill")]
internal static class PlayerKillPatch
{
private static bool Prefix(ENT_Player __instance)
{
if (!Plugin.Invulnerable.Value || !Powers.Active(__instance) || MassPatch.InMass)
{
return true;
}
return false;
}
}
[HarmonyPatch(typeof(DEN_DeathFloor), "Update")]
internal static class MassPatch
{
public static bool InMass;
private static void Prefix()
{
InMass = true;
}
private static Exception Finalizer(Exception __exception)
{
InMass = false;
return __exception;
}
}
[HarmonyPatch]
internal static class MaxDamagePatch
{
private static IEnumerable<MethodBase> TargetMethods()
{
Type[] args = new Type[1] { typeof(DamageInfo) };
return (from t in typeof(GameEntity).Assembly.GetTypes()
where t.IsClass && !t.IsAbstract && !t.ContainsGenericParameters && t != typeof(ENT_Player) && (typeof(Damageable).IsAssignableFrom(t) || typeof(Hitbox).IsAssignableFrom(t))
select t.GetMethod("Damage", BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, args, null) into m
where m != null && MethodBaseExtensions.HasMethodBody((MethodBase)m)
select m).Cast<MethodBase>().Distinct();
}
private static void Prefix(object __instance, DamageInfo info)
{
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: 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_00c5: 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_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
if (info != null && Plugin.MaxDamage.Value)
{
ENT_Player playerObject = ENT_Player.playerObject;
if (Powers.Active(playerObject) && !((Object)(object)info.sourceEntity != (Object)(object)playerObject) && __instance != playerObject && !info.HasTag("qConquest"))
{
info.amount = Mathf.Max(info.amount, Powers.LethalFor(__instance));
Sounds.Play(1f, 0.1f, "punch_1", "punch_2", "punch_3", "hPunch_1", "hPunch_2");
CL_CameraControl.Shake?.Invoke(0.15f);
Effects.Flash((info.position != Vector3.zero) ? info.position : (((Component)playerObject.cam).transform.position + ((Component)playerObject.cam).transform.forward), 5f, new Color(1f, 0.9f, 0.7f));
}
}
}
}
[BepInPlugin("q.whiteknuckle.conquest", "qConquestMod", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
public const string GUID = "q.whiteknuckle.conquest";
public const string Name = "qConquestMod";
public const string Version = "1.0.0";
internal static ManualLogSource Log;
internal static ConfigEntry<bool> Enabled;
internal static ConfigEntry<KeyCode> ToggleModKey;
internal static ConfigEntry<KeyCode> FlyKey;
internal static ConfigEntry<KeyCode> FastFlyKey;
internal static ConfigEntry<KeyCode> ClapKey;
internal static ConfigEntry<KeyCode> FlyUpKey;
internal static ConfigEntry<KeyCode> FlyDownKey;
internal static ConfigEntry<float> Volume;
internal static ConfigEntry<float> VoiceVolume;
internal static ConfigEntry<float> FlightVolume;
internal static ConfigEntry<float> HitVolume;
internal static ConfigEntry<float> FlySpeed;
internal static ConfigEntry<float> FlyMaxSpeed;
internal static ConfigEntry<float> FlyRamp;
internal static ConfigEntry<float> FlyResponsiveness;
internal static ConfigEntry<float> FlyStopSharpness;
internal static ConfigEntry<bool> HitStop;
internal static ConfigEntry<float> FastFlyMaxSpeed;
internal static ConfigEntry<float> FastFlyAccel;
internal static ConfigEntry<float> ImpactSpeed;
internal static ConfigEntry<float> ImpactRadius;
internal static ConfigEntry<float> SpeedMult;
internal static ConfigEntry<float> JumpMult;
internal static ConfigEntry<bool> Invulnerable;
internal static ConfigEntry<bool> MaxDamage;
internal static ConfigEntry<bool> BreakThrough;
internal static ConfigEntry<float> ClapRange;
internal static ConfigEntry<float> ClapRadius;
internal static ConfigEntry<float> ClapForce;
internal static ConfigEntry<float> ClapCooldown;
internal static ConfigEntry<float> RareLineMinSeconds;
internal static ConfigEntry<float> RareLineMaxSeconds;
private void Awake()
{
//IL_048f: Unknown result type (might be due to invalid IL or missing references)
Log = ((BaseUnityPlugin)this).Logger;
Enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Become Conquest.");
ToggleModKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keys", "ToggleModKey", (KeyCode)291, "Turns all powers on/off.");
FlyKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keys", "FlyKey", (KeyCode)118, "Toggles flight.");
FastFlyKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keys", "FastFlyKey", (KeyCode)120, "Toggles fast (destructive) flight towards the mouse direction.");
ClapKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keys", "ClapKey", (KeyCode)103, "Thunder clap.");
FlyUpKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keys", "FlyUpKey", (KeyCode)32, "Fly up while flying.");
FlyDownKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keys", "FlyDownKey", (KeyCode)306, "Fly down while flying.");
Volume = ((BaseUnityPlugin)this).Config.Bind<float>("Sound", "Volume", 1f, "Master volume for all mod sounds (0-1).");
VoiceVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Sound v2", "VoiceVolume", 2.5f, "Volume of Conquest's voice lines. Above 1 makes them louder than normal.");
FlightVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Sound v2", "FlightVolume", 0.35f, "Volume of flight sounds (wind, whooshes, sonic booms).");
HitVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Sound v2", "HitVolume", 2f, "Volume of punches, kills, smashes and claps. Above 1 makes them louder than normal.");
RareLineMinSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Sound", "RareLineMinSeconds", 180f, "Shortest time between random voice lines.");
RareLineMaxSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Sound", "RareLineMaxSeconds", 480f, "Longest time between random voice lines.");
FlySpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Flight v2", "FlySpeed", 30f, "Starting flight speed (m/s).");
FlyMaxSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Flight v2", "FlyMaxSpeed", 110f, "Normal flight speed after holding a direction for a while.");
FlyRamp = ((BaseUnityPlugin)this).Config.Bind<float>("Flight v2", "FlyRamp", 1.5f, "How fast normal flight speed grows while a direction is held.");
FlyResponsiveness = ((BaseUnityPlugin)this).Config.Bind<float>("Flight v2", "FlyResponsiveness", 25f, "How quickly flight turns and speeds up towards where you steer. Higher = snappier.");
FlyStopSharpness = ((BaseUnityPlugin)this).Config.Bind<float>("Flight v2", "FlyStopSharpness", 45f, "How hard you stop when letting go of the keys. Higher = more instant.");
FastFlyMaxSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Flight v2", "FastFlyMaxSpeed", 350f, "Top speed of fast flight (m/s).");
FastFlyAccel = ((BaseUnityPlugin)this).Config.Bind<float>("Flight v2", "FastFlyAccel", 150f, "Fast flight acceleration (m/s per second).");
ImpactSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Flight v2", "ImpactSpeed", 25f, "Speed above which hitting a wall makes a crash impact.");
ImpactRadius = ((BaseUnityPlugin)this).Config.Bind<float>("Flight v2", "ImpactRadius", 4f, "Radius of destruction of a crash impact at ImpactSpeed (grows with speed).");
BreakThrough = ((BaseUnityPlugin)this).Config.Bind<bool>("Flight v2", "BreakThrough", true, "Break anything breakable you fly into while holding a direction.");
HitStop = ((BaseUnityPlugin)this).Config.Bind<bool>("Effects", "HitStop", false, "Short game freeze on big hits. Off by default because it feels like lag.");
SpeedMult = ((BaseUnityPlugin)this).Config.Bind<float>("Body", "SpeedMult", 2f, "Walk/run speed multiplier.");
JumpMult = ((BaseUnityPlugin)this).Config.Bind<float>("Body", "JumpMult", 2.5f, "Jump height multiplier.");
Invulnerable = ((BaseUnityPlugin)this).Config.Bind<bool>("Body", "Invulnerable", true, "No damage or death from anything except the mass.");
MaxDamage = ((BaseUnityPlugin)this).Config.Bind<bool>("Body", "MaxDamage", true, "Everything you hit takes lethal damage.");
ClapRange = ((BaseUnityPlugin)this).Config.Bind<float>("Clap v2", "ClapRange", 35f, "Length of the clap shockwave.");
ClapRadius = ((BaseUnityPlugin)this).Config.Bind<float>("Clap v2", "ClapRadius", 4f, "Radius of the clap shockwave cylinder.");
ClapForce = ((BaseUnityPlugin)this).Config.Bind<float>("Clap v2", "ClapForce", 90f, "Speed (m/s) the clap throws objects at, close up. Fades with distance.");
ClapCooldown = ((BaseUnityPlugin)this).Config.Bind<float>("Clap v2", "ClapCooldown", 0.8f, "Seconds between claps.");
Sounds.Create(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "Sounds"));
new Harmony("q.whiteknuckle.conquest").PatchAll();
Log.LogInfo((object)"qConquestMod 1.0.0 loaded. I am Conquest.");
}
private void Update()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
if (Input.GetKeyDown(ToggleModKey.Value))
{
Enabled.Value = !Enabled.Value;
Sounds.Play(Enabled.Value ? "glowingEyes_on" : "glowingEyes_off");
Sounds.Play(Enabled.Value ? "xvision_start" : "xvision_end");
if (!Enabled.Value)
{
Powers.StopFlight(ENT_Player.playerObject, keepMomentum: false);
}
}
Powers.Update();
}
}
internal static class Powers
{
private static Vector3 flyVel;
private static float holdTime;
private static float fastSpeed;
private static bool boomed;
private static float lastImpactTime = -10f;
private static float lastClapTime = -10f;
private static float lastWhooshTime;
private static Vector3 lastDir;
private static float slideSoundTime;
private static ENT_Player lastPlayer;
private static float baseJump;
private static WorldLoader lastWorld;
private static float introTimer = -1f;
private static float rareTimer;
private static int killStreak;
private static float killStreakTime;
private static readonly FieldRef<ENT_Player, Vector3> velRef = AccessTools.FieldRefAccess<ENT_Player, Vector3>("vel");
public const string Tag = "qConquest";
private static readonly RaycastHit[] castBuffer = (RaycastHit[])(object)new RaycastHit[64];
private static readonly Collider[] overlapBuffer = (Collider[])(object)new Collider[256];
public static bool Flying { get; private set; }
public static bool FastFlying { get; private set; }
public static bool Active(ENT_Player p)
{
if (Plugin.Enabled.Value && (Object)(object)p != (Object)null)
{
return !((GameEntity)p).IsDead();
}
return false;
}
public static void Update()
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_017f: 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_01d2: Unknown result type (might be due to invalid IL or missing references)
ENT_Player playerObject = ENT_Player.playerObject;
if (Input.GetKeyDown(Plugin.FlyKey.Value) || Input.GetKeyDown(Plugin.FastFlyKey.Value) || Input.GetKeyDown(Plugin.ClapKey.Value))
{
Plugin.Log.LogInfo((object)($"Key pressed. player={(Object)(object)playerObject != (Object)null} enabled={Plugin.Enabled.Value} dead={(Object)(object)playerObject != (Object)null && ((GameEntity)playerObject).IsDead()} " + string.Format("paused={0} flying={1}", ((Object)(object)CL_GameManager.gMan != (Object)null) ? CL_GameManager.gMan.isPaused.ToString() : "no gMan", Flying)));
}
if ((Object)(object)playerObject == (Object)null)
{
return;
}
if ((Object)(object)playerObject != (Object)(object)lastPlayer)
{
lastPlayer = playerObject;
baseJump = playerObject.jumpHeight;
Flying = (FastFlying = false);
}
UpdateVoice();
UpdateLoops();
CL_GameManager gMan = CL_GameManager.gMan;
if (!Active(playerObject) || (Object)(object)gMan == (Object)null || gMan.isPaused)
{
if (!Plugin.Enabled.Value)
{
playerObject.SetSpeedMult(1f);
playerObject.jumpHeight = baseJump;
}
if (((GameEntity)playerObject).IsDead() && Flying)
{
StopFlight(playerObject, keepMomentum: false);
}
return;
}
playerObject.SetSpeedMult(Plugin.SpeedMult.Value);
playerObject.jumpHeight = baseJump * Plugin.JumpMult.Value;
if (Input.GetKeyDown(Plugin.FlyKey.Value))
{
if (Flying)
{
StopFlight(playerObject, keepMomentum: false);
}
else
{
StartFlight(playerObject);
}
}
if (Input.GetKeyDown(Plugin.FastFlyKey.Value))
{
if (!Flying)
{
StartFlight(playerObject);
}
SetFast(!FastFlying, playerObject);
}
if (Input.GetKeyDown(Plugin.ClapKey.Value))
{
Clap(playerObject);
}
}
private static void UpdateVoice()
{
WorldLoader instance = WorldLoader.instance;
if ((Object)(object)instance != (Object)(object)lastWorld)
{
lastWorld = instance;
if ((Object)(object)instance != (Object)null)
{
introTimer = 2f;
}
rareTimer = Random.Range(Plugin.RareLineMinSeconds.Value, Plugin.RareLineMaxSeconds.Value);
}
if (!Plugin.Enabled.Value || (Object)(object)instance == (Object)null)
{
return;
}
if (introTimer > 0f)
{
introTimer -= Time.unscaledDeltaTime;
if (introTimer <= 0f)
{
Sounds.RandomVoice();
}
}
rareTimer -= Time.deltaTime;
if (rareTimer <= 0f)
{
rareTimer = Random.Range(Plugin.RareLineMinSeconds.Value, Plugin.RareLineMaxSeconds.Value);
Sounds.RandomVoice();
}
if (killStreakTime > 0f && (killStreakTime -= Time.deltaTime) <= 0f)
{
killStreak = 0;
}
}
private static void OnKill()
{
killStreak++;
killStreakTime = 4f;
if (killStreak == 3)
{
Sounds.RandomVoice(0.6f);
}
else
{
Sounds.RandomVoice(0.08f);
}
}
private static void UpdateLoops()
{
bool flag = (Object)(object)CL_GameManager.gMan != (Object)null && CL_GameManager.gMan.isPaused;
float magnitude = ((Vector3)(ref flyVel)).magnitude;
float num = ((Flying && !flag) ? (Mathf.Clamp01(magnitude / Plugin.FlyMaxSpeed.Value) * 0.6f) : 0f);
float num2 = ((FastFlying && !flag) ? (0.25f + 0.5f * Mathf.Clamp01(magnitude / Plugin.FastFlyMaxSpeed.Value)) : 0f);
num *= Plugin.FlightVolume.Value;
num2 *= Plugin.FlightVolume.Value;
float num3 = 1f - Mathf.Exp(-10f * Time.unscaledDeltaTime);
if ((Object)(object)Sounds.WindLoop != (Object)null)
{
Sounds.WindLoop.volume = Mathf.Lerp(Sounds.WindLoop.volume, num * Sounds.Volume, num3);
Sounds.WindLoop.pitch = 0.85f + 0.4f * Mathf.Clamp01(magnitude / Plugin.FlyMaxSpeed.Value);
}
if ((Object)(object)Sounds.FastLoop != (Object)null)
{
Sounds.FastLoop.volume = Mathf.Lerp(Sounds.FastLoop.volume, num2 * Sounds.Volume, num3);
Sounds.FastLoop.pitch = 0.9f + 0.4f * Mathf.Clamp01(magnitude / Plugin.FastFlyMaxSpeed.Value);
}
}
public static void StartFlight(ENT_Player p)
{
//IL_003b: 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_004a: Unknown result type (might be due to invalid IL or missing references)
if (!Flying && !((Object)(object)p == (Object)null))
{
Flying = true;
Plugin.Log.LogInfo((object)"Flight started");
holdTime = 0f;
flyVel = velRef.Invoke(p) * 50f;
if (p.IsHanging())
{
p.DropHang(0.1f, 1f, false, "drop", false);
}
Sounds.Play("superWind_start");
Sounds.Play(0.6f, 0f, "jump_exp");
CL_CameraControl.Shake?.Invoke(0.08f);
}
}
public static void StopFlight(ENT_Player p, bool keepMomentum)
{
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: 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_0044: 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_0049: Unknown result type (might be due to invalid IL or missing references)
if (Flying)
{
Flying = false;
if (FastFlying)
{
SetFast(on: false, p);
}
if ((Object)(object)p != (Object)null)
{
velRef.Invoke(p) = (keepMomentum ? (flyVel / 175f) : Vector3.zero);
p.AddIgnoreFallDamageTime(2f);
}
flyVel = Vector3.zero;
Sounds.Play("wind_end");
}
}
private static void SetFast(bool on, ENT_Player p)
{
if (FastFlying != on)
{
FastFlying = on;
boomed = false;
if (on)
{
fastSpeed = Mathf.Max(((Vector3)(ref flyVel)).magnitude, Plugin.FlySpeed.Value * 2f);
Sounds.Play("fastFlight_start");
Sounds.Play(0.8f, 0f, "supersonicStart", "superSonic_launch_1");
CL_CameraControl.Shake?.Invoke(0.2f);
}
else
{
Sounds.Play("supersonicEnd");
}
}
}
public static bool FlightTick(ENT_Player p)
{
//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_0082: 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_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_0227: Unknown result type (might be due to invalid IL or missing references)
//IL_022c: 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_0238: Unknown result type (might be due to invalid IL or missing references)
//IL_023d: 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_0248: Unknown result type (might be due to invalid IL or missing references)
//IL_024d: Unknown result type (might be due to invalid IL or missing references)
//IL_0253: Unknown result type (might be due to invalid IL or missing references)
//IL_0258: Unknown result type (might be due to invalid IL or missing references)
//IL_025d: 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_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: 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)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: Unknown result type (might be due to invalid IL or missing references)
//IL_0278: Unknown result type (might be due to invalid IL or missing references)
//IL_027d: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_03e8: Unknown result type (might be due to invalid IL or missing references)
//IL_03ed: Unknown result type (might be due to invalid IL or missing references)
//IL_040a: Unknown result type (might be due to invalid IL or missing references)
//IL_040f: Unknown result type (might be due to invalid IL or missing references)
//IL_028b: Unknown result type (might be due to invalid IL or missing references)
//IL_028d: Unknown result type (might be due to invalid IL or missing references)
//IL_0168: Unknown result type (might be due to invalid IL or missing references)
//IL_016f: Unknown result type (might be due to invalid IL or missing references)
//IL_0179: Unknown result type (might be due to invalid IL or missing references)
//IL_0194: Unknown result type (might be due to invalid IL or missing references)
//IL_0199: Unknown result type (might be due to invalid IL or missing references)
//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
//IL_0334: Unknown result type (might be due to invalid IL or missing references)
//IL_0339: Unknown result type (might be due to invalid IL or missing references)
//IL_033d: Unknown result type (might be due to invalid IL or missing references)
//IL_0352: 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_044c: Unknown result type (might be due to invalid IL or missing references)
//IL_0451: Unknown result type (might be due to invalid IL or missing references)
//IL_0465: Unknown result type (might be due to invalid IL or missing references)
//IL_046b: Unknown result type (might be due to invalid IL or missing references)
//IL_0470: Unknown result type (might be due to invalid IL or missing references)
//IL_0475: Unknown result type (might be due to invalid IL or missing references)
//IL_047d: Unknown result type (might be due to invalid IL or missing references)
//IL_0482: Unknown result type (might be due to invalid IL or missing references)
//IL_0484: Unknown result type (might be due to invalid IL or missing references)
//IL_048a: Unknown result type (might be due to invalid IL or missing references)
//IL_048f: Unknown result type (might be due to invalid IL or missing references)
//IL_0491: Unknown result type (might be due to invalid IL or missing references)
//IL_052e: Unknown result type (might be due to invalid IL or missing references)
//IL_058b: Unknown result type (might be due to invalid IL or missing references)
//IL_0590: Unknown result type (might be due to invalid IL or missing references)
//IL_04a9: Unknown result type (might be due to invalid IL or missing references)
//IL_04b0: Unknown result type (might be due to invalid IL or missing references)
//IL_0436: Unknown result type (might be due to invalid IL or missing references)
//IL_043c: Unknown result type (might be due to invalid IL or missing references)
//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0208: Unknown result type (might be due to invalid IL or missing references)
//IL_020d: Unknown result type (might be due to invalid IL or missing references)
//IL_0579: Unknown result type (might be due to invalid IL or missing references)
//IL_057b: Unknown result type (might be due to invalid IL or missing references)
//IL_04cb: Unknown result type (might be due to invalid IL or missing references)
//IL_04d5: Unknown result type (might be due to invalid IL or missing references)
//IL_04df: Unknown result type (might be due to invalid IL or missing references)
//IL_04e4: Unknown result type (might be due to invalid IL or missing references)
//IL_04f0: Unknown result type (might be due to invalid IL or missing references)
//IL_04f5: Unknown result type (might be due to invalid IL or missing references)
//IL_04ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0501: Unknown result type (might be due to invalid IL or missing references)
if (!Flying)
{
return false;
}
if (!Active(p))
{
Plugin.Log.LogInfo((object)"Flight stopped: not active");
StopFlight(p, keepMomentum: false);
return false;
}
if (p.IsHanging())
{
Plugin.Log.LogInfo((object)"Flight stopped: hanging");
StopFlight(p, keepMomentum: false);
return false;
}
float fixedDeltaTime = Time.fixedDeltaTime;
Transform transform = ((Component)p.cam).transform;
Vector2 val = InputManager.GetVector("Move").vector;
if (CL_GameManager.gMan.lockPlayerInput)
{
val = Vector2.zero;
}
float num = (Input.GetKey(Plugin.FlyUpKey.Value) ? 1f : 0f) - (Input.GetKey(Plugin.FlyDownKey.Value) ? 1f : 0f);
float value = Plugin.FlyResponsiveness.Value;
bool flag;
if (FastFlying)
{
Vector3 val2 = transform.forward + transform.right * (val.x * 0.6f) + Vector3.up * (num * 0.6f);
float num2 = Plugin.FastFlyAccel.Value * ((val.y < -0.1f) ? (-1.5f) : (1f + Mathf.Max(0f, val.y)));
fastSpeed = Mathf.Clamp(fastSpeed + num2 * fixedDeltaTime, Plugin.FlySpeed.Value, Plugin.FastFlyMaxSpeed.Value);
flyVel = Vector3.Lerp(flyVel, ((Vector3)(ref val2)).normalized * fastSpeed, 1f - Mathf.Exp((0f - value) * 0.5f * fixedDeltaTime));
flag = true;
if (!boomed && ((Vector3)(ref flyVel)).magnitude > Plugin.FastFlyMaxSpeed.Value * 0.5f)
{
boomed = true;
Sounds.Play("sonic_boom_v2");
CL_CameraControl.Shake?.Invoke(0.35f);
Effects.Shockwave(((Component)p).transform.position, -((Vector3)(ref flyVel)).normalized, 6f, 0.4f);
}
}
else
{
Vector3 val3 = transform.forward * val.y + transform.right * val.x + Vector3.up * num;
flag = ((Vector3)(ref val3)).sqrMagnitude > 0.01f;
if (flag)
{
Vector3 normalized = ((Vector3)(ref val3)).normalized;
if ((holdTime == 0f || Vector3.Dot(normalized, lastDir) < 0.3f) && Time.time - lastWhooshTime > 0.25f)
{
lastWhooshTime = Time.time;
Sounds.Play(0.6f, 0f, "basic_move_sound_short_1", "basic_move_sound_short_2", "basic_move_sound_1", "basic_move_sound_2");
}
lastDir = normalized;
holdTime += fixedDeltaTime;
float num3 = Mathf.Min(Plugin.FlySpeed.Value * (1f + holdTime * Plugin.FlyRamp.Value), Plugin.FlyMaxSpeed.Value);
flyVel = Vector3.Lerp(flyVel, normalized * num3, 1f - Mathf.Exp((0f - value) * fixedDeltaTime));
}
else
{
if (holdTime > 0f && ((Vector3)(ref flyVel)).magnitude > Plugin.FlySpeed.Value * 0.5f)
{
Sounds.Play(Mathf.Clamp01(((Vector3)(ref flyVel)).magnitude / Plugin.FlyMaxSpeed.Value) + 0.3f, 0.15f, "supersonicEnd", "wind_end");
CL_CameraControl.Shake?.Invoke(0.05f);
}
holdTime = 0f;
flyVel = Vector3.Lerp(flyVel, Vector3.zero, 1f - Mathf.Exp((0f - Plugin.FlyStopSharpness.Value) * fixedDeltaTime));
}
}
if (flag && Plugin.BreakThrough.Value && ((Vector3)(ref flyVel)).sqrMagnitude > 1f)
{
SweepBreak(p, flyVel * fixedDeltaTime);
}
Vector3 position = ((Component)p).transform.position;
float magnitude = ((Vector3)(ref flyVel)).magnitude;
CollisionFlags val4 = p.cCon.Move(flyVel * fixedDeltaTime);
Vector3 val5 = (((Component)p).transform.position - position) / fixedDeltaTime;
if ((int)val4 != 0 && magnitude > Plugin.ImpactSpeed.Value && Vector3.Dot(val5, ((Vector3)(ref flyVel)).normalized) < magnitude * 0.5f)
{
Impact(p, ((Component)p).transform.position + ((Vector3)(ref flyVel)).normalized * 0.8f, magnitude, -((Vector3)(ref flyVel)).normalized);
flyVel = val5;
if (FastFlying)
{
fastSpeed = Mathf.Max(Plugin.FlySpeed.Value, fastSpeed * 0.5f);
}
}
else if ((int)val4 != 0)
{
if (((Vector3)(ref val5)).magnitude > 8f && Time.time > slideSoundTime)
{
slideSoundTime = Time.time + 0.9f;
Sounds.Play(0.5f, 0f, "drag1");
}
flyVel = val5;
}
velRef.Invoke(p) = Vector3.zero;
p.AddIgnoreFallDamageTime(0.5f);
return true;
}
private static void SweepBreak(ENT_Player p, Vector3 step)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: 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_0037: 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_0042: 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_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: 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_0058: 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_0069: 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_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: 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_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
CharacterController cCon = p.cCon;
Vector3 val = ((Component)p).transform.TransformPoint(cCon.center);
float num = Mathf.Max(0f, cCon.height * 0.5f - cCon.radius);
Vector3 val2 = val + Vector3.up * num;
Vector3 val3 = val - Vector3.up * num;
float num2 = ((Vector3)(ref step)).magnitude + 0.6f;
int num3 = Physics.CapsuleCastNonAlloc(val2, val3, cCon.radius * 1.1f, ((Vector3)(ref step)).normalized, castBuffer, num2, -1, (QueryTriggerInteraction)1);
HashSet<Object> done = new HashSet<Object>();
bool flag = false;
for (int i = 0; i < num3; i++)
{
RaycastHit val4 = castBuffer[i];
if (!((Object)(object)((RaycastHit)(ref val4)).collider == (Object)null) && !IsPlayer(p, ((RaycastHit)(ref val4)).collider))
{
Vector3 point = ((((RaycastHit)(ref val4)).point == Vector3.zero) ? ((Component)((RaycastHit)(ref val4)).collider).transform.position : ((RaycastHit)(ref val4)).point);
if (Smash(p, ((RaycastHit)(ref val4)).collider, point, ((Vector3)(ref step)).normalized * Mathf.Max(20f, ((Vector3)(ref flyVel)).magnitude), done, pushProps: false))
{
flag = true;
Physics.IgnoreCollision((Collider)(object)cCon, ((RaycastHit)(ref val4)).collider, true);
}
}
}
if (flag)
{
Sounds.Play(1f, 0.1f, "weaponBreak", "freeze_break_1", "freeze_break_2", "freeze_break_3", "pickup_smash_explode", "head_smash2");
CL_CameraControl.Shake?.Invoke(0.08f);
}
}
private static void Impact(ENT_Player p, Vector3 pos, float speed, Vector3 normal)
{
//IL_00b0: 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_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_013a: Unknown result type (might be due to invalid IL or missing references)
//IL_0169: Unknown result type (might be due to invalid IL or missing references)
//IL_016e: Unknown result type (might be due to invalid IL or missing references)
//IL_016f: Unknown result type (might be due to invalid IL or missing references)
//IL_0174: Unknown result type (might be due to invalid IL or missing references)
//IL_0178: Unknown result type (might be due to invalid IL or missing references)
//IL_017d: Unknown result type (might be due to invalid IL or missing references)
//IL_0184: Unknown result type (might be due to invalid IL or missing references)
//IL_0185: Unknown result type (might be due to invalid IL or missing references)
//IL_018a: 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)
if (Time.time - lastImpactTime < 0.25f)
{
return;
}
lastImpactTime = Time.time;
float num = speed / Plugin.ImpactSpeed.Value;
Sounds.Play(Mathf.Clamp01(0.5f + num * 0.25f), 0f, "head_ground_smash", "head_smash", "head_smash_attack", "pickup_smash_explode");
if (num > 2.5f)
{
Sounds.Play("solar_flare_exp", "thunderclap2");
}
CL_CameraControl.Shake?.Invoke(Mathf.Min(0.12f * num, 1.2f));
Effects.Flash(pos, 6f + num * 3f, new Color(1f, 0.85f, 0.6f));
Effects.Shockwave(pos, normal, 2f + num * 1.5f, 0.35f);
if (Plugin.HitStop.Value)
{
CL_GameManager gMan = CL_GameManager.gMan;
if (gMan != null)
{
gMan.FreezeForTime(Mathf.Min(0.03f * num, 0.1f), 0.05f);
}
}
float num2 = Plugin.ImpactRadius.Value * Mathf.Sqrt(num);
HashSet<Object> done = new HashSet<Object>();
int num3 = Physics.OverlapSphereNonAlloc(pos, num2, overlapBuffer, -1, (QueryTriggerInteraction)1);
for (int i = 0; i < num3; i++)
{
Collider val = overlapBuffer[i];
if (!IsPlayer(p, val))
{
Vector3 val2 = ((Component)val).transform.position - pos;
Vector3 normalized = ((Vector3)(ref val2)).normalized;
Smash(p, val, val.ClosestPoint(pos), normalized * Mathf.Min(speed, 80f), done, pushProps: false);
}
}
}
public static void Clap(ENT_Player p)
{
//IL_002f: 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_0041: 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_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: 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_005d: 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_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_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_015b: Unknown result type (might be due to invalid IL or missing references)
//IL_015c: Unknown result type (might be due to invalid IL or missing references)
//IL_019c: Unknown result type (might be due to invalid IL or missing references)
//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
//IL_01d4: 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_01db: Unknown result type (might be due to invalid IL or missing references)
//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0204: Unknown result type (might be due to invalid IL or missing references)
//IL_0209: Unknown result type (might be due to invalid IL or missing references)
//IL_020e: 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_0221: 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_0243: Unknown result type (might be due to invalid IL or missing references)
//IL_0244: Unknown result type (might be due to invalid IL or missing references)
//IL_0249: Unknown result type (might be due to invalid IL or missing references)
//IL_0298: Unknown result type (might be due to invalid IL or missing references)
//IL_029d: Unknown result type (might be due to invalid IL or missing references)
//IL_02a3: 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_02ad: Unknown result type (might be due to invalid IL or missing references)
if (Time.time - lastClapTime < Plugin.ClapCooldown.Value)
{
return;
}
lastClapTime = Time.time;
Transform transform = ((Component)p.cam).transform;
Vector3 forward = transform.forward;
float value = Plugin.ClapRange.Value;
Vector3 val = transform.position + forward * 0.5f;
Vector3 val2 = transform.position + forward * value;
Sounds.Play("thunderclap1", "thunderclap2", "thunderclap3");
Sounds.Play(0.7f, 0f, "wind_attack_1", "wind_attack_2", "wind_attack_3");
CL_CameraControl.Shake?.Invoke(0.5f);
Effects.Flash(transform.position + forward * 2f, 15f, new Color(0.8f, 0.9f, 1f));
Effects.ClapWave(transform.position + forward * 1.2f, forward, Plugin.ClapRadius.Value, value);
if (Plugin.HitStop.Value)
{
CL_GameManager gMan = CL_GameManager.gMan;
if (gMan != null)
{
gMan.FreezeForTime(0.05f, 0.05f);
}
}
HashSet<Object> done = new HashSet<Object>();
int num = 0;
int num2 = Physics.OverlapCapsuleNonAlloc(val, val2, Plugin.ClapRadius.Value, overlapBuffer, -1, (QueryTriggerInteraction)2);
for (int i = 0; i < num2; i++)
{
Collider val3 = overlapBuffer[i];
if (!IsPlayer(p, val3))
{
float num3 = Mathf.Clamp01(Vector3.Dot(((Component)val3).transform.position - val, forward) / value);
Vector3 val4 = val + forward * (num3 * value);
Vector3 val5 = Vector3.ProjectOnPlane(((Component)val3).transform.position - val4, forward);
Vector3 val6 = forward + ((Vector3)(ref val5)).normalized * 0.35f + Vector3.up * 0.25f;
Vector3 force = ((Vector3)(ref val6)).normalized * Plugin.ClapForce.Value * Mathf.Lerp(1f, 0.4f, num3);
if (Smash(p, val3, val3.ClosestPoint(val), force, done, pushProps: true))
{
num++;
}
}
}
if (num > 0)
{
Sounds.Play(0.8f, 0f, "thunderclap_explode_victim");
}
ref Vector3 reference = ref velRef.Invoke(p);
reference -= forward * 0.03f;
}
public static bool Smash(ENT_Player p, Collider col, Vector3 point, Vector3 force, HashSet<Object> done, bool pushProps)
{
//IL_0154: Unknown result type (might be due to invalid IL or missing references)
//IL_015a: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: 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_01f0: Unknown result type (might be due to invalid IL or missing references)
//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
//IL_0205: Unknown result type (might be due to invalid IL or missing references)
//IL_020f: Unknown result type (might be due to invalid IL or missing references)
//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
bool result = false;
Rigidbody attachedRigidbody = col.attachedRigidbody;
bool flag = (Object)(object)attachedRigidbody != (Object)null && !attachedRigidbody.isKinematic;
GameEntity val = null;
Hitbox component = ((Component)col).GetComponent<Hitbox>();
if (component != null)
{
val = component.GetGameEntity();
}
if ((Object)(object)val == (Object)null)
{
val = ((Component)col).GetComponentInParent<GameEntity>();
}
if ((Object)(object)val != (Object)null && (Object)(object)val != (Object)(object)p)
{
if (done.Add((Object)(object)val))
{
bool flag2 = val is Denizen;
if (!val.IsDead() && (flag2 || !(pushProps && flag)))
{
DamageInfo val2 = MakeInfo(p, point, force, LethalFor(val));
if (component != null)
{
component.Damage(val2);
}
else
{
val.Damage(val2);
}
if (flag2)
{
if (val2.hasKilled || val.IsDead())
{
Sounds.Play(0.9f, 0.1f, "headripoff_explode_head1", "head_ripoff", "necksnap2", "death_hug_crack", "slide_head_off");
OnKill();
}
else
{
Sounds.Play(1f, 0.1f, "hPunch_1", "hPunch_2", "bPunch_1", "bPunch_2");
}
}
}
if ((Object)(object)val != (Object)null && flag2)
{
val.AddForce(force * 10f, "");
}
result = true;
}
}
else if (!(pushProps && flag))
{
Damageable val3 = ((Component)col).GetComponent<Damageable>() ?? ((Component)col).GetComponentInParent<Damageable>();
if (val3 != null && !(val3 is ENT_Player))
{
GameObject gameObject = val3.GetGameObject();
if (done.Add((Object)(((Object)(object)gameObject != (Object)null) ? ((object)gameObject) : ((object)col))))
{
val3.Damage(MakeInfo(p, point, force, LethalFor(val3)));
result = true;
}
}
}
if ((Object)(object)attachedRigidbody != (Object)null && Object.op_Implicit((Object)(object)attachedRigidbody) && !attachedRigidbody.isKinematic && done.Add((Object)(object)attachedRigidbody))
{
attachedRigidbody.AddForceAtPosition(force, point, (ForceMode)2);
attachedRigidbody.AddTorque(Random.insideUnitSphere * ((Vector3)(ref force)).magnitude * 0.5f, (ForceMode)2);
result = true;
}
return result;
}
public static float LethalFor(object target)
{
float num = 10f;
Hitbox val = (Hitbox)((target is Hitbox) ? target : null);
if (val != null && (Object)(object)val.GetGameEntity() != (Object)null)
{
target = val.GetGameEntity();
}
GameEntity val2 = (GameEntity)((target is GameEntity) ? target : null);
if (val2 != null)
{
num = val2.health;
}
else if (target != null)
{
FieldInfo fieldInfo = AccessTools.Field(target.GetType(), "health");
if (fieldInfo != null && fieldInfo.FieldType == typeof(float))
{
num = (float)fieldInfo.GetValue(target);
}
}
return Mathf.Clamp(num * 2f + 1f, 1f, 60f);
}
private static DamageInfo MakeInfo(ENT_Player p, Vector3 point, Vector3 force, float amount)
{
//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_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: 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)
DamageInfo obj = DamageInfo.CreateDamageInfo(amount, "Melee", new List<string> { "player", "impact", "qConquest" }, (GameEntity)(object)p);
obj.position = point;
obj.force = force;
obj.direction = ((Vector3)(ref force)).normalized;
obj.sourceObject = ((Component)p).gameObject;
return obj;
}
private static bool IsPlayer(ENT_Player p, Collider c)
{
if (!((Object)(object)((Component)c).transform == (Object)(object)((Component)p).transform))
{
return ((Component)c).transform.IsChildOf(((Component)p).transform);
}
return true;
}
}
internal class Effects : MonoBehaviour
{
private static Material mat;
private static int activeFlashes;
private static Material Mat
{
get
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Expected O, but got Unknown
if ((Object)(object)mat == (Object)null)
{
mat = new Material(Shader.Find("Sprites/Default") ?? Shader.Find("UI/Default"));
}
return mat;
}
}
public static void Flash(Vector3 pos, float range, Color color)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: 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_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
if (activeFlashes < 2)
{
activeFlashes++;
GameObject val = new GameObject("qConquestFlash");
val.transform.position = pos;
Light val2 = val.AddComponent<Light>();
val2.type = (LightType)2;
val2.range = range;
val2.color = color;
val2.intensity = 6f;
val2.shadows = (LightShadows)0;
((MonoBehaviour)val.AddComponent<Effects>()).StartCoroutine(FadeLight(val2));
}
}
private static IEnumerator FadeLight(Light l)
{
float t = 0f;
while (t < 0.2f && (Object)(object)l != (Object)null)
{
t += Time.unscaledDeltaTime;
l.intensity = Mathf.Lerp(6f, 0f, t / 0.2f);
yield return null;
}
activeFlashes--;
if ((Object)(object)l != (Object)null)
{
Object.Destroy((Object)(object)((Component)l).gameObject);
}
}
public static void ClapWave(Vector3 origin, Vector3 dir, float radius, float range)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Expected O, but got Unknown
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("qConquestClap");
Effects effects = val.AddComponent<Effects>();
for (int i = 0; i < 4; i++)
{
((MonoBehaviour)effects).StartCoroutine(Ring(val, origin, dir, radius * (0.4f + (float)i * 0.15f), radius * (1f + (float)i * 0.25f), range * (0.5f + (float)i * 0.15f), 0.35f + (float)i * 0.05f, (float)i * 0.04f));
}
Object.Destroy((Object)(object)val, 1f);
}
public static void Shockwave(Vector3 pos, Vector3 normal, float radius, float time)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Expected O, but got Unknown
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("qConquestWave");
((MonoBehaviour)val.AddComponent<Effects>()).StartCoroutine(Ring(val, pos, normal, radius * 0.2f, radius, 0f, time, 0f));
Object.Destroy((Object)(object)val, time + 0.2f);
}
private static IEnumerator Ring(GameObject owner, Vector3 origin, Vector3 dir, float r0, float r1, float travel, float time, float delay)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
if (delay > 0f)
{
yield return (object)new WaitForSeconds(delay);
}
GameObject child = new GameObject("ring");
child.transform.SetParent(owner.transform, false);
LineRenderer lr = child.AddComponent<LineRenderer>();
((Renderer)lr).material = Mat;
lr.loop = true;
lr.useWorldSpace = true;
lr.positionCount = 32;
((Renderer)lr).shadowCastingMode = (ShadowCastingMode)0;
((Renderer)lr).receiveShadows = false;
Quaternion rot = Quaternion.LookRotation(dir);
Vector3[] pts = (Vector3[])(object)new Vector3[32];
float t = 0f;
Color val2 = default(Color);
while (t < time && (Object)(object)lr != (Object)null)
{
t += Time.deltaTime;
float num = Mathf.Clamp01(t / time);
float num2 = 1f - (1f - num) * (1f - num);
float num3 = Mathf.Lerp(r0, r1, num2);
Vector3 val = origin + dir * (travel * num2);
for (int i = 0; i < 32; i++)
{
float num4 = (float)i / 32f * MathF.PI * 2f;
pts[i] = val + rot * new Vector3(Mathf.Cos(num4) * num3, Mathf.Sin(num4) * num3, 0f);
}
lr.SetPositions(pts);
((Color)(ref val2))..ctor(0.9f, 0.95f, 1f, (1f - num) * 0.8f);
Color startColor = (lr.endColor = val2);
lr.startColor = startColor;
lr.widthMultiplier = Mathf.Lerp(0.35f, 0.05f, num);
yield return null;
}
if ((Object)(object)child != (Object)null)
{
Object.Destroy((Object)(object)child);
}
}
}
internal class Sounds : MonoBehaviour
{
private static Sounds instance;
private static readonly Dictionary<string, AudioClip> clips = new Dictionary<string, AudioClip>();
private static readonly Dictionary<string, float> lastPlayed = new Dictionary<string, float>();
private readonly List<AudioSource> pool = new List<AudioSource>();
private AudioSource voice;
private static readonly HashSet<string> FlightSounds = new HashSet<string>
{
"superWind_start", "wind_end", "supersonicEnd", "supersonicStart", "superSonic_launch_1", "fastFlight_start", "sonic_boom_v2", "basic_move_sound_1", "basic_move_sound_2", "basic_move_sound_short_1",
"basic_move_sound_short_2", "drag1", "jump_exp"
};
private static readonly HashSet<string> HitSounds = new HashSet<string>
{
"punch_1", "punch_2", "punch_3", "hPunch_1", "hPunch_2", "bPunch_1", "bPunch_2", "headripoff_explode_head1", "head_ripoff", "necksnap2",
"death_hug_crack", "slide_head_off", "head_ground_smash", "head_smash", "head_smash2", "head_smash_attack", "pickup_smash_explode", "weaponBreak", "freeze_break_1", "freeze_break_2",
"freeze_break_3", "thunderclap_explode_victim", "thunderclap1", "thunderclap2", "thunderclap3", "solar_flare_exp"
};
public static readonly List<string> VoiceLines = new List<string>();
public static AudioSource WindLoop { get; private set; }
public static AudioSource FastLoop { get; private set; }
public static float Volume => Plugin.Volume.Value;
public static void Create(string folder)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("qConquestSounds");
Object.DontDestroyOnLoad((Object)val);
((Object)val).hideFlags = (HideFlags)61;
instance = val.AddComponent<Sounds>();
instance.voice = instance.NewSource();
WindLoop = instance.NewSource();
FastLoop = instance.NewSource();
((MonoBehaviour)instance).StartCoroutine(instance.LoadAll(folder));
}
private AudioSource NewSource()
{
AudioSource obj = ((Component)this).gameObject.AddComponent<AudioSource>();
obj.spatialBlend = 0f;
obj.playOnAwake = false;
return obj;
}
private IEnumerator LoadAll(string folder)
{
if (!Directory.Exists(folder))
{
Plugin.Log.LogError((object)("Sounds folder missing: " + folder));
yield break;
}
List<string> list = new List<string>(Directory.GetFiles(folder));
string voiceDir = Path.Combine(folder, "Voice");
if (Directory.Exists(voiceDir))
{
list.AddRange(Directory.GetFiles(voiceDir));
}
foreach (string file in list)
{
AudioType val = (AudioType)(Path.GetExtension(file).ToLowerInvariant() switch
{
".ogg" => 14,
".mp3" => 13,
".wav" => 20,
_ => 0,
});
if ((int)val == 0)
{
continue;
}
UnityWebRequest req = UnityWebRequestMultimedia.GetAudioClip("file:///" + file.Replace('\\', '/'), val);
try
{
yield return req.SendWebRequest();
if ((int)req.result != 1)
{
Plugin.Log.LogWarning((object)("Could not load " + file + ": " + req.error));
continue;
}
AudioClip content = DownloadHandlerAudioClip.GetContent(req);
((Object)content).name = Path.GetFileNameWithoutExtension(file);
clips[((Object)content).name] = content;
if (Path.GetDirectoryName(file) == voiceDir)
{
VoiceLines.Add(((Object)content).name);
}
}
finally
{
((IDisposable)req)?.Dispose();
}
}
Plugin.Log.LogInfo((object)$"Loaded {clips.Count} sounds");
SetupLoop(WindLoop, "wind_loop");
SetupLoop(FastLoop, "flightCharge_loop");
}
private static void SetupLoop(AudioSource src, string name)
{
if (clips.TryGetValue(name, out var value))
{
src.clip = value;
src.loop = true;
src.volume = 0f;
src.Play();
}
}
public static void Play(float volume, float cooldown, params string[] names)
{
if ((Object)(object)instance == (Object)null || names.Length == 0)
{
return;
}
string key = names[0];
if ((!(cooldown > 0f) || !lastPlayed.TryGetValue(key, out var value) || !(Time.unscaledTime - value < cooldown)) && clips.TryGetValue(names[Random.Range(0, names.Length)], out var value2))
{
lastPlayed[key] = Time.unscaledTime;
float num = volume * Volume * GroupGain(((Object)value2).name);
float pitch = Random.Range(0.95f, 1.05f);
while (num > 0.01f)
{
AudioSource obj = instance.FreeSource();
obj.pitch = pitch;
obj.PlayOneShot(value2, Mathf.Min(num, 1f));
num -= 1f;
}
}
}
private static float GroupGain(string name)
{
if (FlightSounds.Contains(name))
{
return Plugin.FlightVolume.Value;
}
if (HitSounds.Contains(name))
{
return Plugin.HitVolume.Value;
}
return 1f;
}
public static void Play(params string[] names)
{
Play(1f, 0f, names);
}
public static void RandomVoice(float chance = 1f)
{
if (VoiceLines.Count != 0 && !(Random.value > chance))
{
Voice(VoiceLines.ToArray());
}
}
public static void Voice(params string[] names)
{
if (!((Object)(object)instance == (Object)null) && !instance.voice.isPlaying && names.Length != 0 && clips.TryGetValue(names[Random.Range(0, names.Length)], out var value))
{
float num = Plugin.VoiceVolume.Value * Volume;
instance.voice.clip = value;
instance.voice.volume = Mathf.Min(num, 1f);
instance.voice.Play();
for (num -= 1f; num > 0.01f; num -= 1f)
{
instance.FreeSource().PlayOneShot(value, Mathf.Min(num, 1f));
}
}
}
private AudioSource FreeSource()
{
foreach (AudioSource item in pool)
{
if (!item.isPlaying)
{
return item;
}
}
AudioSource val = NewSource();
pool.Add(val);
return val;
}
}
}