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 System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using itekso.FlickStick.NetcodePatcher;
[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: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Jobs")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")]
[assembly: IgnoresAccessChecksTo("Unity.Services.QoS")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Relay")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: AssemblyCompany("itekso.FlickStick")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1+53de56c54e5acce3255135fa77ac48e9bfa519cc")]
[assembly: AssemblyProduct("FlickStick")]
[assembly: AssemblyTitle("itekso.FlickStick")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
static <Module>()
{
}
}
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 FlickStick
{
internal class FlickStickBehavior : PhysicsProp
{
private static ManualLogSource logger = Plugin.LoggerInstance;
public AudioSource ItemAudio;
public AudioClip BoingSFX;
public AudioClip SlideSFX;
public Animator animator;
public Transform PointerTip;
public ScanNodeProperties ScanNode;
public Material HandleMaterial;
public Material HandMaterial;
private PlayerControllerB previousPlayerHeldBy;
private const int mask = 524288;
private List<RaycastHit> hits = new List<RaycastHit>();
private const float forceUpMultiplier = 1f;
private const float forceForwardMultiplier = 2f;
private const float forceDuration = 2f;
private float pokeStunTime = 1f;
private float pokeForce = 15f;
private float flickForce = 30f;
private float flipoffRange = 30f;
private float pokeRange = 5f;
private float flickRange = 5f;
private bool flickEnabled = true;
private bool pokeEnabled = true;
private bool flipEnabled = true;
public override void Start()
{
//IL_0094: 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)
((GrabbableObject)this).Start();
if (Random.Range(0, 100) == 1)
{
ScanNode.headerText = "Flicky Flicky Willy Donker";
}
pokeStunTime = Plugin.configPokeStunTime.Value;
pokeForce = Plugin.configPokeForce.Value;
flickForce = Plugin.configFlickForce.Value;
flipoffRange = Plugin.configFlipOffRange.Value;
pokeRange = Plugin.configPokeRange.Value;
flickRange = Plugin.configFlickRange.Value;
HandMaterial.color = Plugin.configHandColor.Value;
HandleMaterial.color = Plugin.configHandleColor.Value;
flickEnabled = Plugin.configEnableFlick.Value;
pokeEnabled = Plugin.configEnablePoke.Value;
flipEnabled = Plugin.configEnableFlip.Value;
}
public override void Update()
{
((GrabbableObject)this).Update();
if ((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null)
{
previousPlayerHeldBy = ((GrabbableObject)this).playerHeldBy;
}
}
public override void EquipItem()
{
((PhysicsProp)this).EquipItem();
previousPlayerHeldBy = ((GrabbableObject)this).playerHeldBy;
previousPlayerHeldBy.equippedUsableItemQE = true;
}
public override void DiscardItem()
{
animator.SetTrigger("reset");
previousPlayerHeldBy.activatingItem = false;
previousPlayerHeldBy.equippedUsableItemQE = true;
((GrabbableObject)this).DiscardItem();
}
public override void PocketItem()
{
previousPlayerHeldBy.activatingItem = false;
previousPlayerHeldBy.equippedUsableItemQE = true;
((GrabbableObject)this).PocketItem();
}
public override void DestroyObjectInHand(PlayerControllerB playerHolding)
{
playerHolding.activatingItem = false;
playerHolding.equippedUsableItemQE = true;
((GrabbableObject)this).DestroyObjectInHand(playerHolding);
}
public override void ItemActivate(bool used, bool buttonDown = true)
{
((GrabbableObject)this).ItemActivate(used, buttonDown);
if (flickEnabled && !previousPlayerHeldBy.activatingItem && buttonDown)
{
previousPlayerHeldBy.activatingItem = true;
animator.SetTrigger("flick");
}
}
public override void ItemInteractLeftRight(bool right)
{
((GrabbableObject)this).ItemInteractLeftRight(right);
if (previousPlayerHeldBy.activatingItem)
{
return;
}
if (right)
{
if (pokeEnabled)
{
previousPlayerHeldBy.activatingItem = true;
animator.SetTrigger("poke");
}
}
else if (flipEnabled)
{
previousPlayerHeldBy.activatingItem = true;
animator.SetTrigger("flip");
}
}
public List<RaycastHit> GetRaycastHits(float distance = 1f, float radius = 1f)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
return Physics.SphereCastAll(PointerTip.position, radius, ((Component)previousPlayerHeldBy.playerEye).transform.forward, distance, 524288, (QueryTriggerInteraction)2).ToList();
}
private void AddForce(EnemyAI enemy, float force)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: 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)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_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)
//IL_0043: 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_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: 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_005e: 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_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = ((Component)previousPlayerHeldBy).transform.TransformDirection(Vector3.forward);
Vector3 val2 = ((Vector3)(ref val)).normalized * 2f;
val = ((Component)previousPlayerHeldBy).transform.TransformDirection(Vector3.up);
Vector3 val3 = ((Vector3)(ref val)).normalized * 1f;
val = val2 + val3;
Vector3 normalized = ((Vector3)(ref val)).normalized;
bool usingEnemyRb = true;
Rigidbody val4 = default(Rigidbody);
if (!((Component)enemy).gameObject.TryGetComponent<Rigidbody>(ref val4))
{
usingEnemyRb = false;
val4 = ((Component)enemy).gameObject.AddComponent<Rigidbody>();
}
((Behaviour)enemy.agent).enabled = false;
val4.isKinematic = false;
val4.velocity = Vector3.zero;
val4.AddForce(((Vector3)(ref normalized)).normalized * force, (ForceMode)1);
((MonoBehaviour)this).StartCoroutine(ResetKinematicsAfterDelay(enemy, usingEnemyRb));
}
private void AddForce(PlayerControllerB player, float force, float duration = 0.1f)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: 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)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_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)
//IL_0043: 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_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: 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_005e: 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_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: 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_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = ((Component)previousPlayerHeldBy).transform.TransformDirection(Vector3.forward);
Vector3 val2 = ((Vector3)(ref val)).normalized * 2f;
val = ((Component)previousPlayerHeldBy).transform.TransformDirection(Vector3.up);
Vector3 val3 = ((Vector3)(ref val)).normalized * 1f;
val = val2 + val3;
Vector3 normalized = ((Vector3)(ref val)).normalized;
Rigidbody playerRigidbody = player.playerRigidbody;
playerRigidbody.isKinematic = false;
playerRigidbody.velocity = Vector3.zero;
player.externalForceAutoFade += normalized * force;
((MonoBehaviour)this).StartCoroutine(ResetKinematicsAfterDelay(player, duration));
}
private IEnumerator ResetKinematicsAfterDelay(PlayerControllerB player, float delay)
{
yield return (object)new WaitForSeconds(delay);
player.playerRigidbody.isKinematic = true;
}
private IEnumerator ResetKinematicsAfterDelay(EnemyAI enemy, bool usingEnemyRb)
{
yield return (object)new WaitForSeconds(2f);
if (usingEnemyRb)
{
((Component)enemy).gameObject.GetComponent<Rigidbody>().isKinematic = true;
}
else
{
Object.Destroy((Object)(object)((Component)enemy).gameObject.GetComponent<Rigidbody>());
}
((Behaviour)enemy.agent).enabled = true;
}
public void Poke()
{
//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)
logger.LogDebug((object)"In Poke()");
hits = GetRaycastHits(pokeRange);
logger.LogDebug((object)"Poked:");
PlayerControllerB val = default(PlayerControllerB);
EnemyAICollisionDetect val2 = default(EnemyAICollisionDetect);
foreach (RaycastHit hit in hits)
{
RaycastHit current = hit;
if (((Component)((RaycastHit)(ref current)).transform).TryGetComponent<PlayerControllerB>(ref val))
{
if (!((Object)(object)val == (Object)(object)previousPlayerHeldBy))
{
logger.LogDebug((object)val.playerUsername);
AddForce(val, pokeForce);
return;
}
}
else if (((Component)((RaycastHit)(ref current)).transform).TryGetComponent<EnemyAICollisionDetect>(ref val2))
{
EnemyAI mainScript = val2.mainScript;
if (!((Object)(object)mainScript == (Object)null))
{
logger.LogDebug((object)mainScript.enemyType.enemyName);
mainScript.SetEnemyStunned(true, 1f, previousPlayerHeldBy);
}
}
}
previousPlayerHeldBy.activatingItem = false;
}
public void Flip()
{
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: 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)
logger.LogDebug((object)"In Flip()");
hits = GetRaycastHits(flipoffRange, 30f);
RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 10f, 0.5f, 0, false, 0);
ItemAudio.PlayOneShot(SlideSFX);
logger.LogDebug((object)"Flipped off:");
EnemyAICollisionDetect val = default(EnemyAICollisionDetect);
foreach (RaycastHit hit in hits)
{
RaycastHit current = hit;
logger.LogDebug((object)((Object)((Component)((RaycastHit)(ref current)).transform).gameObject).name);
if (((Component)((RaycastHit)(ref current)).transform).gameObject.TryGetComponent<EnemyAICollisionDetect>(ref val))
{
EnemyAI mainScript = val.mainScript;
if (!((Object)(object)mainScript == (Object)null))
{
logger.LogDebug((object)mainScript.enemyType.enemyName);
mainScript.targetPlayer = previousPlayerHeldBy;
mainScript.HitEnemy(0, previousPlayerHeldBy, false, -1);
}
}
}
previousPlayerHeldBy.activatingItem = false;
logger.LogDebug((object)("activating item: " + previousPlayerHeldBy.activatingItem));
}
public void Flick()
{
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: 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)
logger.LogDebug((object)"In Flick()");
hits = GetRaycastHits(flickRange);
RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 10f, 0.5f, 0, false, 0);
ItemAudio.PlayOneShot(BoingSFX);
logger.LogDebug((object)"Flicked:");
PlayerControllerB val = default(PlayerControllerB);
EnemyAICollisionDetect val2 = default(EnemyAICollisionDetect);
foreach (RaycastHit hit in hits)
{
RaycastHit current = hit;
if (((Component)((RaycastHit)(ref current)).transform).TryGetComponent<PlayerControllerB>(ref val))
{
if (!((Object)(object)val == (Object)(object)previousPlayerHeldBy))
{
logger.LogDebug((object)val.playerUsername);
AddForce(val, flickForce);
return;
}
}
else if (((Component)((RaycastHit)(ref current)).transform).TryGetComponent<EnemyAICollisionDetect>(ref val2))
{
EnemyAI mainScript = val2.mainScript;
if (!((Object)(object)mainScript == (Object)null))
{
logger.LogDebug((object)mainScript.enemyType.enemyName);
AddForce(mainScript, flickForce);
}
}
}
previousPlayerHeldBy.activatingItem = false;
}
public void SetActivatingItemFalse()
{
previousPlayerHeldBy.activatingItem = false;
}
private void VisualizeSphereCast(Vector3 origin, Vector3 direction, float radius, float maxDistance, float duration)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: 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_0044: 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)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Expected O, but got Unknown
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("SphereCastLine");
val.layer = LayerMask.NameToLayer("Ignore Raycast");
LineRenderer val2 = val.AddComponent<LineRenderer>();
val2.positionCount = 2;
val2.SetPosition(0, origin);
Vector3 val3 = origin + ((Vector3)(ref direction)).normalized * maxDistance;
val2.SetPosition(1, val3);
val2.startWidth = radius * 0.1f;
val2.endWidth = radius * 0.1f;
((Renderer)val2).material = new Material(Shader.Find("Sprites/Default"));
val2.startColor = Color.red;
val2.endColor = Color.red;
Object.Destroy((Object)(object)val, duration);
}
protected override void __initializeVariables()
{
((PhysicsProp)this).__initializeVariables();
}
[MethodImpl(MethodImplOptions.NoInlining)]
protected internal override string __getTypeName()
{
return "FlickStickBehavior";
}
}
internal class TESTING
{
private static ManualLogSource logger = Plugin.LoggerInstance;
private static bool toggle;
[HarmonyPostfix]
[HarmonyPatch(typeof(HUDManager), "PingScan_performed")]
public static void PingScan_performedPostFix()
{
}
[HarmonyPrefix]
[HarmonyPatch(typeof(HUDManager), "SubmitChat_performed")]
public static void SubmitChat_performedPrefix(HUDManager __instance)
{
string text = __instance.chatTextField.text;
string[] array = text.Split(" ");
string text2 = array[0];
string text3 = text2;
if (text3 == "/refresh")
{
RoundManager.Instance.RefreshEnemiesList();
HoarderBugAI.RefreshGrabbableObjectsInMapList();
}
}
}
[BepInPlugin("itekso.FlickStick", "FlickStick", "1.0.1")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
private readonly Harmony harmony = new Harmony("itekso.FlickStick");
public static Plugin PluginInstance;
public static ManualLogSource LoggerInstance;
public static AssetBundle ModAssets;
public static ConfigEntry<string> configLevelRarities;
public static ConfigEntry<string> configCustomLevelRarities;
public static ConfigEntry<int> configMinValue;
public static ConfigEntry<int> configMaxValue;
public static ConfigEntry<bool> configEnableStore;
public static ConfigEntry<int> configStorePrice;
public static ConfigEntry<float> configPokeStunTime;
public static ConfigEntry<float> configPokeForce;
public static ConfigEntry<float> configFlickForce;
public static ConfigEntry<float> configFlipOffRange;
public static ConfigEntry<float> configPokeRange;
public static ConfigEntry<float> configFlickRange;
public static ConfigEntry<bool> configEnablePoke;
public static ConfigEntry<bool> configEnableFlick;
public static ConfigEntry<bool> configEnableFlip;
public static ConfigEntry<Color> configHandColor;
public static ConfigEntry<Color> configHandleColor;
public static PlayerControllerB localPlayer => GameNetworkManager.Instance.localPlayerController;
public static bool IsServerOrHost => NetworkManager.Singleton.IsServer || NetworkManager.Singleton.IsHost;
public static PlayerControllerB PlayerFromId(ulong id)
{
return StartOfRound.Instance.allPlayerScripts[StartOfRound.Instance.ClientPlayerList[id]];
}
private void Awake()
{
//IL_024f: Unknown result type (might be due to invalid IL or missing references)
//IL_0273: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)PluginInstance == (Object)null)
{
PluginInstance = this;
}
LoggerInstance = ((BaseUnityPlugin)PluginInstance).Logger;
harmony.PatchAll();
InitializeNetworkBehaviours();
configLevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("Scrap", "Level Rarities", "ExperimentationLevel:10, AssuranceLevel:10, VowLevel:10, OffenseLevel:30, AdamanceLevel:50, MarchLevel:50, RendLevel:50, DineLevel:50, TitanLevel:80, ArtificeLevel:80, EmbrionLevel:100, Modded:30", "Rarities for each level. See default for formatting. Leave blank to prevent spawning as scrap.");
configCustomLevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("Scrap", "Custom Level Rarities", "", "Rarities for modded levels. Same formatting as level rarities.");
configMinValue = ((BaseUnityPlugin)this).Config.Bind<int>("Scrap", "Min Value", 50, "Min scrap value of the flickstick.");
configMaxValue = ((BaseUnityPlugin)this).Config.Bind<int>("Scrap", "Max Value", 100, "Max scrap value of the flickstick.");
configEnableStore = ((BaseUnityPlugin)this).Config.Bind<bool>("Store", "Enable Store", true, "Whether or not the flickstick should be buyable in the store.");
configStorePrice = ((BaseUnityPlugin)this).Config.Bind<int>("Store", "Store Price", 300, "Price of the flickstick in the store.");
configPokeStunTime = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Poke Stun Time", 1f, "Time the poke function stuns an enemy.");
configPokeForce = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Poke Force", 15f, "How much force is applied to a player when the poke is used.");
configFlickForce = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Flick Force", 30f, "How much force is applied to an enemy or player when the flick is used.");
configFlipOffRange = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Flipp Off Range", 30f, "How far the flip taunts the enemy.");
configPokeRange = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Poke Range", 5f, "The range from the tip of the pointer that an enemy will be poked.");
configFlickRange = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Flick Range", 5f, "The range from the tip of the pointer that an enemy will be flicked.");
configEnablePoke = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enable Poke", true, "Whether or not you can use the Poke function.");
configEnableFlick = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enable Flick", true, "Whether or not you can use the Flick function.");
configEnableFlip = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enable Flip", true, "Whether or not you can use the Flip function.");
configHandColor = ((BaseUnityPlugin)this).Config.Bind<Color>("Colors", "Hand Color", Color.white, "Whether or not you can use the Poke function.");
configHandleColor = ((BaseUnityPlugin)this).Config.Bind<Color>("Colors", "Handle Color", Color.red, "Whether or not you can use the Poke function.");
string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
ModAssets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "flickstick_assets"));
if ((Object)(object)ModAssets == (Object)null)
{
((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load custom assets.");
return;
}
LoggerInstance.LogDebug((object)("Got AssetBundle at: " + Path.Combine(directoryName, "flickstick_assets")));
Item val = ModAssets.LoadAsset<Item>("Assets/ModAssets/FlickStickItem.asset");
if ((Object)(object)val == (Object)null)
{
LoggerInstance.LogError((object)"Error: Couldnt get FlickStickItem from assets");
return;
}
LoggerInstance.LogDebug((object)"Got FlickStick prefab");
val.minValue = configMinValue.Value;
val.maxValue = configMaxValue.Value;
NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
Utilities.FixMixerGroups(val.spawnPrefab);
Items.RegisterScrap(val, GetLevelRarities(configLevelRarities.Value), GetCustomLevelRarities(configCustomLevelRarities.Value));
if (configEnableStore.Value)
{
Items.RegisterShopItem(val, configStorePrice.Value);
}
((BaseUnityPlugin)this).Logger.LogInfo((object)"itekso.FlickStick v1.0.1 has loaded!");
}
public Dictionary<LevelTypes, int> GetLevelRarities(string levelsString)
{
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
try
{
Dictionary<LevelTypes, int> dictionary = new Dictionary<LevelTypes, int>();
if (levelsString != null && levelsString != "")
{
string[] array = levelsString.Split(',');
string[] array2 = array;
foreach (string text in array2)
{
string[] array3 = text.Split(':');
if (array3.Length == 2)
{
string text2 = array3[0].Trim();
string text3 = array3[1].Trim();
if (Enum.TryParse<LevelTypes>(text2, out LevelTypes result) && int.TryParse(text3, out var result2))
{
dictionary.Add(result, result2);
}
else
{
LoggerInstance.LogError((object)("Error: Invalid level rarity: " + text2 + ":" + text3));
}
}
}
}
return dictionary;
}
catch (Exception arg)
{
((BaseUnityPlugin)this).Logger.LogError((object)$"Error: {arg}");
return null;
}
}
public Dictionary<string, int> GetCustomLevelRarities(string levelsString)
{
try
{
Dictionary<string, int> dictionary = new Dictionary<string, int>();
if (levelsString != null)
{
string[] array = levelsString.Split(',');
string[] array2 = array;
foreach (string text in array2)
{
string[] array3 = text.Split(':');
if (array3.Length == 2)
{
string text2 = array3[0].Trim();
string text3 = array3[1].Trim();
if (int.TryParse(text3, out var result))
{
dictionary.Add(text2, result);
}
else
{
LoggerInstance.LogError((object)("Error: Invalid level rarity: " + text2 + ":" + text3));
}
}
}
}
return dictionary;
}
catch (Exception arg)
{
((BaseUnityPlugin)this).Logger.LogError((object)$"Error: {arg}");
return null;
}
}
private static void InitializeNetworkBehaviours()
{
Type[] types = Assembly.GetExecutingAssembly().GetTypes();
Type[] array = types;
foreach (Type type in array)
{
MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
MethodInfo[] array2 = methods;
foreach (MethodInfo methodInfo in array2)
{
object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
if (customAttributes.Length != 0)
{
methodInfo.Invoke(null, null);
}
}
}
LoggerInstance.LogDebug((object)"Finished initializing network behaviours");
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "itekso.FlickStick";
public const string PLUGIN_NAME = "FlickStick";
public const string PLUGIN_VERSION = "1.0.1";
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}
namespace itekso.FlickStick.NetcodePatcher
{
[AttributeUsage(AttributeTargets.Module)]
internal class NetcodePatchedAssemblyAttribute : Attribute
{
}
}