using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text;
using Il2Cpp;
using Il2CppActiveRagdoll;
using Il2CppDinoFracture;
using Il2CppHurricaneVR.Framework.Core;
using Il2CppHurricaneVR.Framework.Core.Grabbers;
using Il2CppHurricaneVR.Framework.Shared;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using MakimaBang;
using MelonLoader;
using MelonLoader.Preferences;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(Core), "MakimaBang", "0.2.0", "coope", null)]
[assembly: MelonGame("Kubunautilus", "BrutalistickVR")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("MakimaBang")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MakimaBang")]
[assembly: AssemblyTitle("MakimaBang")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace MakimaBang
{
public class Core : MelonMod
{
private sealed class Cleanup
{
public Vector3 pos;
public float at;
}
private const string LogPath = "D:\\BrutalistickVrWork\\Probe\\makima_bang.log";
private const float CleanRadius = 1.4f;
private HandPosingManager _poser;
private HandPoseInfo _savedLeft;
private HandPoseInfo _savedRight;
private HandPoseInfo _gunLeft;
private HandPoseInfo _gunRight;
private bool _leftGesture;
private bool _rightGesture;
private bool _wasGripLeft;
private bool _wasGripRight;
private bool _wasBLeft;
private bool _wasBRight;
private bool _soundReady;
private HVRHandGrabber[] _hands;
private float _poseTimer;
private float _lastShot;
private GameObject _flash;
private Material _flashMat;
private static MelonPreferences_Category _prefs;
private static MelonPreferences_Entry<float> _cone;
private static MelonPreferences_Entry<float> _range;
private static MelonPreferences_Entry<float> _impactVolume;
private static MelonPreferences_Entry<float> _cooldown;
private static MelonPreferences_Entry<float> _push;
private static MelonPreferences_Entry<int> _targets;
private static MelonPreferences_Entry<int> _parts;
private static MelonPreferences_Entry<bool> _keepHead;
private static MelonPreferences_Entry<bool> _impact;
private readonly List<Cleanup> _cleanups = new List<Cleanup>();
public override void OnInitializeMelon()
{
_prefs = MelonPreferences.CreateCategory("MakimaBang");
_cone = _prefs.CreateEntry<float>("ConeAngle", 40f, "Cone angle", "Aiming cone in degrees", false, false, (ValueValidator)null, (string)null);
_range = _prefs.CreateEntry<float>("Range", 16f, "Range", "Max target distance in meters", false, false, (ValueValidator)null, (string)null);
_targets = _prefs.CreateEntry<int>("Targets", 1, "Targets per B", "How many enemies one B can erase", false, false, (ValueValidator)null, (string)null);
_parts = _prefs.CreateEntry<int>("TornParts", 2, "Torn parts", "0 = no flying limbs, 1+ = fracture parts", false, false, (ValueValidator)null, (string)null);
_keepHead = _prefs.CreateEntry<bool>("KeepHead", true, "Keep head", "Never tear head, jaw or neck", false, false, (ValueValidator)null, (string)null);
_impact = _prefs.CreateEntry<bool>("Impact", true, "Impact effect", "Shockwave flash on hit", false, false, (ValueValidator)null, (string)null);
_impactVolume = _prefs.CreateEntry<float>("Volume", 1f, "Sound volume", "impact.wav volume", false, false, (ValueValidator)null, (string)null);
_cooldown = _prefs.CreateEntry<float>("Cooldown", 0.2f, "Cooldown", "Seconds between shots", false, false, (ValueValidator)null, (string)null);
_push = _prefs.CreateEntry<float>("PushBack", 2f, "Push back", "Backward push speed in m/s, 0 = off", false, false, (ValueValidator)null, (string)null);
_prefs.SaveToFile(false);
Write("init " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
string text = Path.Combine(Application.dataPath, "..", "Mods", "MakimaBang");
Directory.CreateDirectory(text);
string text2 = Path.Combine(text, "impact.wav");
_soundReady = File.Exists(text2) && Mci.Open("makima_bang", text2, _impactVolume.Value);
Write("sound=" + _soundReady + " path=" + text2 + " err=" + Mci.LastError);
}
public override void OnSceneWasLoaded(int buildIndex, string sceneName)
{
_hands = null;
}
public override void OnApplicationQuit()
{
Mci.Close("makima_bang");
}
public override void OnUpdate()
{
//IL_0039: 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_008f: Unknown result type (might be due to invalid IL or missing references)
float realtimeSinceStartup = Time.realtimeSinceStartup;
for (int num = _cleanups.Count - 1; num >= 0; num--)
{
if (!(realtimeSinceStartup < _cleanups[num].at))
{
CleanArea(_cleanups[num].pos);
_cleanups.RemoveAt(num);
}
}
HVRHexaBodyInputs hexaInputs = PlayerStaticReferences.hexaInputs;
if ((Object)(object)hexaInputs == (Object)null)
{
return;
}
HVRController leftController = hexaInputs.LeftController;
HVRController rightController = hexaInputs.RightController;
bool flag = false;
bool flag2 = false;
bool flag3 = false;
bool flag4 = false;
try
{
flag = (Object)(object)leftController != (Object)null && leftController.GripButtonState.Active;
}
catch
{
}
try
{
flag2 = (Object)(object)rightController != (Object)null && rightController.GripButtonState.Active;
}
catch
{
}
try
{
flag3 = (Object)(object)leftController != (Object)null && BDown(leftController);
}
catch
{
}
try
{
flag4 = (Object)(object)rightController != (Object)null && BDown(rightController);
}
catch
{
}
if ((Object)(object)_poser == (Object)null)
{
try
{
_poser = Object.FindObjectOfType<HandPosingManager>();
}
catch
{
}
}
if (flag && !_wasGripLeft)
{
StartGesture(left: true);
}
if (!flag && _wasGripLeft)
{
StopGesture(left: true);
}
if (flag2 && !_wasGripRight)
{
StartGesture(left: false);
}
if (!flag2 && _wasGripRight)
{
StopGesture(left: false);
}
if ((_leftGesture || _rightGesture) && (Object)(object)_poser != (Object)null)
{
_poseTimer -= Time.unscaledDeltaTime;
if (_poseTimer <= 0f)
{
_poseTimer = 0.05f;
try
{
if (_leftGesture)
{
_poser.SetHandPose(_gunLeft, true);
}
if (_rightGesture)
{
_poser.SetHandPose(_gunRight, false);
}
}
catch (Exception ex)
{
Write("pose failed " + ex.Message);
}
}
}
bool flag5 = !HandsBusy();
bool flag6 = flag3 && flag && !_wasBLeft && flag5;
bool flag7 = flag4 && flag2 && !_wasBRight && flag5;
if (flag6 || flag7)
{
Shoot(flag6 ? leftController : rightController);
}
_wasGripLeft = flag;
_wasGripRight = flag2;
_wasBLeft = flag3;
_wasBRight = flag4;
}
private static bool BDown(HVRController c)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Invalid comparison between Unknown and I4
//IL_000a: 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_002e: Unknown result type (might be due to invalid IL or missing references)
try
{
if ((int)c.ControllerType == 3)
{
return c.TrackpadButtonState.Active || c.MenuButtonState.Active;
}
}
catch
{
}
try
{
return c.SecondaryButtonState.Active;
}
catch
{
return false;
}
}
private bool HandsBusy()
{
if (_hands == null)
{
try
{
_hands = Il2CppArrayBase<HVRHandGrabber>.op_Implicit(Object.FindObjectsOfType<HVRHandGrabber>());
}
catch
{
return false;
}
}
if (_hands == null)
{
return false;
}
for (int i = 0; i < _hands.Length; i++)
{
HVRHandGrabber val = _hands[i];
if ((Object)(object)val == (Object)null)
{
continue;
}
try
{
HVRGrabbable heldObject = ((HVRGrabberBase)val).HeldObject;
if ((Object)(object)heldObject != (Object)null && heldObject.IsBeingHeld && ((Component)heldObject).gameObject.activeInHierarchy)
{
return true;
}
}
catch
{
}
try
{
HVRGrabbable grabbedTarget = ((HVRGrabberBase)val).GrabbedTarget;
if ((Object)(object)grabbedTarget != (Object)null && grabbedTarget.IsBeingHeld && ((Component)grabbedTarget).gameObject.activeInHierarchy)
{
return true;
}
}
catch
{
}
}
return false;
}
private void StartGesture(bool left)
{
_poseTimer = 0f;
if (left)
{
_leftGesture = true;
}
else
{
_rightGesture = true;
}
if ((Object)(object)_poser == (Object)null)
{
return;
}
if (left)
{
try
{
_savedLeft = _poser.GetHandPoseInfo(true);
}
catch
{
}
_gunLeft = BuildGun(left: true);
}
else
{
try
{
_savedRight = _poser.GetHandPoseInfo(false);
}
catch
{
}
_gunRight = BuildGun(left: false);
}
Write("gesture on " + (left ? "left" : "right"));
}
private void StopGesture(bool left)
{
if (left)
{
_leftGesture = false;
}
else
{
_rightGesture = false;
}
if ((Object)(object)_poser != (Object)null)
{
if (left)
{
try
{
if (_savedLeft != null)
{
_poser.SetHandPose(_savedLeft, true);
}
}
catch
{
}
}
else
{
try
{
if (_savedRight != null)
{
_poser.SetHandPose(_savedRight, false);
}
}
catch
{
}
}
}
Write("gesture off " + (left ? "left" : "right"));
}
private void Shoot(HVRController c)
{
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0376: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: 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_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_03a8: Unknown result type (might be due to invalid IL or missing references)
//IL_03aa: Unknown result type (might be due to invalid IL or missing references)
//IL_03cd: Unknown result type (might be due to invalid IL or missing references)
//IL_03cf: Unknown result type (might be due to invalid IL or missing references)
//IL_0390: Unknown result type (might be due to invalid IL or missing references)
//IL_03f3: Unknown result type (might be due to invalid IL or missing references)
//IL_03f5: 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)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
//IL_0311: Unknown result type (might be due to invalid IL or missing references)
float realtimeSinceStartup = Time.realtimeSinceStartup;
if (realtimeSinceStartup - _lastShot < _cooldown.Value)
{
return;
}
_lastShot = realtimeSinceStartup;
Vector3 position;
Vector3 forward;
try
{
position = ((Component)c).transform.position;
forward = ((Component)c).transform.forward;
}
catch
{
Camera main = Camera.main;
if ((Object)(object)main == (Object)null)
{
return;
}
position = ((Component)main).transform.position;
forward = ((Component)main).transform.forward;
}
int limit = Mathf.Clamp(_targets.Value, 1, 6);
List<StickHealth> list = FindTargets(position, forward, limit);
if (list.Count == 0)
{
Camera main2 = Camera.main;
if ((Object)(object)main2 != (Object)null)
{
list = FindTargets(((Component)main2).transform.position, ((Component)main2).transform.forward, limit);
}
}
for (int i = 0; i < list.Count; i++)
{
StickHealth val = list[i];
if ((Object)(object)val == (Object)null)
{
continue;
}
int num = Mathf.Clamp(_parts.Value, 0, 10);
int num2 = 0;
HashSet<Rigidbody> hashSet = new HashSet<Rigidbody>();
List<Transform> list2 = new List<Transform>();
if (num > 0)
{
Il2CppArrayBase<SliceOnInputCustom> componentsInChildren = ((Component)val).GetComponentsInChildren<SliceOnInputCustom>(true);
List<SliceOnInputCustom> list3 = new List<SliceOnInputCustom>();
if (componentsInChildren != null)
{
for (int j = 0; j < componentsInChildren.Length; j++)
{
SliceOnInputCustom val2 = componentsInChildren[j];
if (!((Object)(object)val2 == (Object)null) && (!_keepHead.Value || !IsHead(((Object)((Component)val2).gameObject).name)))
{
list3.Add(val2);
}
}
}
list3.Sort((SliceOnInputCustom a, SliceOnInputCustom b) => BodyScore(((Object)((Component)a).gameObject).name).CompareTo(BodyScore(((Object)((Component)b).gameObject).name)));
for (int num3 = 0; num3 < list3.Count; num3++)
{
if (num2 >= num)
{
break;
}
SliceOnInputCustom val3 = list3[num3];
try
{
Il2CppArrayBase<Rigidbody> componentsInChildren2 = ((Component)val3).GetComponentsInChildren<Rigidbody>(true);
if (componentsInChildren2 != null)
{
for (int num4 = 0; num4 < componentsInChildren2.Length; num4++)
{
if ((Object)(object)componentsInChildren2[num4] != (Object)null)
{
hashSet.Add(componentsInChildren2[num4]);
}
}
}
TransferJointsOnFractureCustom componentInParent = ((Component)val3).GetComponentInParent<TransferJointsOnFractureCustom>();
if ((Object)(object)componentInParent != (Object)null)
{
componentInParent.DistanceTolerance = 0f;
}
Transform val4 = (((Object)(object)((Component)val3).transform.parent != (Object)null && (Object)(object)((Component)val3).transform.parent.parent != (Object)null) ? ((Component)val3).transform.parent.parent : ((Component)val3).transform);
if ((Object)(object)val4 != (Object)null && !list2.Contains(val4))
{
list2.Add(val4);
}
val3.ForceFracture();
num2++;
}
catch (Exception ex)
{
Write("fracture failed " + ex.Message);
}
}
}
Vector3 val5 = (((Object)(object)val.upperChest != (Object)null) ? val.upperChest.transform.position : ((Component)val).transform.position);
try
{
float stickStartHealth = val.StickStartHealth;
float num5 = Mathf.Max(220f, stickStartHealth * 1.5f);
val.HitByBullet(val5, num5, false);
val.ReceivedGeneralDamage(num5 * 0.5f, (DamageType)4, "torso", (ColliderBridge)null);
Write("killed " + ((Object)((Component)val).gameObject).name + " parts=" + num2);
}
catch (Exception ex2)
{
Write("damage failed " + ex2.Message);
}
MelonCoroutines.Start(PushDelayed(val, forward, hashSet));
if (list2.Count > 0)
{
MelonCoroutines.Start(PushChunks(list2, forward));
}
_cleanups.Add(new Cleanup
{
pos = val5,
at = realtimeSinceStartup + 0.25f
});
_cleanups.Add(new Cleanup
{
pos = val5,
at = realtimeSinceStartup + 0.9f
});
if (_impact.Value)
{
Impact(val5, position);
}
}
if (list.Count == 0)
{
Write("bang miss");
}
if (_soundReady && Mci.Play("makima_bang"))
{
Write("sound play");
}
else if (_soundReady)
{
Write("sound play failed " + Mci.LastError);
}
}
private static IEnumerator PushDelayed(StickHealth enemy, Vector3 dir, HashSet<Rigidbody> broken)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
yield return (object)new WaitForSeconds(0.12f);
PushEnemy(enemy, dir, broken);
}
private static void PushEnemy(StickHealth enemy, Vector3 dir, HashSet<Rigidbody> broken)
{
//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_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
float num = Mathf.Clamp(_push.Value, 0f, 12f);
if (num <= 0f)
{
return;
}
try
{
Il2CppArrayBase<Rigidbody> componentsInChildren = ((Component)enemy).GetComponentsInChildren<Rigidbody>(true);
if (componentsInChildren == null)
{
return;
}
Vector3 val = ((Vector3)(ref dir)).normalized * num;
val.y += num * 0.12f;
int num2 = 0;
for (int i = 0; i < componentsInChildren.Length; i++)
{
Rigidbody val2 = componentsInChildren[i];
if (!((Object)(object)val2 == (Object)null) && !val2.isKinematic)
{
float num3 = ((broken != null && broken.Contains(val2)) ? 1f : 0.4f);
val2.AddForce(val * num3, (ForceMode)2);
num2++;
}
}
Write("push rbs=" + componentsInChildren.Length + " applied=" + num2);
}
catch (Exception ex)
{
Write("push failed " + ex.Message);
}
}
private static IEnumerator PushChunks(List<Transform> roots, Vector3 dir)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
yield return null;
float num = Mathf.Clamp(_push.Value, 0f, 10f);
if (num <= 0f)
{
yield break;
}
Vector3 val = ((Vector3)(ref dir)).normalized * num;
val.y += num * 0.12f;
for (int i = 0; i < roots.Count; i++)
{
Transform val2 = roots[i];
if ((Object)(object)val2 == (Object)null)
{
continue;
}
Transform val3 = val2.Find("Chunks");
if ((Object)(object)val3 == (Object)null)
{
continue;
}
Il2CppArrayBase<Rigidbody> componentsInChildren = ((Component)val3).GetComponentsInChildren<Rigidbody>(true);
if (componentsInChildren == null)
{
continue;
}
for (int j = 0; j < componentsInChildren.Length; j++)
{
Rigidbody val4 = componentsInChildren[j];
if (!((Object)(object)val4 == (Object)null) && !val4.isKinematic)
{
val4.AddForce(val, (ForceMode)2);
}
}
}
}
private void Impact(Vector3 point, Vector3 origin)
{
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: 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_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
ScreenFlicker();
try
{
Shader val = Shader.Find("Sprites/Default");
if ((Object)(object)val == (Object)null)
{
val = Shader.Find("Universal Render Pipeline/Unlit");
}
if (!((Object)(object)val == (Object)null))
{
for (int i = 0; i < 12; i++)
{
GameObject obj = MakeSphere(val, new Color(0.3f, 0.01f, 0.01f, 0.85f));
obj.transform.position = point + Random.insideUnitSphere * 0.12f;
obj.transform.localScale = new Vector3(0.012f, Random.Range(0.08f, 0.24f), 0.012f);
obj.transform.rotation = Random.rotation;
MelonCoroutines.Start(Fade(obj, 0.75f));
}
}
}
catch (Exception ex)
{
Write("impact failed " + ex.Message);
}
}
private void ScreenFlicker()
{
//IL_007b: 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_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Expected O, but got Unknown
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_0139: Unknown result type (might be due to invalid IL or missing references)
try
{
Camera main = Camera.main;
if ((Object)(object)main == (Object)null)
{
return;
}
if ((Object)(object)_flash == (Object)null)
{
Shader val = Shader.Find("Sprites/Default");
if ((Object)(object)val == (Object)null)
{
return;
}
GameObject val2 = GameObject.CreatePrimitive((PrimitiveType)5);
Object.Destroy((Object)(object)val2.GetComponent<Collider>());
val2.transform.SetParent(((Component)main).transform, false);
val2.transform.localPosition = new Vector3(0f, 0f, 0.25f);
val2.transform.localRotation = Quaternion.identity;
_flashMat = new Material(val);
_flashMat.color = new Color(0.28f, 0f, 0f, 0f);
val2.GetComponent<Renderer>().material = _flashMat;
_flash = val2;
}
float num = ((main.fieldOfView > 1f) ? main.fieldOfView : 60f);
float num2 = 0.5f * Mathf.Tan(num * 0.5f * ((float)Math.PI / 180f));
_flash.transform.localScale = new Vector3(num2 * main.aspect * 1.4f, num2 * 1.4f, 1f);
_flash.SetActive(true);
MelonCoroutines.Start(FlickerRoutine());
}
catch (Exception ex)
{
Write("flicker failed " + ex.Message);
}
}
private IEnumerator FlickerRoutine()
{
float t = 0f;
while ((Object)(object)_flashMat != (Object)null && t < 0.34f)
{
t += Time.unscaledDeltaTime;
float num = Mathf.Clamp01(t / 0.34f);
float num2 = 0.5f + 0.5f * Mathf.Sin(t * 95f);
Color color = _flashMat.color;
color.a = 0.5f * (1f - num) * num2;
_flashMat.color = color;
yield return null;
}
if ((Object)(object)_flashMat != (Object)null)
{
Color color2 = _flashMat.color;
color2.a = 0f;
_flashMat.color = color2;
}
if ((Object)(object)_flash != (Object)null)
{
_flash.SetActive(false);
}
}
private static GameObject MakeSphere(Shader shader, Color color)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Expected O, but got Unknown
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
GameObject obj = GameObject.CreatePrimitive((PrimitiveType)0);
Object.Destroy((Object)(object)obj.GetComponent<Collider>());
Material val = new Material(shader);
val.color = color;
obj.GetComponent<Renderer>().material = val;
return obj;
}
private static IEnumerator Fade(GameObject go, float dur)
{
float t = 0f;
while ((Object)(object)go != (Object)null && t < dur)
{
t += Time.unscaledDeltaTime;
float num = Mathf.Clamp01(t / dur);
Material material = go.GetComponent<Renderer>().material;
Color color = material.color;
color.a = 0.85f * (1f - num);
material.color = color;
yield return null;
}
if ((Object)(object)go != (Object)null)
{
Object.Destroy((Object)(object)go);
}
}
private static bool IsPlayer(Transform t)
{
Transform val = (((Object)(object)t == (Object)null) ? null : t.root);
if ((Object)(object)val == (Object)null)
{
return false;
}
try
{
GameObject playerHeadStatic = PlayerStaticReferences.playerHeadStatic;
GameObject playerHexaPelvisStatic = PlayerStaticReferences.playerHexaPelvisStatic;
GameObject playerUpperChestStatic = PlayerStaticReferences.playerUpperChestStatic;
if ((Object)(object)playerHeadStatic != (Object)null && (Object)(object)playerHeadStatic.transform.root == (Object)(object)val)
{
return true;
}
if ((Object)(object)playerHexaPelvisStatic != (Object)null && (Object)(object)playerHexaPelvisStatic.transform.root == (Object)(object)val)
{
return true;
}
if ((Object)(object)playerUpperChestStatic != (Object)null && (Object)(object)playerUpperChestStatic.transform.root == (Object)(object)val)
{
return true;
}
}
catch
{
}
return false;
}
private static bool IsHead(string name)
{
string text = ((name == null) ? "" : name.ToLowerInvariant());
if (!text.Contains("head") && !text.Contains("jaw") && !text.Contains("neck") && !text.Contains("skull"))
{
return text.Contains("brain");
}
return true;
}
private static int BodyScore(string name)
{
string text = ((name == null) ? "" : name.ToLowerInvariant());
if (text.Contains("upperchest") || text.Contains("middlechest") || text.Contains("chest") || text.Contains("pelvis"))
{
return 0;
}
if (text.Contains("shoulder") || text.Contains("elbow") || text.Contains("hip") || text.Contains("knee") || text.Contains("arm") || text.Contains("leg"))
{
return 1;
}
return 2;
}
private static List<StickHealth> FindTargets(Vector3 origin, Vector3 dir, int limit)
{
//IL_0007: 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)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: 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_0116: 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)
List<StickHealth> list = new List<StickHealth>();
StickHealth[] array;
try
{
array = Il2CppArrayBase<StickHealth>.op_Implicit(Object.FindObjectsOfType<StickHealth>());
}
catch
{
return list;
}
if (array == null)
{
return list;
}
float num = Mathf.Clamp(_cone.Value, 5f, 120f);
float num2 = Mathf.Clamp(_range.Value, 2f, 40f);
foreach (StickHealth val in array)
{
if ((Object)(object)val == (Object)null)
{
continue;
}
try
{
if (val.isDead)
{
continue;
}
}
catch
{
continue;
}
GameObject gameObject = ((Component)val).gameObject;
if (!((Object)(object)gameObject == (Object)null) && gameObject.activeInHierarchy)
{
Vector3 val2 = (((Object)(object)val.upperChest != (Object)null) ? val.upperChest.transform.position : (((Component)val).transform.position + Vector3.up)) - origin;
float magnitude = ((Vector3)(ref val2)).magnitude;
if (!(magnitude < 0.5f) && !(magnitude > num2) && !(Vector3.Angle(dir, val2) > num))
{
list.Add(val);
}
}
}
list.Sort((StickHealth a, StickHealth b) => Score(a, origin, dir).CompareTo(Score(b, origin, dir)));
if (list.Count > limit)
{
list.RemoveRange(limit, list.Count - limit);
}
return list;
}
private static float Score(StickHealth e, Vector3 origin, Vector3 dir)
{
//IL_0030: 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_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: 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_003b: 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_003d: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = (((Object)(object)e.upperChest != (Object)null) ? e.upperChest.transform.position : (((Component)e).transform.position + Vector3.up)) - origin;
return Vector3.Angle(dir, val) * 2f + ((Vector3)(ref val)).magnitude;
}
private static void CleanArea(Vector3 pos)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
Il2CppReferenceArray<Collider> val = Physics.OverlapSphere(pos, 1.4f, -1, (QueryTriggerInteraction)2);
if (val == null)
{
return;
}
for (int i = 0; i < ((Il2CppArrayBase<Collider>)(object)val).Length; i++)
{
Collider val2 = ((Il2CppArrayBase<Collider>)(object)val)[i];
if ((Object)(object)val2 == (Object)null)
{
continue;
}
GameObject gameObject = ((Component)val2).gameObject;
if ((Object)(object)gameObject == (Object)null)
{
continue;
}
string text = ((Object)gameObject).name.ToLowerInvariant();
if (text.Contains("bone") || text.Contains("lung") || text.Contains("rib") || text.Contains("spine") || text.Contains("heart") || text.Contains("intest") || text.Contains("organ") || text.Contains("gib") || text.Contains("chunk") || text.Contains("meat"))
{
try
{
Object.Destroy((Object)(object)gameObject);
}
catch
{
}
}
}
}
private static HandPoseInfo BuildGun(bool left)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Expected O, but got Unknown
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: 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_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_0143: Unknown result type (might be due to invalid IL or missing references)
//IL_0148: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: Unknown result type (might be due to invalid IL or missing references)
//IL_0177: Unknown result type (might be due to invalid IL or missing references)
//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
//IL_0212: Unknown result type (might be due to invalid IL or missing references)
//IL_0217: Unknown result type (might be due to invalid IL or missing references)
//IL_0241: Unknown result type (might be due to invalid IL or missing references)
//IL_0246: Unknown result type (might be due to invalid IL or missing references)
//IL_0283: Unknown result type (might be due to invalid IL or missing references)
//IL_0288: Unknown result type (might be due to invalid IL or missing references)
//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
//IL_0323: Unknown result type (might be due to invalid IL or missing references)
//IL_0328: Unknown result type (might be due to invalid IL or missing references)
//IL_0352: Unknown result type (might be due to invalid IL or missing references)
//IL_0357: Unknown result type (might be due to invalid IL or missing references)
//IL_0381: Unknown result type (might be due to invalid IL or missing references)
//IL_0386: Unknown result type (might be due to invalid IL or missing references)
HandPoseInfo val = new HandPoseInfo();
val.Position = (left ? new Vector3(-0.0279f, 0.0175f, 0.00724f) : new Vector3(-0.0279f, -0.0175f, 0.00724f));
val.Rotation = (left ? new Quaternion(0.040165648f, 0.9991931f, 0f, 0f) : new Quaternion(0.9991931f, 0.040165816f, 0f, 0f));
val.thumb = Fingers(left, (FingerPoseInfo[])(object)new FingerPoseInfo[3]
{
FP(-0.03259473f, 0.0518627f, -0.008608547f, 0f, 0f, 0f, 1f),
FP(0f, 0.045742195f, 0f, 0f, 0f, 0f, 1f),
FP(0f, 0.027400132f, 0f, 0f, 0f, 0f, 1f)
}, gun: true);
val.index = Fingers(left, (FingerPoseInfo[])(object)new FingerPoseInfo[3]
{
FP(-0.031258326f, 0.12521929f, -0.003754848f, 0f, 0f, 0f, 1f),
FP(0f, 0.043675978f, 0f, 0f, 0f, 0f, 1f),
FP(0f, 0.027745081f, 0f, 0f, 0f, 0f, 1f)
}, gun: true);
val.middle = Fingers(left, (FingerPoseInfo[])(object)new FingerPoseInfo[3]
{
FP(-0.006011055f, 0.12648933f, -0.002649093f, -0.3350919f, 0.057484f, 0.018019635f, 0.9402576f),
FP(0f, 0.043860327f, 0f, -0.8411177f, -0.081291616f, -0.011385806f, 0.53458685f),
FP(0f, 0.029505944f, 0f, -0.36574444f, -0.0006953964f, 0.0016604064f, 0.9307136f)
}, gun: false);
val.ring = Fingers(left, (FingerPoseInfo[])(object)new FingerPoseInfo[3]
{
FP(0.019194486f, 0.11851998f, -0.0075068665f, -0.13339598f, 0.040700037f, -0.027158575f, 0.9898543f),
FP(0f, 0.042655714f, 0f, -0.79596865f, -0.026593337f, 0.01567548f, 0.6045503f),
FP(0f, 0.027702337f, 0f, -0.5070016f, 0.013429092f, -0.020570865f, 0.861595f)
}, gun: false);
val.pinky = Fingers(left, (FingerPoseInfo[])(object)new FingerPoseInfo[3]
{
FP(0.035965066f, 0.1098181f, -0.011605551f, -0.03384376f, -0.02293814f, 0.093499236f, -0.9947795f),
FP(0f, 0.032479797f, 0f, -0.6277896f, -0.02034522f, 0.006189446f, 0.77809244f),
FP(0f, 0.02165052f, 0f, -0.46473768f, 0.012816161f, -0.010871737f, 0.88528895f)
}, gun: false);
return val;
}
private static Il2CppStructArray<FingerPoseInfo> Fingers(bool left, FingerPoseInfo[] src, bool gun)
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
Il2CppStructArray<FingerPoseInfo> val = new Il2CppStructArray<FingerPoseInfo>((long)src.Length);
for (int i = 0; i < src.Length; i++)
{
FingerPoseInfo val2 = Mirror(src[i], left);
if (gun && i == 0)
{
val2.rotation = Quaternion.Euler(0f, 0f, left ? 60f : (-60f));
}
((Il2CppArrayBase<FingerPoseInfo>)(object)val)[i] = val2;
}
return val;
}
private static FingerPoseInfo FP(float px, float py, float pz, float rx, float ry, float rz, float rw)
{
//IL_0002: 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_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
return new FingerPoseInfo
{
position = new Vector3(px, py, pz),
rotation = new Quaternion(rx, ry, rz, rw)
};
}
private static FingerPoseInfo Mirror(FingerPoseInfo f, bool left)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: 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_001c: 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_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
if (left)
{
return f;
}
return new FingerPoseInfo
{
position = new Vector3(0f - f.position.x, f.position.y, f.position.z),
rotation = new Quaternion(f.rotation.x, 0f - f.rotation.y, 0f - f.rotation.z, f.rotation.w)
};
}
private static void Write(string s)
{
try
{
File.AppendAllText("D:\\BrutalistickVrWork\\Probe\\makima_bang.log", "[" + DateTime.Now.ToString("HH:mm:ss") + "] " + s + "\n");
}
catch
{
}
}
}
internal static class Mci
{
public static string LastError;
[DllImport("winmm.dll", CharSet = CharSet.Ansi, EntryPoint = "mciSendStringA")]
private static extern int mciSendString(string cmd, StringBuilder buf, int bufSize, IntPtr cb);
private static int Send(string cmd)
{
try
{
StringBuilder stringBuilder = new StringBuilder(256);
int num = mciSendString(cmd, stringBuilder, stringBuilder.Capacity, IntPtr.Zero);
if (num != 0)
{
LastError = cmd + " -> " + num;
}
return num;
}
catch (Exception ex)
{
LastError = ex.Message;
return -1;
}
}
public static bool Open(string alias, string path, float volume)
{
Send("close " + alias);
if (Send("open \"" + path + "\" type waveaudio alias " + alias) != 0)
{
return false;
}
Send("set " + alias + " time format milliseconds");
float num = volume;
if (num < 0f)
{
num = 0f;
}
if (num > 1f)
{
num = 1f;
}
Send("setaudio " + alias + " volume to " + (int)Math.Round(num * 1000f));
return true;
}
public static bool Play(string alias)
{
if (Send("seek " + alias + " to start") != 0)
{
return false;
}
return Send("play " + alias) == 0;
}
public static void Close(string alias)
{
Send("close " + alias);
}
}
}