using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using FistVR;
using UnityEngine;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyCompany("nootarc")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Scripts for my H3VR mods. It's like i'm a real modder now!")]
[assembly: AssemblyFileVersion("0.2.11.0")]
[assembly: AssemblyInformationalVersion("0.2.11+5401acf084f9c466e6f5bc24d58c8035036b3a51")]
[assembly: AssemblyProduct("TerribleScripts")]
[assembly: AssemblyTitle("TerribleScripts")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.2.11.0")]
[module: UnverifiableCode]
namespace BepInEx
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class BepInAutoPluginAttribute : Attribute
{
public BepInAutoPluginAttribute(string id = null, string name = null, string version = null)
{
}
}
}
namespace BepInEx.Preloader.Core.Patching
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class PatcherAutoPluginAttribute : Attribute
{
public PatcherAutoPluginAttribute(string id = null, string name = null, string version = null)
{
}
}
}
namespace nootarc
{
[CreateAssetMenu(menuName = "Misc/CalculateBDCC", fileName = "NewBDCCurve")]
public class ScaleBDCC : ScriptableObject
{
public AnimationCurve curve;
public AnimationCurve scaledCurve;
public float Width = 1f;
public float Height = 0.1f;
[ContextMenu("Scale Curve")]
public void ScaleCurve()
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
for (int i = 0; i < curve.keys.Length; i++)
{
Keyframe val = curve.keys[i];
((Keyframe)(ref val)).value = ((Keyframe)(ref curve.keys[i])).value * Height;
((Keyframe)(ref val)).time = ((Keyframe)(ref curve.keys[i])).time * Width;
((Keyframe)(ref val)).inTangent = ((Keyframe)(ref curve.keys[i])).inTangent * Height / Width;
((Keyframe)(ref val)).outTangent = ((Keyframe)(ref curve.keys[i])).outTangent * Height / Width;
scaledCurve.AddKey(val);
}
}
}
}
namespace nootarc.HCBBoltStuff
{
public class HCBBoltify : MonoBehaviour
{
public FVRFireArm FireArm;
public FVRFireArmChamber Chamber;
private void Hook()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
GM.CurrentSceneSettings.ShotFiredEvent += new ShotFired(OnShotFired);
}
private void OnShotFired(FVRFireArm firearm)
{
//IL_004e: 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_0083: 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)
if ((Object)(object)firearm == (Object)(object)FireArm && (Object)(object)((Component)Chamber.GetRound()).GetComponent<RoundHCBBoltType>() != (Object)null)
{
FVRFireArmRound round = Chamber.GetRound();
RoundHCBBoltType component = ((Component)round).GetComponent<RoundHCBBoltType>();
GameObject roundHCBBolt = component.RoundHCBBolt;
GameObject val = Object.Instantiate<GameObject>(roundHCBBolt, firearm.CurrentMuzzle.position, firearm.CurrentMuzzle.rotation);
HCBBolt component2 = val.GetComponent<HCBBolt>();
component2.SetCookedAmount(1f);
component2.Fire(firearm.MuzzlePos.forward, firearm.MuzzlePos.position, 1f);
}
}
public void Awake()
{
Hook();
}
}
public class RoundHCBBoltType : MonoBehaviour
{
public GameObject RoundHCBBolt;
}
public class TrepangExplodeyBolt : MonoBehaviour
{
public ParticleSystem fuseParticles;
public AudioEvent fuseSound;
[HideInInspector]
public float fuseTime = 3f;
public float startFuseTime = 3f;
public List<GameObject> ExplosionSpawns;
[HideInInspector]
public int IFF;
[HideInInspector]
public float fuseTick;
public void StartExplosion()
{
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: Unknown result type (might be due to invalid IL or missing references)
fuseTime -= Time.deltaTime;
float num = Mathf.Clamp(1f - fuseTime / startFuseTime, 0f, 1f);
num = Mathf.Pow(num, 2f);
if (fuseTick <= 0f)
{
fuseTick = Mathf.Lerp(0.3f, 0.01f, num);
float num2 = Mathf.Lerp(1.8f, 3.7f, num);
SM.PlayCoreSoundOverrides((FVRPooledAudioType)0, fuseSound, ((Component)this).transform.position, new Vector2(1f, 1f), new Vector2(num2, num2));
fuseParticles.Emit(2);
}
else
{
fuseTick -= Time.deltaTime;
}
if (!(fuseTime <= 0f))
{
return;
}
foreach (GameObject explosionSpawn in ExplosionSpawns)
{
GameObject val = Object.Instantiate<GameObject>(explosionSpawn, ((Component)this).transform.position, Quaternion.identity);
Explosion component = val.GetComponent<Explosion>();
if ((Object)(object)component != (Object)null)
{
component.IFF = IFF;
}
ExplosionSound component2 = val.GetComponent<ExplosionSound>();
if ((Object)(object)component2 != (Object)null)
{
component2.IFF = IFF;
}
}
Object.Destroy((Object)(object)((Component)this).gameObject);
}
public void Update()
{
if (!Object.op_Implicit((Object)(object)((Component)this).gameObject.GetComponent<HCBBolt>()) || !((Component)this).gameObject.GetComponent<HCBBolt>().m_isFlying)
{
StartExplosion();
}
}
}
}
namespace TerribleScripts
{
[BepInProcess("h3vr.exe")]
[BepInPlugin("TerribleScripts", "TerribleScripts", "0.2.11+5401acf084f9c466e6f5bc24d58c8035036b3a51")]
public class TerribleScriptsBase : BaseUnityPlugin
{
public enum StreamlinedButton
{
AX,
BY
}
public enum TouchpadVector
{
up,
down,
left,
right
}
public const string Id = "TerribleScripts";
public static string Name => "TerribleScripts";
public static string Version => "0.2.11+5401acf084f9c466e6f5bc24d58c8035036b3a51";
}
}
namespace TerribleScripts.WeaponModifications
{
public class AlternatingMuzzle : MonoBehaviour
{
[Header("Note: Firearm should have the first muzzle in this list as the muzzle position")]
[Tooltip("Firearm with all the muzzle shenanigans")]
public FVRFireArm FireArm;
[Tooltip("Your muzzles. Top-down will dictate the order the muzzles are fired in. Note the header!")]
public List<Transform> Muzzles;
[HideInInspector]
public int Index;
[Header("Closed Bolt Moving Barrel stuff")]
[Tooltip("Reciprocating/Moving barrels to do")]
public List<Transform> Barrels;
[Tooltip("Forward Positions of the Barrels. Note the order of the list above.")]
public List<Vector3> BarrelsForward;
[Tooltip("Same as above, Rearward Positions of the Barrels.")]
public List<Vector3> BarrelsRearward;
[HideInInspector]
public bool IsClosedBolt;
[HideInInspector]
public ClosedBoltWeapon ClosedBolt;
[HideInInspector]
public bool MovingBarrelsAvailable;
public void Hook()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
GM.CurrentSceneSettings.ShotFiredEvent += new ShotFired(OnShotFired);
}
public void Awake()
{
Hook();
if (FireArm is ClosedBoltWeapon)
{
ref ClosedBoltWeapon closedBolt = ref ClosedBolt;
FVRFireArm fireArm = FireArm;
closedBolt = (ClosedBoltWeapon)(object)((fireArm is ClosedBoltWeapon) ? fireArm : null);
IsClosedBolt = true;
if (Barrels != null)
{
MovingBarrelsAvailable = true;
}
}
}
public void OnShotFired(FVRFireArm firearm)
{
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)firearm == (Object)(object)FireArm)
{
FireArm.MuzzlePos = (FireArm.CurrentMuzzle = Muzzles[Index]);
if (IsClosedBolt && MovingBarrelsAvailable)
{
ClosedBolt.Bolt.Barrel = Barrels[Index];
ClosedBolt.Bolt.BarrelForward = BarrelsForward[Index];
ClosedBolt.Bolt.BarrelRearward = BarrelsRearward[Index];
}
Index++;
if (Index >= Muzzles.Count)
{
Index = 0;
}
}
}
}
public class DuplicatedMuzzle : MonoBehaviour
{
public FVRFireArm FireArm;
public void Hook()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
GM.CurrentSceneSettings.ShotFiredEvent += new ShotFired(OnShotFired);
}
public void Awake()
{
Hook();
}
public void OnShotFired(FVRFireArm firearm)
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: 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_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_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_00d7: 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_00e6: 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_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
//IL_0127: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_0140: 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)
//IL_0155: 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_0165: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
//IL_0178: Unknown result type (might be due to invalid IL or missing references)
//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)firearm == (Object)(object)FireArm))
{
return;
}
float chamberVelMult = AM.GetChamberVelMult(firearm.FChambers[0].RoundType, Vector3.Distance(((Component)firearm.FChambers[0]).transform.position, firearm.CurrentMuzzle.position));
float num = firearm.GetCombinedFixedDrop(firearm.AccuracyClass) * 0.0166667f;
Vector2 val = firearm.GetCombinedFixedDrift(firearm.AccuracyClass) * 0.0166667f;
for (int i = 0; i < firearm.FChambers[0].GetRound().NumProjectiles; i++)
{
float num2 = firearm.FChambers[0].GetRound().ProjectileSpread + firearm.m_internalMechanicalMOA + firearm.GetCombinedMuzzleDeviceAccuracy();
if ((Object)(object)firearm.FChambers[0].GetRound().BallisticProjectilePrefab != (Object)null)
{
Vector3 val2 = ((Component)this).transform.forward * 0.005f;
GameObject val3 = Object.Instantiate<GameObject>(firearm.FChambers[0].GetRound().BallisticProjectilePrefab, ((Component)this).transform.position - val2, ((Component)this).transform.rotation);
Vector2 val4 = (Random.insideUnitCircle + Random.insideUnitCircle + Random.insideUnitCircle) * (1f / 3f) * num2;
val3.transform.Rotate(new Vector3(val4.x + val.y + num, val4.y + val.x, 0f));
BallisticProjectile component = val3.GetComponent<BallisticProjectile>();
component.Fire(component.MuzzleVelocityBase * firearm.FChambers[0].ChamberVelocityMultiplier * 1f * chamberVelMult, val3.transform.forward, firearm, true);
}
}
}
}
public class EjectMagOnEmpty : MonoBehaviour
{
[Tooltip("Firearm :)")]
public FVRFireArm FireArm;
[HideInInspector]
public float CurrentAmount;
[HideInInspector]
public int LoadedChambers;
[HideInInspector]
public bool MagIn;
private void Update()
{
for (int i = 0; i < FireArm.FChambers.Count; i++)
{
if (FireArm.FChambers[i].IsFull)
{
LoadedChambers++;
}
}
if ((Object)(object)FireArm.Magazine != (Object)null)
{
CurrentAmount = FireArm.Magazine.m_numRounds + LoadedChambers;
MagIn = true;
}
if (MagIn && CurrentAmount <= 0f)
{
FireArm.EjectMag(false);
}
LoadedChambers = 0;
}
}
public class FakeMinigunSounds : MonoBehaviour
{
}
public class ReplenishFirearmMagazineAutomagically : MonoBehaviour
{
[Header("NOTE: This script is used with firearms, not magazines!")]
[Tooltip("The round class that should be replenished by default if the gun spawns empty")]
public FireArmRoundClass FallbackRoundClass = (FireArmRoundClass)1;
public FVRFireArm firearm;
[Tooltip("Makes the magazine only replenish when the firearm is being held and the AX button is being pressed. If false, firearm replenishes when *not* held, and stops when held. ")]
public bool HoldToReplenish;
[Tooltip("*Only functions when HoldToReplenish is false* Clicking the AX button toggles the replenish-when-not-held feature on and off.")]
public bool ToggleToReplenish;
[Tooltip("Should the trigger make the firearm stop replenishing")]
public bool TriggerBlocksReplenish;
[Header("Delays")]
[Tooltip("Delay in seconds between loading rounds at the fastest")]
public float minReplenishRate = 0.066f;
[Tooltip("Delay in seconds between loading rounds at the slowest")]
public float maxReplenishRate = 5f;
[Tooltip("Smaller the number, the longer the delay, and vice versa. 0 to bypass lerp and replenish at max, 1 to replenish at min")]
public float lerpFactor = 0.5f;
[Header("Audio")]
[Tooltip("Makes the mag insert round sound every time a round is replenished")]
public bool IndividualRoundSound;
[Tooltip("OPTIONAL: audio source w/ clip that will play when the gun is replenishing, e.g. if you want to have a quiet loop instead of CLICK CLICK CLICK CLICK CLICK")]
public AudioSource replenishAudioSource;
[HideInInspector]
public bool isReplenishing;
[HideInInspector]
public float replenishTimer;
[HideInInspector]
public FireArmRoundClass RoundClass;
[HideInInspector]
public FVRViveHand hand;
public void Awake()
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
RoundClass = FallbackRoundClass;
}
public void Update()
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)firearm.FChambers[0].GetRound() != (Object)null && RoundClass != firearm.FChambers[0].GetRound().RoundClass)
{
RoundClass = firearm.FChambers[0].GetRound().RoundClass;
}
if (isReplenishing && replenishTimer > 0f)
{
replenishTimer -= Time.deltaTime;
}
else if (isReplenishing && replenishTimer <= 0f)
{
firearm.Magazine.AddRound(RoundClass, IndividualRoundSound, false);
replenishTimer = Mathf.Lerp(replenishTimer, minReplenishRate, lerpFactor);
}
if ((Object)(object)replenishAudioSource != (Object)null)
{
if (isReplenishing && !replenishAudioSource.isPlaying)
{
replenishAudioSource.Play();
}
else
{
replenishAudioSource.Stop();
}
}
if (HoldToReplenish)
{
isReplenishing = false;
}
if ((Object)(object)((FVRInteractiveObject)firearm).m_hand == (Object)null && (HoldToReplenish || ToggleToReplenish))
{
return;
}
if (HoldToReplenish)
{
hand = ((FVRInteractiveObject)firearm).m_hand;
if ((TriggerBlocksReplenish && (double)hand.Input.TriggerFloat < 0.1) || !TriggerBlocksReplenish)
{
if (hand.Input.AXButtonDown)
{
isReplenishing = true;
}
else if (hand.Input.AXButtonUp)
{
isReplenishing = false;
}
}
else
{
isReplenishing = false;
}
}
else if (ToggleToReplenish)
{
hand = ((FVRInteractiveObject)firearm).m_hand;
if (hand.Input.AXButtonDown)
{
isReplenishing = !isReplenishing;
}
}
else
{
isReplenishing = !((FVRInteractiveObject)firearm).IsHeld;
}
}
}
public class SparksAndHeat : MonoBehaviour
{
[Header("99.5% chance you don't need this script. If you hit the 0.5%, I'm so sorry. At least you can just pick one effect")]
[Tooltip("Firearm with all the effects")]
public FVRFireArm FireArm;
[Tooltip("Round Class that will enable all the effects")]
public FireArmRoundClass RoundClass;
[Tooltip("Particle System that will enable and disable on Round Class loaded")]
public ParticleSystem Particles;
[Tooltip("Audio Source that will play and stop")]
public AudioSource Audio;
[Tooltip("Mesh to modify the Emissions Weight of (Kinda like Object Temperature without the Object Temperature)")]
public MeshRenderer Mesh;
[Tooltip("Emissions Weight when the Round Class is Loaded")]
public float LoadedWeight = 1f;
[Tooltip("Vice versa as above")]
public float UnloadedWeight;
[Tooltip("Spinny Bit")]
public GameObject Spinny;
public float RotPerFrame;
[HideInInspector]
public float RotZ;
[HideInInspector]
public int EmissionWeight;
[HideInInspector]
public bool JustPlayed;
[HideInInspector]
public bool MeshAvailable;
[HideInInspector]
public bool AudioAvailable;
[HideInInspector]
public bool ParticlesAvailable;
[HideInInspector]
public bool SpinnyAvailable;
public void Awake()
{
EmissionWeight = Shader.PropertyToID("_EmissionWeight");
if ((Object)(object)Mesh != (Object)null)
{
MeshAvailable = true;
}
if ((Object)(object)Audio != (Object)null)
{
AudioAvailable = true;
}
if ((Object)(object)Particles != (Object)null)
{
ParticlesAvailable = true;
}
if ((Object)(object)Spinny != (Object)null)
{
SpinnyAvailable = true;
}
}
public void Update()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: 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)
MaterialPropertyBlock val = new MaterialPropertyBlock();
if ((Object)(object)FireArm.Magazine != (Object)null && FireArm.Magazine.LoadedRounds[0] != null && FireArm.Magazine.LoadedRounds[0].LR_Class == RoundClass)
{
if (SpinnyAvailable)
{
Spinny.transform.Rotate(0f, 0f, RotPerFrame);
}
if (!JustPlayed)
{
val.SetFloat(EmissionWeight, LoadedWeight);
if (MeshAvailable)
{
((Renderer)Mesh).SetPropertyBlock(val);
}
if (ParticlesAvailable)
{
Particles.Play();
}
if (AudioAvailable)
{
Audio.Play();
}
JustPlayed = true;
}
}
else if (((Object)(object)FireArm.Magazine == (Object)null || FireArm.Magazine.m_numRounds == 0 || FireArm.Magazine.LoadedRounds[0].LR_Class != RoundClass || (Object)(object)((FVRInteractiveObject)FireArm).m_hand == (Object)null) && JustPlayed)
{
val.SetFloat(EmissionWeight, UnloadedWeight);
if (MeshAvailable)
{
((Renderer)Mesh).SetPropertyBlock(val);
}
if (ParticlesAvailable)
{
Particles.Stop();
}
if (AudioAvailable)
{
Audio.Stop();
}
JustPlayed = false;
}
}
}
public class ToggleOnGrabRelease : MonoBehaviour
{
[Tooltip("Object that you pick up/release")]
public FVRPhysicalObject Parent;
[Tooltip("When true, enables objects when parent is held and disables them when not held; Reverse when false")]
public bool Enable;
[Tooltip("Objects to toggle")]
public List<GameObject> Objects;
[HideInInspector]
public bool Held;
public void Hook()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
GM.CurrentSceneSettings.ObjectPickedUpEvent += new FVRObjectPickedUp(ObjectPickedUp);
}
public void Awake()
{
Hook();
}
public void ObjectPickedUp(FVRPhysicalObject ParentObject)
{
if ((Object)(object)ParentObject == (Object)(object)Parent)
{
for (int i = 0; i < Objects.Count; i++)
{
Objects[i].SetActive(Enable);
Held = true;
}
}
}
private void Update()
{
if (Held && !((FVRInteractiveObject)Parent).m_isHeld)
{
for (int i = 0; i < Objects.Count; i++)
{
Objects[i].SetActive(!Enable);
}
Held = false;
}
}
}
}
namespace TerribleScripts.ModMods
{
public class AmmoCountUIColorShenanigans : MonoBehaviour
{
[Header("Note: There should be one gradient per object with them having")]
[Header("the same positions (topmost object will use the topmost gradient, for example)")]
[Tooltip("Graphics to recolor")]
public List<Graphic> Graphics;
[Tooltip("Lasers & Lights to recolor (Uses gradients that come immediately after the graphics ones)")]
public List<LaserLight> LaserLights;
[Tooltip("Line Renderers to recolor the Emissions tint of (uses gradients that come immediately after the Laser Light ones")]
public List<LineRenderer> Lines;
[Tooltip("Gradients to recolor the graphics with; key position is the fullness factor (e.g 0.2f is 20% capacity remaining)")]
public List<Gradient> Gradients;
[Tooltip("Firearm :)")]
public FVRFireArm FireArm;
[Tooltip("Does your firearm have/uses magazines or is it direct chamber-loaded?")]
public bool UsesMags;
[HideInInspector]
public int MaxCap;
[HideInInspector]
public float CurrentAmount;
[HideInInspector]
public int LoadedChambers;
[HideInInspector]
public float CurrentPercentage;
[HideInInspector]
public Color UIColor;
[HideInInspector]
public bool LaserLightsAvailable;
[HideInInspector]
public bool LinesAvailable;
[HideInInspector]
public bool GraphicsAvailable;
[HideInInspector]
public int EmissionColor;
public void Awake()
{
if (LaserLights.Count > 0)
{
LaserLightsAvailable = true;
}
if (Lines.Count > 0)
{
LinesAvailable = true;
}
if (Graphics.Count > 0)
{
GraphicsAvailable = true;
}
EmissionColor = Shader.PropertyToID("_EmissionColor");
}
public void Update()
{
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_0173: Unknown result type (might be due to invalid IL or missing references)
//IL_0178: Unknown result type (might be due to invalid IL or missing references)
//IL_018b: Unknown result type (might be due to invalid IL or missing references)
//IL_0190: Unknown result type (might be due to invalid IL or missing references)
//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
//IL_01d0: Expected O, but got Unknown
//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
for (int i = 0; i < FireArm.FChambers.Count; i++)
{
if (FireArm.FChambers[i].IsFull)
{
LoadedChambers++;
}
}
if ((Object)(object)FireArm.Magazine != (Object)null)
{
MaxCap = FireArm.Magazine.m_capacity;
CurrentAmount = FireArm.Magazine.m_numRounds;
}
else
{
MaxCap = ((!UsesMags) ? 1 : FireArm.FChambers.Count);
CurrentAmount = LoadedChambers;
}
float num = CurrentAmount / (float)MaxCap;
CurrentPercentage = Mathf.Clamp01(num);
int num2 = 0;
if (GraphicsAvailable)
{
int num3 = 0;
while (num3 < Graphics.Count)
{
UIColor = Gradients[num2].Evaluate(CurrentPercentage);
Graphics[num3].color = UIColor;
num3++;
num2++;
}
}
if (LaserLightsAvailable)
{
int num4 = 0;
while (num4 < LaserLights.Count)
{
UIColor = Gradients[num2].Evaluate(CurrentPercentage);
LaserLights[num4].color = UIColor;
num4++;
num2++;
}
}
if (LinesAvailable)
{
int num5 = 0;
while (num5 < Lines.Count)
{
MaterialPropertyBlock val = new MaterialPropertyBlock();
UIColor = Gradients[num2].Evaluate(CurrentPercentage);
val.SetColor(EmissionColor, UIColor);
((Renderer)Lines[num5]).SetPropertyBlock(val);
num5++;
num2++;
}
}
LoadedChambers = 0;
}
}
}
namespace TerribleScripts.Animations
{
public class AnimPlayOnButtonPress : MonoBehaviour
{
[Tooltip("Put your animations in a sequential list; they will play on every press and loop back around to first position")]
public List<string> Animations;
[Tooltip("Animation controller thingy on your object")]
public Animation Animation;
[Tooltip("Object you're pressing the buttons on")]
public FVRInteractiveObject Object;
[Tooltip("Whether the animation should reset on every button press. Leave true if using with fire selectors/other things")]
public bool Reset = true;
[Tooltip("Should the animation play a FireSelector sound when it starts?")]
public bool PlaySound;
[Tooltip("Which streamlined button should the animation play on?")]
public TerribleScriptsBase.StreamlinedButton EnumButton = TerribleScriptsBase.StreamlinedButton.AX;
[Tooltip("Which classic touchpad side should the animation play on?")]
public TerribleScriptsBase.TouchpadVector EnumVector = TerribleScriptsBase.TouchpadVector.left;
private int i;
private FVRFireArm Firearm;
private bool Button;
private Vector2 Vector;
public void Awake()
{
//IL_0048: 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_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
if (Object is FVRFireArm)
{
ref FVRFireArm firearm = ref Firearm;
FVRInteractiveObject @object = Object;
firearm = (FVRFireArm)(object)((@object is FVRFireArm) ? @object : null);
}
switch (EnumVector)
{
case TerribleScriptsBase.TouchpadVector.up:
Vector = Vector2.up;
break;
case TerribleScriptsBase.TouchpadVector.down:
Vector = Vector2.down;
break;
case TerribleScriptsBase.TouchpadVector.left:
Vector = Vector2.left;
break;
case TerribleScriptsBase.TouchpadVector.right:
Vector = Vector2.right;
break;
}
}
public void PlayAnimation()
{
for (int i = 0; i < Animations.Count; i++)
{
if (!Reset && Animation.IsPlaying(Animations[i]))
{
return;
}
}
Animation.Play(Animations[this.i]);
this.i++;
if (PlaySound && Object is FVRFireArm)
{
Firearm.PlayAudioEvent((FirearmAudioEventType)15, 1f);
}
if (this.i >= Animations.Count)
{
this.i = 0;
}
}
public void Update()
{
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)Object.m_hand != (Object)null))
{
return;
}
if (!Object.m_hand.IsInStreamlinedMode)
{
if (Object.m_hand.Input.TouchpadDown && ((Vector2)(ref Object.m_hand.Input.TouchpadAxes)).magnitude > 0.1f && Vector2.Angle(Object.m_hand.Input.TouchpadAxes, Vector) <= 45f)
{
PlayAnimation();
}
return;
}
Button = ((EnumButton == TerribleScriptsBase.StreamlinedButton.AX) ? Object.m_hand.Input.AXButtonDown : Object.m_hand.Input.BYButtonDown);
if (Button)
{
PlayAnimation();
}
}
}
public class AnimPlayOnFire : MonoBehaviour
{
[Header("NOTE: i forgot the note that i was supposed to put here")]
[Tooltip("Firearm to apply animations to")]
public FVRFireArm Firearm;
[Tooltip("Animation script thing with all the animations (should be applied to the object)")]
public Animation Animation;
[Tooltip("Animation to play on shot fired")]
public string FireAnim;
[Tooltip("True: Animation should reset on another shot during the already-playing animation runtime. Continues to play on false")]
public bool Reset;
public void Hook()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
GM.CurrentSceneSettings.ShotFiredEvent += new ShotFired(OnShotFired);
}
public void Awake()
{
Hook();
}
public void OnShotFired(FVRFireArm firearm)
{
if ((Object)(object)firearm == (Object)(object)Firearm && (Reset || !Animation.IsPlaying(FireAnim)))
{
Animation.Play(FireAnim);
}
}
}
public class AnimPlayOnMagInsertEject : MonoBehaviour
{
[Tooltip("yo ur firearm rr")]
public FVRFireArm Firearm;
[Tooltip(" the animation thing controller thing that go into the. firearm")]
public Animation Animation;
[Tooltip("Animation that plays when the magazine is inserted.")]
public string InsertAnim;
[Tooltip("animnaitnon that plays twhen the mag is eject ted")]
public string EjectAnim;
private bool MagIn;
public void Update()
{
if (!MagIn && (Object)(object)Firearm.Magazine != (Object)null)
{
MagIn = true;
Animation.Play(InsertAnim);
}
else if (MagIn && (Object)(object)Firearm.Magazine == (Object)null)
{
MagIn = false;
Animation.Play(EjectAnim);
}
}
}
}