Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of RepoMoreStaffs v0.1.0
BepInEx/plugins/RepoMoreStaffs/RepoMoreStaffs.dll
Decompiled 3 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using ExitGames.Client.Photon; using HarmonyLib; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using Photon.Pun; using REPOLib.Modules; using UnityEngine; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("RepoMoreStaffs")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.1.0.0")] [assembly: AssemblyInformationalVersion("0.1.0")] [assembly: AssemblyProduct("RepoMoreStaffs")] [assembly: AssemblyTitle("RepoMoreStaffs")] [assembly: AssemblyVersion("0.1.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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] [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] [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 Matsu.RepoMoreStaffs { [HarmonyPatch(typeof(Resources), "Load", new Type[] { typeof(string), typeof(Type) })] internal static class StaffPrefabResourceFallback { private delegate bool TryGetNetPrefabDelegate(string prefabId, out GameObject? prefab); private static readonly TryGetNetPrefabDelegate? TryGetNetPrefab = CreateDelegate(); private static TryGetNetPrefabDelegate? CreateDelegate() { MethodInfo methodInfo = AccessTools.Method(typeof(NetworkPrefabs), "TryGetNetworkPrefab", new Type[2] { typeof(string), typeof(GameObject).MakeByRefType() }, (Type[])null); if (!(methodInfo != null)) { return null; } return (TryGetNetPrefabDelegate)Delegate.CreateDelegate(typeof(TryGetNetPrefabDelegate), methodInfo); } private static bool Prefix(string path, Type systemTypeInstance, ref Object __result) { if (systemTypeInstance == typeof(GameObject)) { if (StaffAssets.TryGetTemplateByPath(path, out GameObject prefab) && (Object)(object)prefab != (Object)null) { __result = (Object)(object)prefab; return false; } if (TryGetNetPrefab != null && TryGetNetPrefab(path, out var prefab2) && (Object)(object)prefab2 != (Object)null) { __result = (Object)(object)prefab2; return false; } } return true; } } [HarmonyPatch(typeof(StatsManager), "LoadItemsFromFolder")] internal static class NativeStaffCatalogReady { private static void Postfix() { StaffAssets.TryRegister(); } } [HarmonyPatch] internal static class TruckStaffCatalogReady { private static IEnumerable<MethodBase> TargetMethods() { return from m in AccessTools.GetDeclaredMethods(typeof(ItemManager)) where m.Name == "ItemsInitialize" select m; } private static void Prefix() { StaffAssets.TryRegister(); } } [HarmonyPatch(typeof(ShopManager), "GetAllItemsFromStatsManager")] internal static class ShopStaffCatalogReady { private static void Prefix() { StaffAssets.TryRegister(); } } [HarmonyPatch(typeof(ItemManager), "GetPurchasedItems")] internal static class OwnedStaffCatalogReady { private static void Prefix() { StaffAssets.TryRegister(); } } [HarmonyPatch] internal static class StaffLocalizationReady { private static IEnumerable<MethodBase> TargetMethods() { MethodInfo methodInfo = AccessTools.Method(typeof(ItemAttributes), "RefreshLocalizations", (Type[])null, (Type[])null); if (methodInfo != null) { yield return methodInfo; } MethodInfo methodInfo2 = AccessTools.Method(typeof(ItemAttributes), "StartSetup", (Type[])null, (Type[])null); if (methodInfo2 != null) { yield return methodInfo2; } } private static void Postfix(ItemAttributes __instance) { StaffAssets.RefreshLocalization(); if (StaffAssets.TryGetKind(__instance, out var kind)) { StaffAssets.ApplyLocalization(__instance, kind); } } } public sealed class ClownBeamStaff : MoreStaffBase { public SemiLaser? semiLaser; private float beamTimer; private bool beamActive; private Vector3 lastBeamOrigin; private Vector3 lastBeamEnd; private bool lastBeamHitting; private Vector3 lastBeamDir = Vector3.forward; private HurtCollider? cachedHurtCollider; private bool baseDamageCaptured; private int baseEnemyDamage = 25; private int basePlayerDamage = 25; private bool remoteBeamActive; private float remoteBeamUntil; private Vector3 remoteOrigin; private Vector3 remoteEnd; private bool remoteHitting; public bool IsBeamActive { get { if (!beamActive) { if (remoteBeamActive) { return Time.unscaledTime <= remoteBeamUntil; } return false; } return true; } } public float RemainingBeamTime { get { if (!beamActive) { return 0f; } return Mathf.Max(0f, beamTimer); } } public Vector3 LastBeamOrigin => lastBeamOrigin; public Vector3 LastBeamEnd => lastBeamEnd; public bool LastBeamHitting => lastBeamHitting; public HurtCollider? BeamHurtCollider { get { if ((Object)(object)semiLaser == (Object)null) { return null; } HurtCollider val = NativeAccess.LaserHurtCollider.Invoke(semiLaser); if ((Object)(object)val != (Object)null) { cachedHurtCollider = val; } else if ((Object)(object)cachedHurtCollider == (Object)null) { cachedHurtCollider = ((Component)semiLaser).GetComponentInChildren<HurtCollider>(true); } return cachedHurtCollider; } } protected override void OnStaffStart() { EnsureLaserConfigured(); } protected override void Update() { base.Update(); if (!NativeAccess.Host && NativeAccess.Multiplayer) { UpdateRemoteBeam(); } } private void EnsureLaserConfigured() { HurtCollider beamHurtCollider = BeamHurtCollider; if ((Object)(object)beamHurtCollider == (Object)null) { return; } if (!baseDamageCaptured) { baseDamageCaptured = true; baseEnemyDamage = Math.Max(beamHurtCollider.enemyDamage, 25); basePlayerDamage = ((beamHurtCollider.playerDamage > 0) ? beamHurtCollider.playerDamage : 25); } if ((Object)(object)physGrabObject != (Object)null && !beamHurtCollider.ignoreObjects.Contains(physGrabObject)) { beamHurtCollider.ignoreObjects.Add(physGrabObject); } float scale = ((Plugin.BeamEnemyDamageScale != null) ? Plugin.BeamEnemyDamageScale.Value : 1f); bool flag = Plugin.BeamFriendlyFire == null || Plugin.BeamFriendlyFire.Value; beamHurtCollider.enemyLogic = true; beamHurtCollider.enemyDamage = StaffRules.ScaledDamage(baseEnemyDamage, scale); beamHurtCollider.playerLogic = flag; beamHurtCollider.playerDamage = (flag ? basePlayerDamage : 0); NativeAccess.HurtPlayerCausingOverride.Invoke(beamHurtCollider) = (((Object)(object)physGrabObject != (Object)null) ? NativeAccess.PhysLastPlayerGrabbing.Invoke(physGrabObject) : null); beamHurtCollider.ignorePlayers.Clear(); if (!base.IsGrabbed || !((Object)(object)physGrabObject != (Object)null)) { return; } for (int i = 0; i < physGrabObject.playerGrabbing.Count; i++) { PhysGrabber val = physGrabObject.playerGrabbing[i]; if ((Object)(object)val != (Object)null && (Object)(object)val.playerAvatar != (Object)null && !beamHurtCollider.ignorePlayers.Contains(val.playerAvatar)) { beamHurtCollider.ignorePlayers.Add(val.playerAvatar); } } } protected override bool OnSpellCast() { //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_0086: 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_0091: 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_00f3: 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_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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) if ((Object)(object)semiLaser == (Object)null) { return false; } EnsureLaserConfigured(); if (!NativeAccess.Host && NativeAccess.Multiplayer) { return false; } float value = ((Plugin.BeamDuration != null) ? Plugin.BeamDuration.Value : 2.2f); beamTimer = StaffRules.BeamDuration(value); beamActive = true; Vector3 val = ComputeAimDirection(); if ((Object)(object)physGrabObject != (Object)null && physGrabObject.grabbedLocal && (Object)(object)PlayerController.instance != (Object)null) { PlayerController.instance.ForceImpulse(-val * 6f); } if ((Object)(object)physGrabObject?.rb != (Object)null) { physGrabObject.rb.AddForceAtPosition(-val * 4f, base.SpawnOrigin, (ForceMode)1); } SemiFunc.EnemyInvestigate(((Component)this).transform.position, 24f, false); OverrideLightAndCrystal(Color.white, 24f, 10f, 0.15f, 0.04f, 0.25f); StepBeamVisualAndRaycast(val); StaffDirector.Instance?.BroadcastNow(); return true; } protected override void OnActiveSpellUpdate() { //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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) if (!NativeAccess.Host && NativeAccess.Multiplayer) { StateSet(StaffState.Lowering); return; } if (!beamActive || (Object)(object)semiLaser == (Object)null) { StateSet(StaffState.Lowering); return; } if (base.IsEquipped) { CancelSpell(); StateSet(StaffState.Idle); return; } ApplyStaffForwardTilt(); EnsureLaserConfigured(); Vector3 direction = (base.IsGrabbed ? ComputeAimDirection() : (((Object)(object)projectileSpawnPoint != (Object)null) ? projectileSpawnPoint.forward : ((Component)this).transform.up)); StepBeamVisualAndRaycast(direction); if ((Object)(object)physGrabObject != (Object)null && (Object)(object)NativeAccess.PhysLastPlayerGrabbing.Invoke(physGrabObject) != (Object)null) { SemiFunc.PlayerShopKeeperLaserTickHost(NativeAccess.PhysLastPlayerGrabbing.Invoke(physGrabObject)); } if (SemiFunc.PerSecond(2f, (Object)(object)this)) { SemiFunc.EnemyInvestigate(((Component)this).transform.position, 22f, false); } beamTimer -= Time.deltaTime; if (beamTimer <= 0f) { beamActive = false; beamTimer = 0f; StaffDirector.Instance?.BroadcastNow(); StateSet(StaffState.Lowering); } } protected override void OnActiveSpellFixedUpdate() { //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_007a: 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_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) if (SemiFunc.IsMasterClientOrSingleplayer() && beamActive && !((Object)(object)physGrabObject?.rb == (Object)null)) { if (base.IsGrabbed) { physGrabObject.rb.AddForce(-lastBeamDir * 12f, (ForceMode)0); } else { physGrabObject.rb.AddForce(-lastBeamDir * (420f * Time.fixedDeltaTime), (ForceMode)0); } } } protected override void OnSpellCancel() { beamActive = false; beamTimer = 0f; remoteBeamActive = false; remoteBeamUntil = 0f; NativeAccess.StopLaserImmediately(semiLaser); StaffDirector.Instance?.BroadcastNow(); } private void StepBeamVisualAndRaycast(Vector3 direction) { //IL_0026: 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) //IL_002b: 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_0032: 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_0034: 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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_004e: 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_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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: 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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: 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_00d2: 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_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)semiLaser == (Object)null)) { Vector3 val = ((((Vector3)(ref direction)).sqrMagnitude > 0.0001f) ? ((Vector3)(ref direction)).normalized : Vector3.forward); Vector3 spawnOrigin = base.SpawnOrigin; Vector3 val2 = spawnOrigin; if (!Physics.Raycast(spawnOrigin, val, 0.18f, LayerMask.op_Implicit(SemiFunc.LayerMaskGetVisionObstruct()))) { val2 = spawnOrigin + val * 0.18f; } float num = StaffRules.BeamRange((Plugin.BeamRange != null) ? Plugin.BeamRange.Value : 15f); Vector3 val3 = val2 + val * num; bool flag = false; RaycastHit val4 = default(RaycastHit); if (Physics.Raycast(val2, val, ref val4, num, LayerMask.op_Implicit(SemiFunc.LayerMaskGetVisionObstruct()))) { val3 = ((RaycastHit)(ref val4)).point; flag = true; } semiLaser.LaserActive(val2, val3, flag, 3f, 6f, 2f); lastBeamOrigin = val2; lastBeamEnd = val3; lastBeamHitting = flag; lastBeamDir = val; } } private void UpdateRemoteBeam() { //IL_004f: 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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_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_0099: 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_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: 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_00c0: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)semiLaser == (Object)null || base.IsEquipped || base.InCart || base.IsBroken) { return; } if (remoteBeamActive && Time.unscaledTime <= remoteBeamUntil) { EnsureLaserConfigured(); semiLaser.LaserActive(remoteOrigin, remoteEnd, remoteHitting, 3f, 6f, 2f); lastBeamOrigin = remoteOrigin; lastBeamEnd = remoteEnd; lastBeamHitting = remoteHitting; Vector3 val = remoteEnd - remoteOrigin; if (((Vector3)(ref val)).sqrMagnitude > 0.0001f) { lastBeamDir = ((Vector3)(ref val)).normalized; } } else if (remoteBeamActive) { remoteBeamActive = false; } } protected override void OnPopulateNetworkState(StaffInstanceState state) { state.Firing = beamActive; state.RemainingBeamTime = Mathf.Clamp(RemainingBeamTime, 0f, 10f); state.OriginX = lastBeamOrigin.x; state.OriginY = lastBeamOrigin.y; state.OriginZ = lastBeamOrigin.z; state.EndX = lastBeamEnd.x; state.EndY = lastBeamEnd.y; state.EndZ = lastBeamEnd.z; state.Hitting = lastBeamHitting; } protected override void OnApplyNetworkState(StaffInstanceState state) { //IL_001f: 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_003c: 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) remoteBeamActive = state.Firing; remoteOrigin = new Vector3(state.OriginX, state.OriginY, state.OriginZ); remoteEnd = new Vector3(state.EndX, state.EndY, state.EndZ); remoteHitting = state.Hitting; if (state.Firing) { remoteBeamUntil = Time.unscaledTime + 0.35f; } else { remoteBeamUntil = 0f; } } } public abstract class MoreStaffBase : MonoBehaviour { public enum StaffState { Idle, Grabbed, Charging, Loaded, Casting, ActiveSpell, Lowering } public static readonly List<MoreStaffBase> Active = new List<MoreStaffBase>(); private static readonly int EmissionColorId = Shader.PropertyToID("_EmissionColor"); public StaffKind Kind; public ParticleSystem? particleSparkle; public ParticleSystem? loadedParticles; public ParticleSystem? denyParticles; public ParticleSystem? chargeUpParticles; public Sound? denySound; public Sound? denySoundUI; public Sound? chargeUpSound; public Sound? lightning01Sound; public Sound? castSound; public Sound? choir01Sound; public Sound? choir02Sound; public Sound? chargeUpSoundLoop; public Sound? loadedLowSoundLoop; public Sound? loadedHighSoundLoop; public Transform? projectileSpawnPoint; public Transform? screenArrow; public Material? crystalMaterial; public Renderer? crystalRenderer; public Color loadedColor = new Color(1f, 0.12f, 0.18f, 1f); protected PhysGrabObject? physGrabObject; protected ItemBattery? itemBattery; protected ItemToggle? itemToggle; protected ItemEquippable? itemEquippable; protected PropLight? propLight; protected ItemAttributes? itemAttributes; private readonly List<ParticleSystem> loadedParticleChildren = new List<ParticleSystem>(); private readonly List<float> originalEmissionRates = new List<float>(); private float crystalLoadedMultiplier = 1f; private float initialLightIntensity = 5f; private float activationThreshold = -50f; private bool choirPlaying; private bool choirLocked; private float lastChoirPitch01 = 1f; private float lastChoirPitch02 = 1f; private float lastChoirVolume01; private float lastChoirVolume02; private bool emissionLocked; private bool chargeEmissionLocked; private bool loadedSoundLowActive; private Color lightOverrideColor; private Color lightOverrideColorDefault; private Color crystalOverrideColorDefault; private float lightOverrideIntensity; private float lightOverrideIntensityDefault; private float lightOverrideRange; private float lightOverrideRangeDefault; private float lightOverrideTimer; private float lightOverrideFadeIn = 0.2f; private float lightOverrideFadeOut = 0.2f; private float lightOverrideLerp; private bool lightOverrideActive; private int lightOverridePhase; private float batteryTimer; private bool prevToggleState; private float castTimer; private float castTimerMax = 0.5f; private float droppedTimer; private float chargingTimer; private float chargingTimerMax = 0.5f; protected StaffState currentState; private bool stateImpulse = true; public int Id => NativeAccess.Id((Component?)(object)this); public StaffState CurrentState => currentState; public float CameraPitch { get; private set; } public float LookUpProgress { get; private set; } public PhysGrabObject? Physics => physGrabObject; public ItemBattery? Battery => itemBattery; public ItemToggle? Toggle => itemToggle; public ItemEquippable? Equippable => itemEquippable; public bool IsBroken { get { if (!((Object)(object)itemBattery == (Object)null)) { return NativeAccess.BatteryLifeInt.Invoke(itemBattery) <= 0; } return true; } } public bool IsGrabbed { get { if ((Object)(object)physGrabObject != (Object)null && physGrabObject.playerGrabbing != null) { return physGrabObject.playerGrabbing.Count > 0; } return false; } } public bool IsEquipped { get { if ((Object)(object)itemEquippable != (Object)null) { return NativeAccess.EquippableIsEquipped.Invoke(itemEquippable); } return false; } } protected bool InCart { get { if ((Object)(object)physGrabObject != (Object)null && (Object)(object)NativeAccess.PhysImpactDetector.Invoke(physGrabObject) != (Object)null) { return NativeAccess.PhysImpactDetector.Invoke(physGrabObject).inCart; } return false; } } protected Vector3 SpawnOrigin { get { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)projectileSpawnPoint != (Object)null)) { return ((Component)this).transform.position; } return projectileSpawnPoint.position; } } protected virtual void OnStaffAwake() { } protected virtual void OnStaffStart() { } protected virtual bool OnSpellCast() { return false; } protected virtual void OnActiveSpellUpdate() { StateSet(StaffState.Lowering); } protected virtual void OnActiveSpellFixedUpdate() { } protected virtual void OnSpellCancel() { } protected virtual void OnPopulateNetworkState(StaffInstanceState state) { } protected virtual void OnApplyNetworkState(StaffInstanceState state) { } protected void CacheComponents() { physGrabObject = ((Component)this).GetComponent<PhysGrabObject>(); itemBattery = ((Component)this).GetComponent<ItemBattery>(); itemToggle = ((Component)this).GetComponent<ItemToggle>(); itemEquippable = ((Component)this).GetComponent<ItemEquippable>(); propLight = ((Component)this).GetComponentInChildren<PropLight>(true); itemAttributes = ((Component)this).GetComponent<ItemAttributes>(); } private void Awake() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) CacheComponents(); if ((Object)(object)crystalMaterial != (Object)null) { crystalMaterial = new Material(crystalMaterial); if ((Object)(object)crystalRenderer != (Object)null) { crystalRenderer.material = crystalMaterial; } } HurtCollider[] componentsInChildren = ((Component)this).GetComponentsInChildren<HurtCollider>(true); foreach (HurtCollider val in componentsInChildren) { if ((Object)(object)val != (Object)null && (Object)(object)((Component)val).GetComponentInParent<SemiLaser>() == (Object)null) { ((Component)val).gameObject.SetActive(false); } } if ((Object)(object)screenArrow != (Object)null) { ((Component)screenArrow).gameObject.SetActive(false); } if ((Object)(object)loadedParticles != (Object)null) { loadedParticles.Stop(); loadedParticleChildren.Clear(); originalEmissionRates.Clear(); loadedParticleChildren.Add(loadedParticles); List<float> list = originalEmissionRates; EmissionModule emission = loadedParticles.emission; list.Add(((EmissionModule)(ref emission)).rateOverTimeMultiplier); foreach (Transform item in ((Component)loadedParticles).transform) { ParticleSystem component = ((Component)item).GetComponent<ParticleSystem>(); if ((Object)(object)component != (Object)null) { loadedParticleChildren.Add(component); List<float> list2 = originalEmissionRates; emission = component.emission; list2.Add(((EmissionModule)(ref emission)).rateOverTimeMultiplier); } } } OnStaffAwake(); } private void OnEnable() { if (!Active.Contains(this)) { Active.Add(this); } } private void OnDisable() { CancelSpell(); StopAllLoopingSounds(); Active.Remove(this); } private void OnDestroy() { CancelSpell(); StopAllLoopingSounds(); Active.Remove(this); } private void Start() { if ((Object)(object)itemToggle != (Object)null) { prevToggleState = itemToggle.toggleState; } OnStaffStart(); } protected virtual void Update() { if ((Object)(object)physGrabObject == (Object)null || (Object)(object)itemBattery == (Object)null || (Object)(object)itemToggle == (Object)null) { return; } if (IsEquipped) { if (currentState != StaffState.Idle) { CancelSpell(); StateSet(StaffState.Idle); } prevToggleState = itemToggle.toggleState; StopAllLoopingSounds(); return; } SetCameraPitch(); StateMachine(); UpdateChargeShake(); UpdateCrystalEmission(); LightOverrideTick(); UpdateScreenArrow(); UpdateLoadedParticleEmissionRate(); UpdateChargeParticleEmissionRate(); UpdateChoirSounds(); UpdateLoadedSoundLoops(); UpdateChargeSoundLoop(); UpdateBatteryUI(); UpdateInvestigation(); } protected virtual void FixedUpdate() { if (!IsEquipped && currentState == StaffState.ActiveSpell) { OnActiveSpellFixedUpdate(); } } protected void StateSet(StaffState nextState) { if (currentState != nextState) { currentState = nextState; stateImpulse = true; if (nextState != StaffState.Grabbed && nextState != StaffState.Charging && (Object)(object)screenArrow != (Object)null) { ((Component)screenArrow).gameObject.SetActive(false); } } } public void CancelSpell() { OnSpellCancel(); if (currentState == StaffState.Charging || currentState == StaffState.Loaded || currentState == StaffState.Casting || currentState == StaffState.ActiveSpell) { StateSet(StaffState.Idle); } StopParticleHierarchy(loadedParticles); StopParticleHierarchy(chargeUpParticles); if ((Object)(object)screenArrow != (Object)null) { ((Component)screenArrow).gameObject.SetActive(false); } } private void StateMachine() { switch (currentState) { case StaffState.Idle: StateIdle(); break; case StaffState.Grabbed: StateGrabbed(); break; case StaffState.Charging: StateCharging(); break; case StaffState.Loaded: StateLoaded(); break; case StaffState.Casting: StateCasting(); break; case StaffState.ActiveSpell: StateActiveSpell(); break; case StaffState.Lowering: StateLowering(); break; } } private void StateIdle() { if (stateImpulse) { stateImpulse = false; if ((Object)(object)screenArrow != (Object)null) { ((Component)screenArrow).gameObject.SetActive(false); } StopParticleHierarchy(loadedParticles); StopParticleHierarchy(chargeUpParticles); chargingTimer = 0f; castTimer = 0f; } if (IsGrabbed) { StateSet(StaffState.Grabbed); } } private void StateGrabbed() { if (stateImpulse) { stateImpulse = false; if ((Object)(object)screenArrow != (Object)null) { ((Component)screenArrow).gameObject.SetActive(!IsBroken); } if (!IsBroken && (Object)(object)chargeUpParticles != (Object)null) { chargeUpParticles.Play(true); } } if (!IsGrabbed) { StateSet(StaffState.Idle); return; } AlignToWorldUp(); OnTogglePressed(); if (CameraPitch < activationThreshold && !IsBroken) { StateSet(StaffState.Charging); } } private void StateCharging() { //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) if (stateImpulse) { stateImpulse = false; if ((Object)(object)screenArrow != (Object)null) { ((Component)screenArrow).gameObject.SetActive(!IsBroken); } chargingTimer = 0f; Sound? obj = chargeUpSound; if (obj != null) { obj.Play((Transform)(((Object)(object)projectileSpawnPoint != (Object)null) ? ((object)projectileSpawnPoint) : ((object)((Component)this).transform)), 1f, 1f, 1f, 1f); } ChargeImpact(2f); } if (!IsGrabbed) { StateSet(StaffState.Idle); return; } if (IsBroken) { StateSet(StaffState.Grabbed); return; } AlignToWorldUp(); OnTogglePressed(); if (CameraPitch >= activationThreshold) { StateSet(StaffState.Grabbed); return; } chargingTimer += Time.deltaTime; if (chargingTimer >= chargingTimerMax) { if (SemiFunc.IsMasterClientOrSingleplayer() && (Object)(object)physGrabObject?.rb != (Object)null) { Vector3 val = (((Object)(object)projectileSpawnPoint != (Object)null) ? projectileSpawnPoint.forward : ((Component)this).transform.up); physGrabObject.rb.AddForceAtPosition(val * 3f, SpawnOrigin, (ForceMode)1); } LightningSfx(); if ((Object)(object)loadedParticles != (Object)null) { loadedParticles.Play(); } OverrideLightAndCrystal(Color.white, 25f, 10f, 0.1f, 0.05f, 0.5f); StateSet(StaffState.Loaded); } } private void StateLoaded() { //IL_003b: 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) if (stateImpulse) { stateImpulse = false; if ((Object)(object)screenArrow != (Object)null) { ((Component)screenArrow).gameObject.SetActive(false); } if (SemiFunc.IsMasterClientOrSingleplayer()) { SemiFunc.EnemyInvestigate(((Component)this).transform.position, 7.5f, false); } } if (!IsGrabbed) { if ((Object)(object)denyParticles != (Object)null) { denyParticles.Play(true); } Sound? obj = denySound; if (obj != null) { obj.Play((Transform)(((Object)(object)projectileSpawnPoint != (Object)null) ? ((object)projectileSpawnPoint) : ((object)((Component)this).transform)), 1f, 1f, 1f, 1f); } OverrideLightAndCrystal(loadedColor, 1f, 0f, 0.1f); StateSet(StaffState.Idle); } else { OnTogglePressed(); ApplyStaffForwardTilt(); } } private void StateCasting() { if (stateImpulse) { stateImpulse = false; Sound? obj = castSound; if (obj != null) { obj.Play((Transform)(((Object)(object)projectileSpawnPoint != (Object)null) ? ((object)projectileSpawnPoint) : ((object)((Component)this).transform)), 1f, 1f, 1f, 1f); } ChargeImpact(3f); if ((Object)(object)screenArrow != (Object)null) { ((Component)screenArrow).gameObject.SetActive(false); } if ((Object)(object)loadedParticles != (Object)null) { loadedParticles.Stop(); } StopParticleHierarchy(chargeUpParticles); castTimer = 0f; } if (!IsGrabbed) { StateSet(StaffState.Idle); return; } ApplyStaffForwardTilt(); castTimer += Time.deltaTime; if (castTimer >= castTimerMax) { TryExecuteCast(); } } private void StateActiveSpell() { if (stateImpulse) { stateImpulse = false; } OnActiveSpellUpdate(); } private void StateLowering() { if (stateImpulse) { stateImpulse = false; droppedTimer = 0f; } if (!IsGrabbed) { droppedTimer += Time.deltaTime; if (droppedTimer > 2f) { StateSet(StaffState.Idle); } return; } droppedTimer = 0f; AlignToWorldUp(); OnTogglePressed(); if (CameraPitch >= activationThreshold) { StateSet(StaffState.Grabbed); } } private void OnTogglePressed() { //IL_004e: 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_00df: 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_00ec: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)itemToggle == (Object)null || itemToggle.toggleState == prevToggleState) { return; } prevToggleState = itemToggle.toggleState; if (currentState == StaffState.Loaded && !IsBroken) { StateSet(StaffState.Casting); return; } OverrideLightAndCrystal(loadedColor, 1f, 0f, 0.1f); Sound? obj = denySound; if (obj != null) { obj.Play((Transform)(((Object)(object)projectileSpawnPoint != (Object)null) ? ((object)projectileSpawnPoint) : ((object)((Component)this).transform)), 1f, 1f, 1f, 1f); } if (SemiFunc.IsMasterClientOrSingleplayer() && (Object)(object)physGrabObject?.rb != (Object)null) { Rigidbody rb = physGrabObject.rb; Vector3 insideUnitSphere = Random.insideUnitSphere; rb.AddForce(((Vector3)(ref insideUnitSphere)).normalized * 1f, (ForceMode)1); } if ((Object)(object)denyParticles != (Object)null) { denyParticles.Play(true); } if ((Object)(object)physGrabObject != (Object)null && physGrabObject.grabbedLocal && !IsBroken) { Sound? obj2 = denySoundUI; if (obj2 != null) { obj2.Play((Transform)(((Object)(object)projectileSpawnPoint != (Object)null) ? ((object)projectileSpawnPoint) : ((object)((Component)this).transform)), 1f, 1f, 1f, 1f); } if ((Object)(object)BatteryUI.instance != (Object)null) { BatteryUI.instance.DenyShake(); } SemiFunc.CameraShake(0.5f, 0.1f); SemiFunc.CameraShakeImpact(1f, 0.1f); } } private void TryExecuteCast() { //IL_0019: 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_0057: Unknown result type (might be due to invalid IL or missing references) if (IsBroken || InCart) { StateSet(StaffState.Lowering); return; } OverrideLightAndCrystal(Color.white, 15f, 0f, 0.1f); SemiFunc.CameraShakeDistance(SpawnOrigin, 3f, 0.1f, 3f, 8f); SemiFunc.CameraShakeImpactDistance(SpawnOrigin, 6f, 0.1f, 3f, 8f); batteryTimer = 0.5f; if (SemiFunc.IsMasterClientOrSingleplayer()) { if ((Object)(object)physGrabObject != (Object)null && (Object)(object)NativeAccess.PhysLastPlayerGrabbing.Invoke(physGrabObject) != (Object)null) { SemiFunc.PlayerShopKeeperStaffCastHost(NativeAccess.PhysLastPlayerGrabbing.Invoke(physGrabObject)); } ConsumeAmmo(); } bool flag = OnSpellCast(); StateSet(flag ? StaffState.ActiveSpell : StaffState.Lowering); } protected void ConsumeAmmo() { if ((Object)(object)itemBattery != (Object)null) { itemBattery.RemoveFullBar(1); } } protected void ApplyStaffForwardTilt() { //IL_003e: 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) if ((Object)(object)physGrabObject != (Object)null && IsGrabbed && !NativeAccess.PhysIsRotating.Invoke(physGrabObject)) { physGrabObject.TurnXYZ(Quaternion.Euler(75f, 0f, 0f), Quaternion.identity, Quaternion.identity); } } protected Vector3 ComputeAimDirection() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0026: 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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: 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_0104: 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_0123: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_00df: 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) Vector3 val = (((Object)(object)projectileSpawnPoint != (Object)null) ? projectileSpawnPoint.forward : ((Component)this).transform.up); if ((Object)(object)physGrabObject == (Object)null || physGrabObject.playerGrabbing == null || physGrabObject.playerGrabbing.Count == 0) { if (!(((Vector3)(ref val)).sqrMagnitude > 0.0001f)) { return Vector3.forward; } return ((Vector3)(ref val)).normalized; } PhysGrabber val2 = physGrabObject.playerGrabbing[0]; Transform val3 = (((Object)(object)val2 != (Object)null && (Object)(object)val2.playerAvatar != (Object)null && (Object)(object)val2.playerAvatar.localCamera != (Object)null) ? val2.playerAvatar.localCamera.GetOverrideTransform() : null); if ((Object)(object)val3 == (Object)null) { if (!(((Vector3)(ref val)).sqrMagnitude > 0.0001f)) { return Vector3.forward; } return ((Vector3)(ref val)).normalized; } float num = StaffRules.AimBlendWeight(NativeAccess.PhysIsRotating.Invoke(physGrabObject)); Vector3 val4 = Vector3.Lerp(val, val3.forward, num); if (!(((Vector3)(ref val4)).sqrMagnitude > 0.0001f)) { return ((Vector3)(ref val)).normalized; } return ((Vector3)(ref val4)).normalized; } private void AlignToWorldUp() { //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: 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_00db: 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_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.IsMasterClientOrSingleplayer() || (Object)(object)physGrabObject == (Object)null || currentState == StaffState.Loaded || currentState == StaffState.Casting || currentState == StaffState.ActiveSpell || physGrabObject.playerGrabbing == null || physGrabObject.playerGrabbing.Count == 0) { return; } PhysGrabber val = physGrabObject.playerGrabbing[0]; if (!((Object)(object)val == (Object)null) && !((Object)(object)val.playerAvatar == (Object)null) && !((Object)(object)val.playerAvatar.localCamera == (Object)null)) { Transform overrideTransform = val.playerAvatar.localCamera.GetOverrideTransform(); Quaternion val2 = Quaternion.Inverse(overrideTransform.rotation); Vector3 forward = overrideTransform.forward; forward.y = 0f; if (((Vector3)(ref forward)).sqrMagnitude < 0.0001f) { forward = Vector3.forward; } else { ((Vector3)(ref forward)).Normalize(); } val.cameraRelativeGrabbedForward = val2 * forward; val.cameraRelativeGrabbedUp = val2 * Vector3.up; } } private void SetCameraPitch() { //IL_007b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)physGrabObject == (Object)null || physGrabObject.playerGrabbing == null || physGrabObject.playerGrabbing.Count == 0) { return; } PhysGrabber val = physGrabObject.playerGrabbing[0]; if (!((Object)(object)val == (Object)null) && !((Object)(object)val.playerAvatar == (Object)null) && !((Object)(object)val.playerAvatar.localCamera == (Object)null)) { float num = val.playerAvatar.localCamera.GetOverrideTransform().eulerAngles.x; if (num > 180f) { num -= 360f; } CameraPitch = num; LookUpProgress = StaffRules.LookUpProgress(num, activationThreshold); } } private void UpdateInvestigation() { //IL_0067: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.IsMasterClientOrSingleplayer() && SemiFunc.PerSecond(1f, (Object)(object)this) && IsGrabbed && !IsBroken) { float num = StaffRules.LookUpProgress(CameraPitch, activationThreshold); if ((currentState == StaffState.Grabbed || currentState == StaffState.Charging) && num > 0.05f) { float num2 = Mathf.Lerp(8f, 18f, num); SemiFunc.EnemyInvestigate(((Component)this).transform.position, num2, false); } } } private void UpdateScreenArrow() { //IL_005b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)screenArrow != (Object)null && ((Component)screenArrow).gameObject.activeSelf) { float num = 0.025f; float num2 = 10f; float num3 = 8f; float num4 = Mathf.Sin(Mathf.Floor(Time.time * num3) / num3 * num2) * num; screenArrow.localPosition = new Vector3(0f, num4, 0f); } } private void UpdateChargeParticleEmissionRate() { //IL_009a: 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_00a3: 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_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)chargeUpParticles == (Object)null) { return; } if (!IsGrabbed || IsBroken) { StopParticleHierarchy(chargeUpParticles); StopParticleHierarchy(loadedParticles); return; } if (CameraPitch > activationThreshold && currentState == StaffState.Loaded) { chargeEmissionLocked = true; } if (currentState != StaffState.Loaded) { chargeEmissionLocked = false; } float num = (chargeEmissionLocked ? 5f : Mathf.Lerp(0f, 25f, StaffRules.LookUpProgress(CameraPitch, activationThreshold))); EmissionModule emission = chargeUpParticles.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(num); foreach (Transform item in ((Component)chargeUpParticles).transform) { ParticleSystem component = ((Component)item).GetComponent<ParticleSystem>(); if ((Object)(object)component != (Object)null) { EmissionModule emission2 = component.emission; ((EmissionModule)(ref emission2)).rateOverTime = MinMaxCurve.op_Implicit(num); } } } private void UpdateLoadedParticleEmissionRate() { //IL_00a5: 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) if (loadedParticleChildren.Count == 0) { return; } if (currentState != StaffState.Loaded && currentState != StaffState.Casting && currentState != StaffState.ActiveSpell) { emissionLocked = false; } else { if (!SemiFunc.PerSecond(10f, (Object)(object)this)) { return; } if (currentState == StaffState.Loaded && CameraPitch > activationThreshold) { emissionLocked = true; } float num = (emissionLocked ? 0.1f : 1f); if (currentState == StaffState.Casting || currentState == StaffState.ActiveSpell) { num = 1f; } for (int i = 0; i < loadedParticleChildren.Count; i++) { ParticleSystem val = loadedParticleChildren[i]; if (!((Object)(object)val == (Object)null)) { EmissionModule emission = val.emission; float num2 = ((i == 0) ? Mathf.Lerp(0.01f, 1f, num) : num); ((EmissionModule)(ref emission)).rateOverTimeMultiplier = originalEmissionRates[i] * num2; } } } } private void UpdateCrystalEmission() { //IL_00c6: 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_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) bool flag = currentState == StaffState.Loaded || currentState == StaffState.Casting || currentState == StaffState.ActiveSpell; float num = (IsBroken ? 0f : 0.18f); float intensity = (IsBroken ? 0f : 0.4f); if ((IsGrabbed || currentState == StaffState.ActiveSpell) && !IsBroken) { if (flag) { num = crystalLoadedMultiplier; intensity = initialLightIntensity; float num2 = Mathf.Sin(Time.time * 12f); num += num2 * 0.1f; intensity += num2; } else { num = Mathf.Lerp(0.18f, crystalLoadedMultiplier, LookUpProgress); intensity = Mathf.Lerp(0.4f, initialLightIntensity, LookUpProgress); } } Color val = loadedColor * (num * 3f); if (lightOverrideActive) { lightOverrideIntensityDefault = intensity; crystalOverrideColorDefault = val; return; } Material? obj = crystalMaterial; if (obj != null) { obj.SetColor(EmissionColorId, val); } PropLight? obj2 = propLight; if (obj2 != null) { obj2.SetIntensity(intensity); } } public void OverrideLightAndCrystal(Color color, float intensity, float holdTime, float fadeIn = 0.2f, float fadeOut = 0.2f) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) OverrideLightAndCrystal(color, intensity, -1f, holdTime, fadeIn, fadeOut); } public void OverrideLightAndCrystal(Color color, float intensity, float range, float holdTime, float fadeIn, float fadeOut) { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_007f: 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) //IL_0073: 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) Light val = (((Object)(object)propLight != (Object)null) ? NativeAccess.PropLightComponent.Invoke(propLight) : null); if (!((Object)(object)val == (Object)null) && !((Object)(object)crystalMaterial == (Object)null)) { if (!lightOverrideActive) { lightOverrideColorDefault = val.color; lightOverrideIntensityDefault = val.intensity; lightOverrideRangeDefault = val.range; crystalOverrideColorDefault = crystalMaterial.GetColor(EmissionColorId); } lightOverrideColor = color; lightOverrideIntensity = intensity; lightOverrideRange = ((range < 0f) ? lightOverrideRangeDefault : range); lightOverrideTimer = holdTime; lightOverrideFadeIn = Mathf.Max(0.01f, fadeIn); lightOverrideFadeOut = Mathf.Max(0.01f, fadeOut); lightOverrideLerp = 0f; lightOverridePhase = 0; lightOverrideActive = true; } } private void LightOverrideTick() { //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: 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_014b: 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_015c: Unknown result type (might be due to invalid IL or missing references) Light val = (((Object)(object)propLight != (Object)null) ? NativeAccess.PropLightComponent.Invoke(propLight) : null); if (!lightOverrideActive || (Object)(object)val == (Object)null || (Object)(object)crystalMaterial == (Object)null) { lightOverrideActive = false; return; } if (lightOverridePhase == 0) { lightOverrideLerp = Mathf.MoveTowards(lightOverrideLerp, 1f, Time.deltaTime / lightOverrideFadeIn); if (lightOverrideLerp >= 0.999f) { lightOverrideLerp = 1f; lightOverridePhase = 1; } } else if (lightOverridePhase == 1) { lightOverrideTimer -= Time.deltaTime; if (lightOverrideTimer <= 0f) { lightOverridePhase = 2; } } else { lightOverrideLerp = Mathf.MoveTowards(lightOverrideLerp, 0f, Time.deltaTime / lightOverrideFadeOut); } val.color = Color.Lerp(lightOverrideColorDefault, lightOverrideColor, lightOverrideLerp); val.intensity = Mathf.Lerp(lightOverrideIntensityDefault, lightOverrideIntensity, lightOverrideLerp); val.range = Mathf.Lerp(lightOverrideRangeDefault, lightOverrideRange, lightOverrideLerp); crystalMaterial.SetColor(EmissionColorId, Color.Lerp(crystalOverrideColorDefault, lightOverrideColor, lightOverrideLerp)); if (lightOverrideLerp <= 0.001f) { lightOverrideLerp = 0f; lightOverrideActive = false; } } private void UpdateChoirSounds() { bool flag = currentState == StaffState.Loaded || currentState == StaffState.Casting || currentState == StaffState.ActiveSpell; if (!flag) { choirLocked = false; } if (!IsGrabbed) { Sound? obj = choir01Sound; if (obj != null) { obj.PlayLoop(false, 2f, 1f, lastChoirPitch01, lastChoirVolume01); } Sound? obj2 = choir02Sound; if (obj2 != null) { obj2.PlayLoop(false, 2f, 1f, lastChoirPitch02, lastChoirVolume02); } return; } float num = Mathf.InverseLerp(-10f, activationThreshold, CameraPitch); float num2 = Mathf.InverseLerp(0f, activationThreshold, CameraPitch); if (flag && CameraPitch > activationThreshold) { choirLocked = true; } choirPlaying = CameraPitch < 0f && !choirLocked && !IsBroken; float num3 = Mathf.InverseLerp(0f, -15f, CameraPitch); float num4 = Mathf.InverseLerp(-15f, -40f, CameraPitch); float num5 = (choirLocked ? 1f : Mathf.Lerp(0.75f, 1f, num)); float num6 = (choirLocked ? 1f : Mathf.Lerp(0.75f, 1f, num2)); float num7 = num3 * (1f - num4); float num8 = num4; lastChoirPitch01 = num5; lastChoirPitch02 = num6; lastChoirVolume01 = num7; lastChoirVolume02 = num8; Sound? obj3 = choir01Sound; if (obj3 != null) { obj3.PlayLoop(choirPlaying, 2f, 1f, num5, num7); } Sound? obj4 = choir02Sound; if (obj4 != null) { obj4.PlayLoop(choirPlaying, 2f, 1f, num6, num8); } } private void UpdateChargeSoundLoop() { bool flag = currentState == StaffState.Grabbed; float num = (IsBroken ? 0f : Mathf.Clamp01(StaffRules.LookUpProgress(CameraPitch, activationThreshold))); Sound? obj = chargeUpSoundLoop; if (obj != null) { obj.PlayLoop(flag, 2f, 1f, 1f, num); } } private void UpdateLoadedSoundLoops() { if (currentState != StaffState.Loaded && currentState != StaffState.Casting) { Sound? obj = loadedHighSoundLoop; if (obj != null) { obj.PlayLoop(false, 2f, 1f, 1f, 1f); } Sound? obj2 = loadedLowSoundLoop; if (obj2 != null) { obj2.PlayLoop(false, 2f, 1f, 1f, 1f); } loadedSoundLowActive = false; return; } if (CameraPitch > activationThreshold) { loadedSoundLowActive = true; } Sound? obj3 = loadedHighSoundLoop; if (obj3 != null) { obj3.PlayLoop(!loadedSoundLowActive, 2f, 1f, 1f, 1f); } Sound? obj4 = loadedLowSoundLoop; if (obj4 != null) { obj4.PlayLoop(loadedSoundLowActive, 2f, 1f, 1f, 1f); } } private void StopAllLoopingSounds() { Sound? obj = choir01Sound; if (obj != null) { obj.PlayLoop(false, 2f, 1f, lastChoirPitch01, lastChoirVolume01); } Sound? obj2 = choir02Sound; if (obj2 != null) { obj2.PlayLoop(false, 2f, 1f, lastChoirPitch02, lastChoirVolume02); } Sound? obj3 = chargeUpSoundLoop; if (obj3 != null) { obj3.PlayLoop(false, 2f, 1f, 1f, 0f); } Sound? obj4 = loadedHighSoundLoop; if (obj4 != null) { obj4.PlayLoop(false, 2f, 1f, 1f, 1f); } Sound? obj5 = loadedLowSoundLoop; if (obj5 != null) { obj5.PlayLoop(false, 2f, 1f, 1f, 1f); } } private void UpdateChargeShake() { if (!((Object)(object)physGrabObject == (Object)null) && physGrabObject.grabbedLocal && !IsEquipped && !IsBroken && !((Object)(object)GameDirector.instance == (Object)null)) { float num = 0f; if (currentState == StaffState.Grabbed) { num = Mathf.Lerp(0f, 4f, LookUpProgress); } else if (currentState == StaffState.Charging) { float num2 = (stateImpulse ? 0f : Mathf.Clamp01(chargingTimer / Mathf.Max(chargingTimerMax, 0.01f))); num = Mathf.Lerp(4f, 6f, num2); } else if (currentState == StaffState.Casting) { float num3 = (stateImpulse ? 0f : Mathf.Clamp01(castTimer / Mathf.Max(castTimerMax, 0.01f))); num = Mathf.Lerp(2f, 5f, num3); } if (num > 0f) { GameDirector.instance.CameraShake.Shake(num, 0.1f); } } } private void LightningSfx() { Sound? obj = lightning01Sound; if (obj != null) { obj.Play((Transform)(((Object)(object)projectileSpawnPoint != (Object)null) ? ((object)projectileSpawnPoint) : ((object)((Component)this).transform)), 1f, 1f, 1f, 1f); } ChargeImpact(5f); } private void ChargeImpact(float strength) { if ((Object)(object)physGrabObject != (Object)null && physGrabObject.grabbedLocal && !IsEquipped && !IsBroken) { SemiFunc.CameraShakeImpact(strength, 0.08f); } } private void UpdateBatteryUI() { //IL_0080: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)physGrabObject == (Object)null) && physGrabObject.grabbedLocal && !((Object)(object)BatteryUI.instance == (Object)null)) { bool num = currentState == StaffState.Loaded || currentState == StaffState.Casting || currentState == StaffState.ActiveSpell || batteryTimer > 0f || IsBroken; if (batteryTimer > 0f) { batteryTimer -= Time.deltaTime; } if (!num) { BatteryUI.instance.OverrideColor(Color.grey, 0.3f); } } } private static void StopParticleHierarchy(ParticleSystem? ps) { if ((Object)(object)ps != (Object)null) { ps.Stop(true); } } public StaffInstanceState BuildNetworkState() { StaffInstanceState staffInstanceState = new StaffInstanceState { StaffId = Id, Kind = Kind, State = (int)currentState, Battery = (((Object)(object)itemBattery != (Object)null) ? Mathf.Clamp(itemBattery.batteryLife, 0f, 100f) : 0f) }; OnPopulateNetworkState(staffInstanceState); return staffInstanceState; } public void ApplyNetworkState(StaffInstanceState state) { if (state != null && state.Kind == Kind) { if ((Object)(object)itemBattery != (Object)null) { itemBattery.batteryLife = Mathf.Clamp(state.Battery, 0f, 100f); } OnApplyNetworkState(state); } } } public static class NativeAccess { internal static readonly FieldRef<ItemAttributes, string> InstanceName = AccessTools.FieldRefAccess<ItemAttributes, string>("instanceName"); internal static readonly FieldRef<ItemAttributes, string> ItemName = AccessTools.FieldRefAccess<ItemAttributes, string>("itemName"); internal static readonly FieldRef<ItemAttributes, string> CachedItemName = AccessTools.FieldRefAccess<ItemAttributes, string>("cachedItemName"); internal static readonly FieldRef<ItemAttributes, string> ItemTag = AccessTools.FieldRefAccess<ItemAttributes, string>("itemTag"); internal static readonly FieldRef<ItemAttributes, string> PromptName = AccessTools.FieldRefAccess<ItemAttributes, string>("promptName"); internal static readonly FieldRef<StatsManager, SortedDictionary<string, Dictionary<string, int>>> Dictionaries = AccessTools.FieldRefAccess<StatsManager, SortedDictionary<string, Dictionary<string, int>>>("dictionaryOfDictionaries"); internal static readonly FieldInfo? SingleplayerPoolField = AccessTools.Field(typeof(RunManager), "singleplayerPool"); private static readonly FieldRef<SemiLaser, float> LaserActiveTimer = AccessTools.FieldRefAccess<SemiLaser, float>("isActiveTimer"); private static readonly FieldRef<SemiLaser, bool> LaserIsActive = AccessTools.FieldRefAccess<SemiLaser, bool>("isActive"); private static readonly FieldRef<SemiLaser, bool> LaserIsActivePrev = AccessTools.FieldRefAccess<SemiLaser, bool>("isActivePrev"); private static readonly FieldRef<SemiLaser, float> LaserHittingTimer = AccessTools.FieldRefAccess<SemiLaser, float>("isHittingTimer"); private static readonly FieldRef<SemiLaser, bool> LaserIsHitting = AccessTools.FieldRefAccess<SemiLaser, bool>("isHitting"); private static readonly FieldRef<SemiLaser, bool> LaserStartFlag = AccessTools.FieldRefAccess<SemiLaser, bool>("laserStart"); private static readonly FieldRef<SemiLaser, bool> LaserEndFlag = AccessTools.FieldRefAccess<SemiLaser, bool>("laserEnd"); internal static readonly FieldRef<SemiLaser, HurtCollider> LaserHurtCollider = AccessTools.FieldRefAccess<SemiLaser, HurtCollider>("hurtCollider"); internal static readonly FieldRef<ItemBattery, int> BatteryLifeInt = AccessTools.FieldRefAccess<ItemBattery, int>("batteryLifeInt"); internal static readonly FieldRef<ItemEquippable, bool> EquippableIsEquipped = AccessTools.FieldRefAccess<ItemEquippable, bool>("isEquipped"); internal static readonly FieldRef<PhysGrabObject, PhysGrabObjectImpactDetector> PhysImpactDetector = AccessTools.FieldRefAccess<PhysGrabObject, PhysGrabObjectImpactDetector>("impactDetector"); internal static readonly FieldRef<PhysGrabObject, PlayerAvatar> PhysLastPlayerGrabbing = AccessTools.FieldRefAccess<PhysGrabObject, PlayerAvatar>("lastPlayerGrabbing"); internal static readonly FieldRef<PhysGrabObject, bool> PhysIsRotating = AccessTools.FieldRefAccess<PhysGrabObject, bool>("isRotating"); internal static readonly FieldRef<HurtCollider, PlayerAvatar> HurtPlayerCausingOverride = AccessTools.FieldRefAccess<HurtCollider, PlayerAvatar>("playerCausingHurtOverride"); internal static readonly FieldRef<PropLight, Light> PropLightComponent = AccessTools.FieldRefAccess<PropLight, Light>("lightComponent"); public static bool Host { get { if ((Object)(object)GameManager.instance != (Object)null) { return SemiFunc.IsMasterClientOrSingleplayer(); } return false; } } public static bool Multiplayer { get { if ((Object)(object)GameManager.instance != (Object)null) { return SemiFunc.IsMultiplayer(); } return false; } } public static void StopLaserImmediately(SemiLaser? laser) { if (!((Object)(object)laser == (Object)null)) { LaserActiveTimer.Invoke(laser) = 0f; LaserIsActive.Invoke(laser) = false; LaserIsActivePrev.Invoke(laser) = false; LaserHittingTimer.Invoke(laser) = 0f; LaserIsHitting.Invoke(laser) = false; LaserStartFlag.Invoke(laser) = false; LaserEndFlag.Invoke(laser) = true; HurtCollider val = (((Object)(object)LaserHurtCollider.Invoke(laser) != (Object)null) ? LaserHurtCollider.Invoke(laser) : ((Component)laser).GetComponentInChildren<HurtCollider>(true)); if ((Object)(object)val != (Object)null) { ((Component)val).gameObject.SetActive(false); } if ((Object)(object)laser.enableLaser != (Object)null) { laser.enableLaser.SetActive(false); } } } public static int Id(Component? component) { if ((Object)(object)component == (Object)null) { return 0; } if (!Multiplayer) { return ((Object)component).GetInstanceID(); } PhotonView component2 = component.GetComponent<PhotonView>(); if (component2 == null) { return 0; } return component2.ViewID; } public static bool Finite(Vector3 value) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) if (StaffRules.Finite(value.x) && StaffRules.Finite(value.y)) { return StaffRules.Finite(value.z); } return false; } } [BepInPlugin("com.matsu.repomorestaffs", "Repo More Staffs", "0.1.0")] [BepInDependency("REPOLib", "4.2.0")] public sealed class Plugin : BaseUnityPlugin { public const string Guid = "com.matsu.repomorestaffs"; public const string Version = "0.1.0"; internal static ManualLogSource Log; public static ConfigEntry<float> BeamDuration; public static ConfigEntry<float> BeamRange; public static ConfigEntry<float> BeamEnemyDamageScale; public static ConfigEntry<bool> BeamFriendlyFire; public static ConfigEntry<float> ShopPriceMultiplier; private Harmony? patches; private void Awake() { //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; BeamDuration = ((BaseUnityPlugin)this).Config.Bind<float>("ClownBeamStaff", "BeamDuration", 2.2f, "Duration in seconds of each Clown Beam burst (0.5 - 6.0)."); BeamRange = ((BaseUnityPlugin)this).Config.Bind<float>("ClownBeamStaff", "BeamRange", 15f, "Maximum reach in metres of the Clown Beam raycast (5 - 30)."); BeamEnemyDamageScale = ((BaseUnityPlugin)this).Config.Bind<float>("ClownBeamStaff", "EnemyDamageMultiplier", 1f, "Enemy damage multiplier applied to the Clown Beam HurtCollider (0.25 - 3.0)."); BeamFriendlyFire = ((BaseUnityPlugin)this).Config.Bind<bool>("ClownBeamStaff", "FriendlyFire", true, "Whether the Clown Beam can hurt non-holding players (matches vanilla Clown/Dumgolf chaos; current holder is shielded at muzzle)."); ShopPriceMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Shop", "PriceMultiplier", 1.15f, "Price multiplier relative to vanilla Staff base value (0.5 - 3.0)."); patches = new Harmony("com.matsu.repomorestaffs"); patches.PatchAll(typeof(Plugin).Assembly); StaffNetwork.Initialize(); SceneManager.sceneLoaded += OnSceneLoaded; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Repo More Staffs loaded; Clown Beam Staff registered when catalog initializes."); } private static void OnSceneLoaded(Scene scene, LoadSceneMode mode) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown if ((Object)(object)StaffDirector.Instance == (Object)null) { GameObject val = new GameObject("More Staffs Director"); Object.DontDestroyOnLoad((Object)val); val.AddComponent<StaffDirector>(); } StaffDirector.Instance.SceneChanged(); } private void OnDestroy() { Log.LogInfo((object)"Repo More Staffs loader component destroyed; static hooks retained."); } } public static class StaffAssets { public const string NativeSourceStaffName = "Item Staff Torque"; public const string NativeSourceStaffPath = "Items/Item Staff Torque"; public const string DumgolfStaffPath = "Valuables/06 Tall/Valuable Wizard Dumgolfs Staff"; public const string FallbackLaserItemPath = "Items/Item Gun Laser"; public static readonly Dictionary<StaffKind, Item> Registered = new Dictionary<StaffKind, Item>(); public static readonly Dictionary<StaffKind, GameObject> Templates = new Dictionary<StaffKind, GameObject>(); private static readonly Dictionary<string, GameObject> TemplatesByPath = new Dictionary<string, GameObject>(StringComparer.OrdinalIgnoreCase); private static readonly int ExpectedKindCount = Enum.GetValues(typeof(StaffKind)).Length; private static Transform? holder; private static bool? lastLocaleJa; private static bool TemplatesReady { get { if (Registered.Count == ExpectedKindCount && Templates.Count == ExpectedKindCount && Templates.Values.All((GameObject t) => (Object)(object)t != (Object)null)) { return Registered.Values.All((Item i) => (Object)(object)i != (Object)null && i.prefab != null); } return false; } } public static bool Ready { get { Item value; if (TemplatesReady && (Object)(object)StatsManager.instance != (Object)null) { return Registered.Values.All((Item i) => StatsManager.instance.itemDictionary.TryGetValue(((Object)i).name, out value) && (Object)(object)value == (Object)(object)i); } return false; } } public static string Status { get; private set; } = "Waiting for native catalog"; public static string LaserSourceUsed { get; private set; } = "Unresolved"; public static bool TryGetTemplateByPath(string? path, out GameObject? prefab) { if (!string.IsNullOrEmpty(path) && TemplatesByPath.TryGetValue(path, out GameObject value) && (Object)(object)value != (Object)null) { prefab = value; return true; } prefab = null; return false; } private static Dictionary<string, Object>? GetSingleplayerPool() { if (!((Object)(object)RunManager.instance != (Object)null) || !(NativeAccess.SingleplayerPoolField != null)) { return null; } return NativeAccess.SingleplayerPoolField.GetValue(RunManager.instance) as Dictionary<string, Object>; } private static GameObject? SafeGetNativeItemPrefab(Item? item) { if ((Object)(object)item == (Object)null || item.prefab == null || Registered.Values.Contains(item)) { return null; } string resourcePath = ((PrefabRef<GameObject>)(object)item.prefab).ResourcePath; if (string.IsNullOrEmpty(resourcePath) || string.Equals(resourcePath, "Items/Item Staff Clown Beam", StringComparison.OrdinalIgnoreCase)) { return null; } Dictionary<string, Object> singleplayerPool = GetSingleplayerPool(); if (singleplayerPool != null && singleplayerPool.TryGetValue(resourcePath, out var value)) { GameObject val = (GameObject)(object)((value is GameObject) ? value : null); if (val != null && (Object)(object)val != (Object)null) { return val; } } return Resources.Load<GameObject>(resourcePath); } private static SemiLaser? ResolveNativeSemiLaser(out string sourceLabel) { GameObject val = Resources.Load<GameObject>("Valuables/06 Tall/Valuable Wizard Dumgolfs Staff"); if ((Object)(object)val != (Object)null) { ValuableWizardStaff val2 = val.GetComponent<ValuableWizardStaff>() ?? val.GetComponentInChildren<ValuableWizardStaff>(true); if ((Object)(object)val2 != (Object)null && (Object)(object)val2.semiLaser != (Object)null) { sourceLabel = "Valuables/06 Tall/Valuable Wizard Dumgolfs Staff (ValuableWizardStaff.semiLaser)"; return val2.semiLaser; } SemiLaser componentInChildren = val.GetComponentInChildren<SemiLaser>(true); if ((Object)(object)componentInChildren != (Object)null) { sourceLabel = "Valuables/06 Tall/Valuable Wizard Dumgolfs Staff (Child SemiLaser)"; return componentInChildren; } } GameObject val3 = Resources.Load<GameObject>("Items/Item Gun Laser"); if ((Object)(object)val3 != (Object)null) { ItemGunLaser val4 = val3.GetComponent<ItemGunLaser>() ?? val3.GetComponentInChildren<ItemGunLaser>(true); if ((Object)(object)val4 != (Object)null && (Object)(object)val4.semiLaser != (Object)null) { sourceLabel = "Items/Item Gun Laser (ItemGunLaser.semiLaser)"; return val4.semiLaser; } SemiLaser componentInChildren2 = val3.GetComponentInChildren<SemiLaser>(true); if ((Object)(object)componentInChildren2 != (Object)null) { sourceLabel = "Items/Item Gun Laser (Child SemiLaser)"; return componentInChildren2; } } sourceLabel = "None"; return null; } public static bool TryRegister() { //IL_0157: 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_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Expected O, but got Unknown if ((Object)(object)StatsManager.instance == (Object)null) { Status = "Waiting for StatsManager"; return false; } if (TemplatesReady) { return BindCurrentCatalog(); } (Item, GameObject)[] source = (from i in StatsManager.instance.itemDictionary.Values.Concat(Items.AllItems).Distinct() select (item: i, go: SafeGetNativeItemPrefab(i)) into x where (Object)(object)x.item != (Object)null && (Object)(object)x.go != (Object)null && (Object)(object)x.go.GetComponent<ItemStaffTorque>() != (Object)null && (Object)(object)x.go.GetComponent<MoreStaffBase>() == (Object)null select x).OrderBy<(Item, GameObject), string>(((Item item, GameObject go) x) => ((Object)x.item).name, StringComparer.Ordinal).ToArray(); Item val = source.FirstOrDefault(((Item item, GameObject go) x) => string.Equals(((Object)x.item).name, "Item Staff Torque", StringComparison.Ordinal)).item ?? source.FirstOrDefault().Item1; if ((Object)(object)val == (Object)null) { Status = "Native source staff unavailable; catalog count=" + Items.AllItems.Count; return false; } string sourceLabel; SemiLaser val2 = ResolveNativeSemiLaser(out sourceLabel); LaserSourceUsed = sourceLabel; if ((Object)(object)val2 == (Object)null) { Status = "Native SemiLaser source unavailable"; return false; } if ((Object)(object)holder == (Object)null) { GameObject val3 = new GameObject("More Staffs dormant templates"); val3.SetActive(false); Object.DontDestroyOnLoad((Object)val3); holder = val3.transform; } foreach (StaffKind value2 in Enum.GetValues(typeof(StaffKind))) { if (!Registered.ContainsKey(value2) || !Templates.TryGetValue(value2, out GameObject value) || (Object)(object)value == (Object)null) { Register(val, val2, value2); } } return BindCurrentCatalog(); } private static void SyncPrefabPools(Item item, GameObject? template) { if (item?.prefab != null && !((Object)(object)template == (Object)null)) { string text = ((PrefabRef<GameObject>)(object)item.prefab).ResourcePath; if (string.IsNullOrEmpty(text)) { text = "Items/" + ((Object)item).name; } TemplatesByPath[text] = template; TemplatesByPath[((Object)item).name] = template; Dictionary<string, Object> singleplayerPool = GetSingleplayerPool(); if (singleplayerPool != null) { singleplayerPool[text] = (Object)(object)template; } } } private static bool BindCurrentCatalog() { StatsManager instance = StatsManager.instance; if ((Object)(object)instance == (Object)null) { return false; } foreach (KeyValuePair<StaffKind, Item> item in Registered) { Item value = item.Value; if (!((Object)(object)value == (Object)null)) { if (Templates.TryGetValue(item.Key, out GameObject value2) && (Object)(object)value2 != (Object)null) { SyncPrefabPools(value, value2); } if (instance.itemDictionary.TryGetValue(((Object)value).name, out var value3) && (Object)(object)value3 != (Object)null && (Object)(object)value3 != (Object)(object)value) { Status = "Conflicting native item ID: " + ((Object)value).name; return false; } instance.itemDictionary[((Object)value).name] = value; } } RefreshLocalization(force: true); Status = "Ready: Clown Beam Staff registered (" + LaserSourceUsed + ")"; return Ready; } public static bool IsJapanese() { try { string text = SemiFunc.LocaleGetCode(); return !string.IsNullOrEmpty(text) && text.StartsWith("ja", StringComparison.OrdinalIgnoreCase); } catch { return false; } } public static string ResolveName(StaffKind kind) { bool flag = IsJapanese(); if (kind == StaffKind.ClownBeam) { return flag ? "ピエロビームの杖" : "Clown Beam Staff"; } return "Unknown Staff"; } public static string ResolveDescription(StaffKind kind) { bool flag = IsJapanese(); if (kind == StaffKind.ClownBeam) { return flag ? "上を向いて魔力を溜め、前へ構えて撃つピエロビームの杖。高威力の深紅レーザーを照射し、敵を撃破する。照射中に手放すと激しい反動で暴れる。" : "Look up to charge, lower to aim, and fire a sweeping Clown laser beam. Burns enemies on contact and bucks with wild recoil if dropped mid-blast."; } return string.Empty; } public static void RefreshLocalization(bool force = false) { bool flag = IsJapanese(); if (!force && lastLocaleJa == flag) { return; } lastLocaleJa = flag; foreach (KeyValuePair<StaffKind, Item> item in Registered) { Item value = item.Value; if ((Object)(object)value == (Object)null) { continue; } string itemName = ResolveName(item.Key); string description = ResolveDescription(item.Key); value.itemName = itemName; value.itemNameLocalized = null; value.description = description; if (Templates.TryGetValue(item.Key, out GameObject value2) && (Object)(object)value2 != (Object)null) { ItemAttributes component = value2.GetComponent<ItemAttributes>(); if (component != null) { ApplyLocalization(component, item.Key); } } } foreach (MoreStaffBase item2 in MoreStaffBase.Active) { if ((Object)(object)item2 != (Object)null) { ItemAttributes component2 = ((Component)item2).GetComponent<ItemAttributes>(); if (component2 != null) { ApplyLocalization(component2, item2.Kind); } } } } public static void ApplyLocalization(ItemAttributes attributes, StaffKind kind) { if (!((Object)(object)attributes == (Object)null)) { string text = ResolveName(kind); string description = ResolveDescription(kind); if ((Object)(object)attributes.item != (Object)null) { attributes.item.itemName = text; attributes.item.itemNameLocalized = null; attributes.item.description = description; } NativeAccess.ItemName.Invoke(attributes) = text; NativeAccess.CachedItemName.Invoke(attributes) = text; NativeAccess.ItemTag.Invoke(attributes) = string.Empty; NativeAccess.PromptName.Invoke(attributes) = string.Empty; } } public static bool TryGetKind(ItemAttributes? attributes, out StaffKind kind) { if ((Object)(object)attributes != (Object)null) { MoreStaffBase component = ((Component)attributes).GetComponent<MoreStaffBase>(); if (component != null) { kind = component.Kind; return true; } if ((Object)(object)attributes.item != (Object)null) { foreach (KeyValuePair<StaffKind, Item> item in Registered) { if ((Object)(object)item.Value == (Object)(object)attributes.item || ((Object)item.Value).name == ((Object)attributes.item).name) { kind = item.Key; return true; } } } } kind = StaffKind.ClownBeam; return false; } private static List<Action> PreserveExistingStats(string itemName) { List<Action> list = new List<Action>(); if ((Object)(object)StatsManager.instance == (Object)null) { return list; } foreach (KeyValuePair<string, Dictionary<string, int>> item in NativeAccess.Dictionaries.Invoke(StatsManager.instance)) { if (!item.Key.StartsWith("item", StringComparison.Ordinal)) { continue; } Dictionary<string, int> data = item.Value; int value; bool existed = data.TryGetValue(itemName, out value); list.Add(delegate { if (existed) { data[itemName] = value; } else { data.Remove(itemName); } }); } return list; } private static void Register(Item source, SemiLaser sourceSemiLaser, StaffKind kind) { //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0142: 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_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_0400: Unknown result type (might be due to invalid IL or missing references) //IL_0405: Unknown result type (might be due to invalid IL or missing references) //IL_0435: Unknown result type (might be due to invalid IL or missing references) //IL_0437: Unknown result type (might be due to invalid IL or missing references) //IL_0443: Unknown result type (might be due to invalid IL or missing references) //IL_0445: Unknown result type (might be due to invalid IL or missing references) //IL_044f: Unknown result type (might be due to invalid IL or missing references) //IL_0454: Unknown result type (might be due to invalid IL or missing references) //IL_0460: Unknown result type (might be due to invalid IL or missing references) //IL_0467: Unknown result type (might be due to invalid IL or missing references) //IL_046c: Unknown result type (might be due to invalid IL or missing references) //IL_0474: Unknown result type (might be due to invalid IL or missing references) //IL_0479: Unknown result type (might be due to invalid IL or missing references) //IL_0481: Unknown result type (might be due to invalid IL or missing references) //IL_0486: Unknown result type (might be due to invalid IL or missing references) //IL_048e: Unknown result type (might be due to invalid IL or missing references) //IL_0496: Unknown result type (might be due to invalid IL or missing references) //IL_049b: Unknown result type (might be due to invalid IL or missing references) //IL_04bb: Unknown result type (might be due to invalid IL or missing references) //IL_05e3: Unknown result type (might be due to invalid IL or missing references) //IL_05f2: Unknown result type (might be due to invalid IL or missing references) GameObject? obj = SafeGetNativeItemPrefab(source) ?? ((PrefabRef<GameObject>)(object)source.prefab).Prefab ?? Resources.Load<GameObject>("Items/Item Staff Torque"); if ((Object)(object)obj == (Object)null) { throw new InvalidOperationException("Source staff prefab missing"); } GameObject val = Object.Instantiate<GameObject>(obj, holder, false); val.SetActive(true); ((Object)val).name = StaffRules.ItemName(kind); ItemStaffTorque component = val.GetComponent<ItemStaffTorque>(); if ((Object)(object)component == (Object)null) { throw new InvalidOperationException("Cloned template missing ItemStaffTorque"); } ParticleSystem particleSparkle = component.particleSparkle; ParticleSystem loadedParticles = component.loadedParticles; ParticleSystem denyParticles = component.denyParticles; ParticleSystem chargeUpParticles = component.chargeUpParticles; Sound denySound = component.denySound; Sound denySoundUI = component.denySoundUI; Sound chargeUpSound = component.chargeUpSound; Sound lightning01Sound = component.lightning01Sound; Sound castSound = component.castSound; Sound choir01Sound = component.choir01Sound; Sound choir02Sound = component.choir02Sound; Sound chargeUpSoundLoop = component.chargeUpSoundLoop; Sound loadedLowSoundLoop = component.loadedLowSoundLoop; Sound loadedHighSoundLoop = component.loadedHighSoundLoop; Transform projectileSpawnPoint = component.projectileSpawnPoint; Material crystalMaterial = component.crystalMaterial; Renderer crystalRenderer = component.crystalRenderer; Transform screenArrow = component.screenArrow; Object.DestroyImmediate((Object)(object)component); GameObject val2 = Object.Instantiate<GameObject>(((Component)sourceSemiLaser).gameObject, val.transform, false); ((Object)val2).name = "ClownBeamSemiLaser"; val2.transform.localPosition = (Vector3)(((Object)(object)projectileSpawnPoint != (Object)null) ? projectileSpawnPoint.localPosition : new Vector3(0f, 0.595f, 0f)); val2.transform.localRotation = Quaternion.identity; ValuableObject[] componentsInChildren = val2.GetComponentsInChildren<ValuableObject>(true); for (int i = 0; i < componentsInChildren.Length; i++) { Object.DestroyImmediate((Object)(object)componentsInChildren[i]); } ValuableWizardStaff[] componentsInChildren2 = val2.GetComponentsInChildren<ValuableWizardStaff>(true); for (int i = 0; i < componentsInChildren2.Length; i++) { Object.DestroyImmediate((Object)(object)componentsInChildren2[i]); } PhysGrabObjectCollider[] componentsInChildren3 = val2.GetComponentsInChildren<PhysGrabObjectCollider>(true); for (int i = 0; i < componentsInChildren3.Length; i++) { Object.DestroyImmediate((Object)(object)componentsInChildren3[i]); } SemiLaser component2 = val2.GetComponent<SemiLaser>(); if ((Object)(object)component2 == (Object)null) { throw new InvalidOperationException("Cloned SemiLaser object missing SemiLaser component"); } if ((Object)(object)component2.enableLaser != (Object)null) { component2.enableLaser.SetActive(false); } PropLight componentInChildren = val.GetComponentInChildren<PropLight>(true); Material crystalMaterial2 = StaffVisuals.ApplyClownBeamLook(val, crystalMaterial, crystalRenderer, componentInChildren, particleSparkle, loadedParticles, chargeUpParticles, projectileSpawnPoint, screenArrow); ClownBeamStaff clownBeamStaff = val.AddComponent<ClownBeamStaff>(); clownBeamStaff.Kind = kind; clownBeamStaff.particleSparkle = particleSparkle; clownBeamStaff.loadedParticles = loadedParticles; clownBeamStaff.denyParticles = denyParticles; clownBeamStaff.chargeUpParticles = chargeUpParticles; clownBeamStaff.denySound = denySound; clownBeamStaff.denySoundUI = denySoundUI; clownBeamStaff.chargeUpSound = chargeUpSound; clownBeamStaff.lightning01Sound = lightning01Sound; clownBeamStaff.castSound = castSound; clownBeamStaff.choir01Sound = choir01Sound; clownBeamStaff.choir02Sound = choir02Sound; clownBeamStaff.chargeUpSoundLoop = chargeUpSoundLoop; clownBeamStaff.loadedLowSoundLoop = loadedLowSoundLoop; clownBeamStaff.loadedHighSoundLoop = loadedHighSoundLoop; clownBeamStaff.projectileSpawnPoint = projectileSpawnPoint; clownBeamStaff.crystalMaterial = crystalMaterial2; clownBeamStaff.crystalRenderer = crystalRenderer; clownBeamStaff.screenArrow = screenArrow; clownBeamStaff.loadedColor = StaffVisuals.MainColor(kind); clownBeamStaff.semiLaser = component2; Item val3 = Object.Instantiate<Item>(source); ((Object)val3).name = ((Object)val).name; val3.itemName = ResolveName(kind); val3.itemNameLocalized = null; val3.description = ResolveDescription(kind); float multiplier = ((Plugin.ShopPriceMultiplier != null) ? Plugin.ShopPriceMultiplier.Value : 1.15f); int baseValue = (((Object)(object)source.value != (Object)null) ? ((int)source.value.valueMin) : 0); int baseValue2 = (((Object)(object)source.value != (Object)null) ? ((int)source.value.valueMax) : 0); val3.value = (((Object)(object)source.value != (Object)null) ? Object.Instantiate<Value>(source.value) : ScriptableObject.CreateInstance<Value>()); val3.value.valueMin = StaffRules.ScaledShopValue(baseValue, multiplier, 9500); val3.value.valueMax = StaffRules.ScaledShopValue(baseValue2, multiplier, 11500); if (val3.value.valueMax < val3.value.valueMin) { val3.value.valueMax = val3.value.valueMin; } Color val4 = StaffVisuals.MainColor(kind); val3.colorPreset = (((Object)(object)source.colorPreset != (Object)null) ? Object.Instantiate<ColorPresets>(source.colorPreset) : ScriptableObject.CreateInstance<ColorPresets>()); val3.colorPreset.colorMain = val4; val3.colorPreset.colorLight = Color.Lerp(val4, Color.white, 0.25f); val3.colorPreset.colorDark = val4 * 0.55f; val3.itemType = source.itemType; val3.itemVolume = source.itemVolume; val3.itemSecretShopType = (itemSecretShopType)0; val3.spawnRotationOffset = source.spawnRotationOffset; val3.physicalItem = true; val3.disabled = false; val3.maxPurchase = false; val3.status = (Status)1; val3.minPlayerCount = 1; val3.maxAmount = Math.Max(source.maxAmount, 3); val3.maxAmountInShop = Math.Max(source.maxAmountInShop, 1); ItemAttributes component3 = val.GetComponent<ItemAttributes>(); component3.item = val3; component3.icon = null; ApplyLocalization(component3, kind); List<Action> list = PreserveExistingStats(((Object)val3).name); PrefabRef val5; try { val5 = Items.RegisterItem(component3); } finally { foreach (Action item in list) { item(); } } if (val5 == null) { throw new InvalidOperationException("Cannot register " + ((Object)val).name); } val3.prefab = val5; Registered[kind] = val3; Templates[kind] = val; SyncPrefabPools(val3, val); Plugin.Log.LogInfo((object)$"Registered {val3.itemName} (value={val3.value.valueMin}..{val3.value.valueMax}, type={val3.itemType}, vol={val3.itemVolume}, source={LaserSourceUsed})."); } } [DefaultExecutionOrder(10000)] public sealed class StaffDirector : MonoBehaviour { private readonly Dictionary<int, StaffInstanceState> remote = new Dictionary<int, StaffInstanceState>(); private float nextCatalog; private float nextBroadcast; private float nextRequest; private float remoteUntil; private bool wasHost; private int seq; private int acceptedActor; private double acceptedTime = -1.0; private string epoch = Guid.NewGuid().ToString("N"); private string acceptedEpoch = string.Empty; public static StaffDirector? Instance { get; private set; } private void Awake() { Instance = this; Plugin.Log.LogInfo((object)"More Staffs director created."); } public void SceneChanged() { remote.Clear(); remoteUntil = 0f; epoch = Guid.NewGuid().ToString("N"); seq = 0; acceptedTime = -1.0; acceptedActor = 0; acceptedEpoch = string.Empty; nextBroadcast = 0f; nextRequest = 0f; } private void Update() { if (!StaffAssets.Ready && Time.unscaledTime >= nextCatalog) { nextCatalog = Time.unscaledTime + 0.5f; try { StaffAssets.TryRegister(); } catch (Exception ex) { Plugin.Log.LogError((object)("Staff registration failed: " + ex)); nextCatalog += 10f; } } bool host = NativeAccess.Host; if (host != wasHost) { if (host) { epoch = Guid.NewGuid().ToString("N"); seq = 0; } remote.Clear(); wasHost = host; } if (!NativeAccess.Multiplayer) { return; } if (host) { bool flag = false; for (int i = 0; i < MoreStaffBase.Active.Count; i++) { if (MoreStaffBase.Active[i] is ClownBeamStaff { IsBeamActive: not false }) { flag = true; break; } } float num = (flag ? 0.1f : 0.5f); if (Time.unscaledTime >= nextBroadcast) { nextBroadcast = Time.unscaledTime + num; BroadcastNow(); } return; } if (Time.unscaledTime > remoteUntil) { remote.Clear(); } for (int j = 0; j < MoreStaffBase.Active.Count; j++) { MoreStaffBase moreStaffBase = MoreStaffBase.Active[j]; if ((Object)(object)moreStaffBase != (Object)null && moreStaffBase.Id > 0 && remote.TryGetValue(moreStaffBase.Id, out StaffInstanceState value)) { moreStaffBase.ApplyNetworkState(value); } } if (Time.unscaledTime >= nextRequest) { nextRequest = Time.unscaledTime + 3f; StaffNetwork.RequestSnapshot(); } } public void BroadcastNow() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) if (!NativeAccess.Host || !NativeAccess.Multiplayer || MoreStaffBase.Active.Count == 0) { return; } StaffSnapshot obj = new StaffSnapshot { Epoch = epoch }; Scene activeScene = SceneManager.GetActiveScene(); obj.Scene = ((Scene)(ref activeScene)).name; obj.Sequence = ++seq; obj.Time = PhotonNetwork.Time; obj.BeamDuration = StaffRules.BeamDuration(Plugin.BeamDuration.Value); obj.BeamRange = StaffRules.BeamRange(Plugin.BeamRange.Value); StaffSnapshot staffSnapshot = obj; for (int i = 0; i < MoreStaffBase.Active.Count; i++) { MoreStaffBase moreStaffBase = MoreStaffBase.Active[i]; if ((Object)(object)moreStaffBase != (Object)null && moreStaffBase.Id > 0 && staffSnapshot.Staffs.Count < 32) { staffSnapshot.Staffs.Add(moreStaffBase.BuildNetworkState()); } } StaffNetwork.Broadcast(staffSnapshot); } public bool Receive(StaffSnapshot snapshot, int actor) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) if (StaffProtocol.Valid(snapshot, PhotonNetwork.Time)) { string scene = snapshot.Scene; Scene activeScene = SceneManager.GetActiveScene(); if (!(scene != ((Scene)(ref activeScene)).name) && (actor != acceptedActor || (!(snapshot.Time < acceptedTime) && (!(snapshot.Epoch == acceptedEpoch) || snapshot.Sequence > seq)))) { acceptedActor = actor; acceptedEpoch = snapshot.Epoch; acceptedTime = snapshot.Time; seq = snapshot.Sequence; remoteUntil = Time.unscaledTime + 2f; remote.Clear(); for (int i = 0; i < snapshot.Staffs.Count; i++) { StaffInstanceState staffInstanceState = snapshot.Staffs[i]; remote[staffInstanceState.StaffId] = staffInstanceState; } return true; } } return false; } private void OnDestroy() { SceneChanged(); if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } } } public static class StaffNetwork { private static NetworkedEvent request; private static NetworkedEvent state; public static void Initialize() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown request = new NetworkedEvent("com.matsu.repomorestaffs.sync.v1", (Action<EventData>)ReceiveRequest); state = new NetworkedEvent("com.matsu.repomorestaffs.state.v1", (Action<EventData>)ReceiveState); } public static void RequestSnapshot() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) if (NativeAccess.Multiplayer && !NativeAccess.Host) { request.RaiseEvent((object)new object[1] { "com.matsu.repomorestaffs" }, NetworkingEvents.RaiseMasterClient, SendOptions.SendReliable); } } private static void ReceiveRequest(EventData evt) { if (NativeAccess.Host && NativeAccess.Multiplayer && evt.CustomData is object[] array && array.Length == 1 && array[0] is string text && text == "com.matsu.repomorestaffs" && PhotonNetwork.CurrentRoom != null && PhotonNetwork.CurrentRoom.Players.ContainsKey(evt.Sender)) { StaffDirector.Instance?.BroadcastNow(); } } public static void Broadcast(StaffSnapshot snapshot) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) state.RaiseEvent((object)new object[2] { "com.matsu.repomorestaffs", JsonConvert.SerializeObject((object)snapshot) }, NetworkingEvents.RaiseOthers, SendOptions.SendReliable); } private static void ReceiveState(EventData evt) { if (!NativeAccess.Multiplayer || NativeAccess.Host || PhotonNetwork.MasterClient == null || evt.Sender != PhotonNetwork.MasterClient.ActorNumber || !(evt.CustomData is object[] array) || array.Length != 2 || !(array[0] is string text) || text != "com.matsu.repomorestaffs" || !(array[1] is string { Length: <=32768 } text2)) { return; } try { StaffSnapshot staffSnapshot = JsonConvert.DeserializeObject<StaffSnapshot>(text2); if (staffSnapshot != null) { StaffDirector.Instance?.Receive(staffSnapshot, evt.Sender); } } catch (JsonException) { Plugin.Log.LogWarning((object)"Rejected malformed staff snapshot."); } } } public sealed class StaffInstanceState { public int StaffId { get; set; } public StaffKind Kind { get; set; } public int State { get; set; } public bool Firing { get; set; } public float RemainingBeamTime { get; set; } public float Battery { get; set; } public float OriginX { get; set; } public float OriginY { get; set; } public float OriginZ { get; set; } public float EndX { get; set; } public float EndY { get; set; } public float EndZ { get; set; } public bool Hitting { get; set; } } public sealed class StaffSnapshot { public string Epoch { get; set; } = string.Empty; public string Scene { get; set; } = string.Empty; public int Sequence { get; set; } public double Time { get; set; } public float BeamDuration { get; set; } public float BeamRange { get; set; } public List<StaffInstanceState> Staffs { get; set; } = new List<StaffInstanceState>(); } public static class StaffProtocol { public const int MaxStaffsPerSnapshot = 32; public const float MaxReportedBeamTime = 10f; public static bool Valid(StaffSnapshot? s, double now) { if (s == null) { return false; } if (string.IsNullOrEmpty(s.Epoch) || s.Epoch.Length > 64) { return false; } if (string.IsNullOrEmpty(s.Scene) || s.Scene.Length > 128) { return false; } if (s.Sequence <= 0 || !StaffRules.SnapshotTime(s.Time, now)) { return false; } if (!StaffRules.Finite(s.BeamDuration) || s.BeamDuration < 0.5f || s.BeamDuration > 6f) { return false; } if (!StaffRules.Finite(s.BeamRange) || s.BeamRange < 5f || s.BeamRange > 30f) { return false; } if (s.Staffs == null || s.Staffs.Count > 32) { return false; } for (int i = 0; i < s.Staffs.Count; i++) { StaffInstanceState staffInstanceState = s.Staffs[i]; if (staffInstanceState == null) { return false; } if (staffInstanceState.StaffId <= 0 || !StaffRules.ValidKind((int)staffInstanceState.Kind)) { return false; } if (staffInstanceState.State < 0 || staffInstanceState.State > 6) { return false; } if (!StaffRules.Finite(staffInstanceState.RemainingBeamTime) || staffInstanceState.RemainingBeamTime < 0f || staffInstanceState.RemainingBeamTime > 10f) { return false; } if (!StaffRules.Finite(staffInstanceState.Battery) || staffInstanceState.Battery < 0f || staffInstanceState.Battery > 100f) { return false; } if (!StaffRules.Finite(staffInstanceState.OriginX) || !StaffRules.Finite(staffInstanceState.OriginY) || !StaffRules.Finite(staffInstanceState.OriginZ) || !StaffRules.Finite(staffInstanceState.EndX) || !StaffRules.Finite(staffInstanceState.EndY) || !StaffRules.Finite(staffInstanceState.EndZ)) { return false; } } return true; } } public enum StaffKind { ClownBeam } public static class StaffRules { public const string ClownBeamItemName = "Item Staff Clown Beam"; public const string ClownBeamResourcePath = "Items/Item Staff Clown Beam"; public const float ActivationPitchThreshold = -50f; public const float ChargeDuration = 0.5f; public const float CastWindupDuration = 0.5f; public const float DefaultBeamDuration = 2.2f; public const float MinBeamDuration = 0.5f; public const float MaxBeamDuration = 6f; public const float DefaultBeamRange = 15f; public const float MinBeamRange = 5f; public const float MaxBeamRange = 30f; public const float DefaultDamageScale = 1f; public const float MinDamageScale = 0.25f; public const float MaxDamageScale = 3f; public const float DefaultPriceMultiplier = 1.15f; public const float MinPriceMultiplier = 0.5f; public const float MaxPriceMultiplier = 3f; public const float HeldRecoilForce = 12f; public const float LooseRecoilForce = 420f; public const float CastPlayerImpulse