using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BoneLib;
using BoneLib.BoneMenu;
using BoneLib.BoneMenu.Elements;
using HarmonyLib;
using MelonLoader;
using MelonLoader.Preferences;
using SLZ;
using SLZ.Interaction;
using SLZ.Marrow.Input;
using SLZ.Marrow.Utilities;
using SLZ.Rig;
using SLZ.SaveData;
using SLZ.VRMK;
using SpiderLab;
using SpiderLab.Behaviours;
using SpiderLab.Data;
using SpiderLab.Preferences;
using SpiderLab.Utils;
using UnhollowerBaseLib;
using UnhollowerRuntimeLib;
using UnityEngine;
using UnityEngine.XR;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("SpiderLab")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany(null)]
[assembly: AssemblyProduct("SpiderLab")]
[assembly: AssemblyCopyright("Created by Parzival")]
[assembly: AssemblyTrademark(null)]
[assembly: ComVisible(false)]
[assembly: AssemblyFileVersion("1.0.2")]
[assembly: NeutralResourcesLanguage("en")]
[assembly: MelonInfo(typeof(Main), "SpiderLab", "1.0.2", "Parzival", "https://bonelab.thunderstore.io/package/Parzival/SpiderLab/")]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: MelonIncompatibleAssemblies(new string[] { "SpiderlectricBoogaloo", "AvatarStatsLoader", "StatOverride" })]
[assembly: MelonAdditionalDependencies(new string[] { "BoneLib" })]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.2.0")]
namespace SpiderLab
{
public static class BuildInfo
{
public const string Name = "SpiderLab";
public const string Author = "Parzival";
public const string Company = null;
public const string Version = "1.0.2";
public const string DownloadLink = "https://bonelab.thunderstore.io/package/Parzival/SpiderLab/";
public const string GameName = "BONELAB";
public const string DeveloperName = "Stress Level Zero";
}
public class Main : MelonMod
{
public override void OnInitializeMelon()
{
Prefs.Initialize();
Patches.Initialize();
Bundles.LoadAssets();
Hooking.OnLevelInitialized += OnLevelInitialized;
}
public override void OnDeinitializeMelon()
{
Prefs.prefsCategory.SaveToFile(true);
}
private void OnLevelInitialized(LevelInfo info)
{
if (Player.handsExist)
{
if ((Object)(object)((Component)Player.leftHand).gameObject.GetComponent<WebShooter>() == (Object)null)
{
((Component)Player.leftHand).gameObject.AddComponent<WebShooter>();
}
if ((Object)(object)((Component)Player.rightHand).gameObject.GetComponent<WebShooter>() == (Object)null)
{
((Component)Player.rightHand).gameObject.AddComponent<WebShooter>();
}
((Component)Player.GetPhysicsRig()).gameObject.AddComponent<AirControl>();
}
else
{
MelonLogger.Warning("Couldn't init WebShooters, hands don't exist!");
}
}
private void LogAvatarInfo(Avatar avatar)
{
Msg("===========================");
Msg("Name: " + ((Object)avatar).name);
Msg("Pointer: " + ((Il2CppObjectBase)avatar).Pointer.ToString("x"));
Msg("Strength Boost: " + Prefs.enableSpiderStrength.Value);
Msg("Mass: " + avatar.massTotal);
Msg("Strength Upper: " + avatar.strengthUpper);
Msg("Strength Lower: " + avatar.strengthLower);
float num = avatar.strengthUpper / avatar.massTotal;
Msg("Strength Upper to Total Mass: " + num);
Msg("Strength % of Mass: " + num * 100f);
Msg("Raw Strength Upper: " + avatar.strengthUpper / (avatar.massTotal / 75f));
static void Msg(string txt)
{
MelonLogger.Msg(txt);
}
}
}
internal static class Patches
{
public static void Initialize()
{
Hooking.CreateHook(typeof(WorldGrip).GetMethod("ValidateGripScore", AccessTools.all), typeof(Patches).GetMethod("WorldGripScorePostfix", AccessTools.all), false);
Hooking.CreateHook(typeof(PhysicsRig).GetMethod("SetAvatar", AccessTools.all), typeof(Patches).GetMethod("PhysicsRigSetAvatarPrefix", AccessTools.all), true);
}
private static void WorldGripScorePostfix(Hand hand, SimpleTransform handTransform, ref float __result, WorldGrip __instance)
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: 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_0037: 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_0043: 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)
if (Prefs.enableWallCrawling.Value)
{
Vector3 val = hand.palmPositionTransform.position - __instance.genericHandStates[hand].raycastPoint;
Vector3 normalized = ((Vector3)(ref val)).normalized;
if (Vector3.Dot(-normalized, hand.palmPositionTransform.forward) >= 0.75f)
{
__instance.genericHandStates[hand].raycastNormal = normalized;
__result = 1.5f;
}
}
}
private static void PhysicsRigSetAvatarPrefix(Avatar avatar)
{
if (Prefs.enableSpiderStrength.Value)
{
float num = Prefs.upperProportionalStrengthPerc.Value / 100f * avatar.massTotal * Prefs.upperStrengthBoostMultiplier.Value;
avatar._strengthUpper = Mathf.Max(num, avatar._strengthUpper);
float num2 = Prefs.lowerProportionalStrengthPerc.Value / 100f * avatar.massTotal * Prefs.lowerStrengthBoostMultiplier.Value;
avatar._strengthLower = Mathf.Max(num2, avatar._strengthLower);
}
}
}
}
namespace SpiderLab.Utils
{
public struct BoolTimer
{
private float resetTime;
public void Set(float time, bool overwrite = false)
{
if (overwrite)
{
resetTime = Time.time + time;
}
else
{
resetTime = Mathf.Max(resetTime, Time.time + time);
}
}
public void Reset()
{
resetTime = Time.time - 1f;
}
public bool GetValue()
{
return Time.time <= resetTime;
}
public static implicit operator bool(BoolTimer bt)
{
return bt.GetValue();
}
}
public static class ControllerInfo
{
public static bool GetTouchpadTouch(Handedness hand)
{
//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_0015: 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 (!TryGetXRController(hand, out var controller))
{
return false;
}
if ((int)controller.Type == 0)
{
InputDevice xrDevice = ((XRDevice)controller)._xrDevice;
bool result = default(bool);
if (((InputDevice)(ref xrDevice)).TryGetFeatureValue(CommonUsages.thumbrest, ref result))
{
return result;
}
}
return controller.TouchpadTouch;
}
public static bool GetFaceButtonsTouch(Handedness hand)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
if (!TryGetXRController(hand, out var controller))
{
return false;
}
if (controller.ATouch)
{
return controller.BTouch;
}
return false;
}
public static float GetTrigger(Handedness hand)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
if (!TryGetXRController(hand, out var controller))
{
return 0f;
}
return controller.Trigger;
}
private static bool TryGetXRController(Handedness hand, out XRController controller)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Invalid comparison between Unknown and I4
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Invalid comparison between Unknown and I4
if ((int)hand != 1)
{
if ((int)hand == 2)
{
controller = MarrowGame.xr.RightController;
return true;
}
MelonLogger.Error("Invalid hand type: " + ((object)(Handedness)(ref hand)).ToString());
controller = null;
return false;
}
controller = MarrowGame.xr.LeftController;
return true;
}
}
public static class GeneralExtensions
{
public static void MatchRotation(this ref Vector3 vector, Vector3 target, float maxRadiansDelta, float maxMagnitudeDelta)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
vector = Vector3.RotateTowards(vector, target, maxRadiansDelta, maxMagnitudeDelta);
}
public static void PointTowards(this ref Vector3 vector, Vector3 target, float maxRadiansDelta)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: 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_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)
vector = Vector3.RotateTowards(vector, target - vector, maxRadiansDelta, 0f);
}
public static GameObject CreateChild(this GameObject go, string name, Vector3 localPosition = default(Vector3))
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: 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_001a: 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_002f: 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_003c: Expected O, but got Unknown
//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)
GameObject val = new GameObject(name);
val.transform.SetParent(go.transform);
if (localPosition == default(Vector3))
{
localPosition = Vector3.zero;
}
val.transform.localPosition = localPosition;
return val;
}
public static bool IsStaticLayer(this GameObject obj)
{
return (obj.layer & 0x2000) > 0;
}
}
public static class AssetBundleExtensions
{
public static T LoadAssetWithFlags<T>(this AssetBundle bundle, string name) where T : Object
{
T val = bundle.LoadAsset<T>(name);
((Object)val).hideFlags = (HideFlags)32;
return val;
}
public static T LoadAsset<T>(this AssetBundle bundle, string name) where T : Object
{
return ((Il2CppObjectBase)bundle.LoadAsset(name, Il2CppType.Of<T>(true))).Cast<T>();
}
}
public static class JointExtensions
{
public static Vector3 GetConnectedPoint(this ConfigurableJoint joint)
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)((Joint)joint).connectedBody != (Object)null)
{
return ((Component)((Joint)joint).connectedBody).transform.TransformPoint(((Joint)joint).connectedAnchor);
}
return ((Joint)joint).connectedAnchor;
}
public static void SetConnectedPoint(this ConfigurableJoint joint, Vector3 worldPoint)
{
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
((Joint)joint).autoConfigureConnectedAnchor = false;
if ((Object)(object)((Joint)joint).connectedBody != (Object)null)
{
((Joint)joint).connectedAnchor = ((Component)((Joint)joint).connectedBody).transform.InverseTransformPoint(worldPoint);
}
else
{
((Joint)joint).connectedAnchor = worldPoint;
}
}
public static Vector3 GetAnchorPoint(this ConfigurableJoint joint)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
return ((Component)joint).transform.TransformPoint(((Joint)joint).anchor);
}
public static void SetAnchorPoint(this ConfigurableJoint joint, Vector3 worldPoint)
{
//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)
((Joint)joint).anchor = ((Component)joint).transform.InverseTransformPoint(worldPoint);
}
public static Vector3 GetTargetPosition(this ConfigurableJoint joint)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
return ((Component)joint).transform.TransformPoint(joint.targetPosition);
}
public static void SetTargetPosition(this ConfigurableJoint joint, Vector3 worldPos)
{
//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)
joint.targetPosition = ((Component)joint).transform.InverseTransformPoint(worldPos);
}
public static void SetLinearLimit(this ConfigurableJoint joint, float limit, float bounciness)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: 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)
SoftJointLimit linearLimit = joint.linearLimit;
((SoftJointLimit)(ref linearLimit)).limit = limit;
((SoftJointLimit)(ref linearLimit)).bounciness = bounciness;
joint.linearLimit = linearLimit;
}
public static void SetLinearMotion(this ConfigurableJoint joint, ConfigurableJointMotion motion)
{
//IL_0001: 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_000f: Unknown result type (might be due to invalid IL or missing references)
joint.xMotion = motion;
joint.yMotion = motion;
joint.zMotion = motion;
}
public static void SetSpringLimit(this ConfigurableJoint joint, float spring, float damper)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: 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)
SoftJointLimitSpring linearLimitSpring = joint.linearLimitSpring;
((SoftJointLimitSpring)(ref linearLimitSpring)).spring = spring;
((SoftJointLimitSpring)(ref linearLimitSpring)).damper = damper;
joint.linearLimitSpring = linearLimitSpring;
}
public static void SetSpringDrive(this ConfigurableJoint joint, float spring, float damper, float max)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: 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_002f: Unknown result type (might be due to invalid IL or missing references)
JointDrive val = default(JointDrive);
((JointDrive)(ref val)).positionSpring = spring;
((JointDrive)(ref val)).positionDamper = damper;
((JointDrive)(ref val)).maximumForce = max;
joint.xDrive = val;
joint.yDrive = val;
joint.zDrive = val;
}
}
}
namespace SpiderLab.Preferences
{
public enum HandGesture
{
SPIDEY,
GRIP
}
public enum WeblineInput
{
TOUCHPAD,
DOUBLE_TOUCHPAD,
DOUBLE_GESTURE,
DOUBLE_TRIGGER,
DOUBLE_TOUCH_BUTTONS
}
internal static class Prefs
{
public static MelonPreferences_Entry<bool> enableAimReticle;
public static MelonPreferences_Entry<bool> enableWallCrawling;
public static MelonPreferences_Entry<HandGesture> selectedGesture;
public static MelonPreferences_Entry<WeblineInput> weblineInput;
public static MelonPreferences_Entry<bool> enableWebSwinging;
public static MelonPreferences_Entry<float> webzipPullSpeedMin;
public static MelonPreferences_Entry<float> webzipStrengthMultiplier;
public static MelonPreferences_Entry<bool> enableSpiderStrength;
public static MelonPreferences_Entry<float> upperStrengthBoostMultiplier;
public static MelonPreferences_Entry<float> upperProportionalStrengthPerc;
public static MelonPreferences_Entry<float> lowerStrengthBoostMultiplier;
public static MelonPreferences_Entry<float> lowerProportionalStrengthPerc;
public static MelonPreferences_Category prefsCategory;
public static MenuCategory menuCategory;
public static bool WebShootersEnabled => enableWebSwinging.Value;
public static float WebzipPullSpeedMax => webzipPullSpeedMin.Value + 1f;
public static float WebzipImpulseSpeed => 50f * webzipStrengthMultiplier.Value;
public static void Initialize()
{
prefsCategory = MelonPreferences.CreateCategory("SpiderLab");
selectedGesture = prefsCategory.CreateEntry<HandGesture>("Hand Gesture", HandGesture.GRIP, (string)null, "Required hand gesture for Webshooter inputs to register (SPIDEY, GRIP) (SPIDEY gesture requires finger tracking!)", false, false, (ValueValidator)null, (string)null);
weblineInput = prefsCategory.CreateEntry<WeblineInput>("Webline Input", WeblineInput.TOUCHPAD, (string)null, "Input required to shoot a Webline, in addition to Hand Gesture Input (TOUCHPAD, DOUBLE_TOUCHPAD, DOUBLE_GESTURE, DOUBLE_TRIGGER, DOUBLE_TOUCH_BUTTONS) (DOUBLE_TOUCH_BUTTONS requires two face buttons with capacitive touch!)", false, false, (ValueValidator)null, (string)null);
enableWallCrawling = prefsCategory.CreateEntry<bool>("Enable Wall Crawling", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
enableWebSwinging = prefsCategory.CreateEntry<bool>("Enable Web Swinging", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
enableSpiderStrength = prefsCategory.CreateEntry<bool>("Enable Spider Strength", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
upperStrengthBoostMultiplier = prefsCategory.CreateEntry<float>("Upper Strength Boost Multiplier", 1f, (string)null, "Controls the how strong the upper-body strength boost is", false, false, (ValueValidator)null, (string)null);
upperProportionalStrengthPerc = prefsCategory.CreateEntry<float>("Upper Proportional Strength Percentage", 5f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
lowerStrengthBoostMultiplier = prefsCategory.CreateEntry<float>("Lower Strength Boost Multiplier", 1f, (string)null, "Controls the how strong the lower-body strength boost is", false, false, (ValueValidator)null, (string)null);
lowerProportionalStrengthPerc = prefsCategory.CreateEntry<float>("Lower Proportional Strength Percentage", 3.45f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
webzipPullSpeedMin = prefsCategory.CreateEntry<float>("WebZip Minimum Pull Speed", 4f, (string)null, "Minimum pull speed for WebZip to kick in (m/s)", false, false, (ValueValidator)null, (string)null);
webzipStrengthMultiplier = prefsCategory.CreateEntry<float>("WebZip Strength Multiplier", 1f, (string)null, "Controls how strong a maxxed WebZip is", false, false, (ValueValidator)null, (string)null);
enableAimReticle = prefsCategory.CreateEntry<bool>("Enable Aiming Reticle", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
SetupBoneMenu();
prefsCategory.SaveToFile(false);
}
private static void SetupBoneMenu()
{
//IL_0005: 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_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: 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_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: 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_018f: Unknown result type (might be due to invalid IL or missing references)
//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
//IL_022b: Unknown result type (might be due to invalid IL or missing references)
//IL_0248: Unknown result type (might be due to invalid IL or missing references)
//IL_0258: Unknown result type (might be due to invalid IL or missing references)
//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
//IL_02f8: Unknown result type (might be due to invalid IL or missing references)
//IL_0340: Unknown result type (might be due to invalid IL or missing references)
//IL_0392: Unknown result type (might be due to invalid IL or missing references)
menuCategory = MenuManager.CreateCategory("SpiderLab", Color.red);
MenuCategory obj = menuCategory.CreateCategory("Input", Color.white);
obj.CreateEnumElement<HandGesture>(((MelonPreferences_Entry)selectedGesture).Identifier, Color.white, selectedGesture.Value, (Action<HandGesture>)delegate(HandGesture gesture)
{
selectedGesture.Value = gesture;
});
obj.CreateEnumElement<WeblineInput>(((MelonPreferences_Entry)weblineInput).Identifier, Color.white, weblineInput.Value, (Action<WeblineInput>)delegate(WeblineInput webInput)
{
weblineInput.Value = webInput;
});
MenuCategory obj2 = menuCategory.CreateCategory("Web Swinging", Color.white);
obj2.CreateBoolElement(((MelonPreferences_Entry)enableAimReticle).Identifier, Color.white, enableAimReticle.Value, (Action<bool>)delegate(bool value)
{
enableAimReticle.Value = value;
});
obj2.CreateBoolElement(((MelonPreferences_Entry)enableWebSwinging).Identifier, Color.white, enableWebSwinging.Value, (Action<bool>)delegate(bool value)
{
enableWebSwinging.Value = value;
});
obj2.CreateFloatElement(((MelonPreferences_Entry)webzipPullSpeedMin).Identifier, Color.white, webzipPullSpeedMin.Value, 0.5f, 0f, 10f, (Action<float>)delegate(float value)
{
webzipPullSpeedMin.Value = value;
});
obj2.CreateFloatElement(((MelonPreferences_Entry)webzipStrengthMultiplier).Identifier, Color.white, webzipStrengthMultiplier.Value, 0.2f, 0f, 10f, (Action<float>)delegate(float value)
{
webzipStrengthMultiplier.Value = value;
});
MenuCategory obj3 = menuCategory.CreateCategory("Spider Strength", Color.white);
obj3.CreateBoolElement(((MelonPreferences_Entry)enableSpiderStrength).Identifier, Color.white, enableSpiderStrength.Value, (Action<bool>)delegate(bool value)
{
enableSpiderStrength.Value = value;
});
obj3.CreateFunctionElement("Update Stats", Color.yellow, (Action)UpdateStrengthStats);
SubPanelElement obj4 = obj3.CreateSubPanel("Upper Strength", Color.white);
obj4.CreateFloatElement("Strength Boost Multiplier", Color.white, upperStrengthBoostMultiplier.Value, 0.1f, 0f, 100f, (Action<float>)delegate(float value)
{
upperStrengthBoostMultiplier.Value = value;
});
obj4.CreateFloatElement("Proportional Strength Percentage", Color.white, upperProportionalStrengthPerc.Value, 1f, 0f, 100f, (Action<float>)delegate(float value)
{
upperProportionalStrengthPerc.Value = value;
});
SubPanelElement obj5 = obj3.CreateSubPanel("Lower Strength", Color.white);
obj5.CreateFloatElement("Strength Boost Multiplier", Color.white, lowerStrengthBoostMultiplier.Value, 0.1f, 0f, 100f, (Action<float>)delegate(float value)
{
lowerStrengthBoostMultiplier.Value = value;
});
obj5.CreateFloatElement("Proportional Strength Percentage", Color.white, lowerProportionalStrengthPerc.Value, 1f, 0f, 100f, (Action<float>)delegate(float value)
{
lowerProportionalStrengthPerc.Value = value;
});
menuCategory.CreateBoolElement(((MelonPreferences_Entry)enableWallCrawling).Identifier, Color.white, enableWallCrawling.Value, (Action<bool>)delegate(bool value)
{
enableWallCrawling.Value = value;
});
}
public static void UpdateStrengthStats()
{
Player.GetPhysicsRig().SetAvatar(Player.GetCurrentAvatar());
}
}
}
namespace SpiderLab.Data
{
internal static class Bundles
{
public static AssetBundle spiderLabBundle;
public static GameObject webLinePrefab;
public static GameObject webShooterReticlePrefab;
public static AudioClip webLineAudioLow;
public static AudioClip webLineAudioHigh;
public static AudioClip webShotAudioLow;
public static AudioClip webShotAudioHigh;
public static void LoadAssets()
{
spiderLabBundle = EmebeddedAssetBundle.LoadFromAssembly(Assembly.GetExecutingAssembly(), "SpiderLab.src.Data.spiderlab.bundle");
if ((Object)(object)spiderLabBundle == (Object)null)
{
throw new NullReferenceException("SpiderLab bundle is null! Did you forget to compile the bundle into the dll?");
}
webLinePrefab = spiderLabBundle.LoadAssetWithFlags<GameObject>("prefabs/webline");
webShooterReticlePrefab = spiderLabBundle.LoadAssetWithFlags<GameObject>("prefabs/webshooterreticle");
webLineAudioHigh = spiderLabBundle.LoadAssetWithFlags<AudioClip>("audio/webline_high");
webLineAudioLow = spiderLabBundle.LoadAssetWithFlags<AudioClip>("audio/webline_low");
webShotAudioHigh = spiderLabBundle.LoadAssetWithFlags<AudioClip>("audio/webshot_high");
webShotAudioLow = spiderLabBundle.LoadAssetWithFlags<AudioClip>("audio/webshot_low");
spiderLabBundle.Unload(false);
}
}
public static class EmebeddedAssetBundle
{
public static AssetBundle LoadFromAssembly(Assembly assembly, string name)
{
if (assembly.GetManifestResourceNames().Contains(name))
{
MelonLogger.Msg(ConsoleColor.DarkCyan, "Loading embedded bundle " + name + "...");
byte[] array;
using (Stream stream = assembly.GetManifestResourceStream(name))
{
using MemoryStream memoryStream = new MemoryStream();
stream.CopyTo(memoryStream);
array = memoryStream.ToArray();
}
MelonLogger.Msg(ConsoleColor.DarkCyan, "Done!");
return AssetBundle.LoadFromMemory(Il2CppStructArray<byte>.op_Implicit(array));
}
MelonLogger.Warning("Missing embedded bundle " + name);
return null;
}
}
}
namespace SpiderLab.Behaviours
{
[RegisterTypeInIl2Cpp]
public class AirControl : MonoBehaviour
{
private RigManager rigMan;
public AirControl(IntPtr ptr)
: base(ptr)
{
}
private void Start()
{
rigMan = Player.rigManager;
}
private void FixedUpdate()
{
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: 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_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: 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_00ae: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)rigMan.activeSeat != (Object)null) && !rigMan.physicsRig.physG.isGrounded)
{
Vector2 val = (rigMan.ControllerRig.isRightHanded ? Player.leftHand.Controller.GetThumbStickAxis() : Player.rightHand.Controller.GetThumbStickAxis());
Vector3 val2 = rigMan.ControllerRig.directionMasterTransform.rotation * new Vector3(val.x, 0f, val.y) * 12f;
rigMan.physicsRig.torso.rbChest.AddForce(val2, (ForceMode)5);
}
}
}
[RegisterTypeInIl2Cpp]
public class WebLine : MonoBehaviour
{
public Vector3 anchorPoint;
public Vector3 connectedPoint;
private LineRenderer lRenderer;
public WebLine(IntPtr ptr)
: base(ptr)
{
}
private void Start()
{
lRenderer = ((Component)this).GetComponent<LineRenderer>();
}
public void SetActive(bool value)
{
((Renderer)lRenderer).enabled = value;
}
public void UpdateLine(Vector3 anchorPoint, Vector3 connectedPoint)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: 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_0009: Unknown result type (might be due to invalid IL or missing references)
this.anchorPoint = anchorPoint;
this.connectedPoint = connectedPoint;
UpdateLine();
}
public void UpdateLine()
{
//IL_0008: 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)
lRenderer.SetPosition(0, anchorPoint);
lRenderer.SetPosition(1, connectedPoint);
}
public Vector3 GetLineSegment()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
return connectedPoint - anchorPoint;
}
public Vector3 GetNormal()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
Vector3 lineSegment = GetLineSegment();
return ((Vector3)(ref lineSegment)).normalized;
}
}
[RegisterTypeInIl2Cpp]
public class WebShooter : MonoBehaviour
{
private const float YOUNGS_MODULUS = 2E+11f;
private const float WEB_CROSS_SECTIONAL_AREA = 0.0001767f;
private const float LINEAR_SPRING_CONSTANT = 1372344f / (float)Math.E;
private const float LINEAR_SPRING_DAMPER = 50485.715f;
private float WEB_BREAK_FORCE = 1000000f;
private const float MAX_WEB_RANGE = 70f;
private const float LINEAR_DRIVE_SPRING = 500f;
private const float LINEAR_DRIVE_DAMPER = 1f;
private const float LINEAR_DRIVE_MAX = 2500f;
public bool doWebWrapping;
private LayerMask layerMask = LayerMask.op_Implicit(46081);
private WebLine webLine;
private Hand hand;
private Transform aimReticle;
private AudioSource audioSource;
private float webLine_lowestLength;
private ConfigurableJoint webJoint;
private Collider webbedCollider;
private BoolTimer isWebShotBtnPressMomentary;
private BoolTimer weblineDoubleTap;
private bool weblineLastDoubleTapState;
private BoolTimer webzipCooldown;
private Vector3 lastControllerPos;
private const int ROLLING_AVERAGE_VELOCITY_MAX = 8;
private Vector3[] controllerVelocities = (Vector3[])(object)new Vector3[8];
private int rollingAverageVelIndex;
public WebShooter(IntPtr ptr)
: base(ptr)
{
}//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
private void Start()
{
hand = ((Component)this).GetComponent<Hand>();
webLine = Object.Instantiate<GameObject>(Bundles.webLinePrefab, ((Component)this).transform).AddComponent<WebLine>();
aimReticle = Object.Instantiate<GameObject>(Bundles.webShooterReticlePrefab).transform;
audioSource = ((Component)this).gameObject.AddComponent<AudioSource>();
audioSource.playOnAwake = false;
audioSource.minDistance = 0.5f;
audioSource.spatialBlend = 1f;
}
private void LateUpdate()
{
if (!Prefs.WebShootersEnabled)
{
((Component)aimReticle).gameObject.SetActive(false);
if (IsWebAttatched())
{
DestroyWebJoint();
}
}
else if (IsWebAttatched())
{
UpdateWeb();
}
else
{
webLine.SetActive(value: false);
HandleAiming();
}
}
private void UpdateWeb()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: 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_0017: 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_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)
//IL_00d2: 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_0023: 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_0025: 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_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: 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_0166: Unknown result type (might be due to invalid IL or missing references)
//IL_016d: 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_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = webJoint.GetConnectedPoint();
Vector3 anchorPoint = webJoint.GetAnchorPoint();
Vector3 val2;
if (doWebWrapping)
{
val2 = val - anchorPoint;
RaycastHit val3 = default(RaycastHit);
if (Physics.Raycast(anchorPoint, ((Vector3)(ref val2)).normalized, ref val3, 70f, LayerMask.op_Implicit(layerMask), (QueryTriggerInteraction)1) && ((Component)((RaycastHit)(ref val3)).collider).gameObject.isStatic && (((RaycastHit)(ref val3)).colliderInstanceID != ((Object)webbedCollider).GetInstanceID() || Vector3.Distance(((RaycastHit)(ref val3)).point, val) > 0.01f))
{
((Joint)webJoint).connectedBody = ((RaycastHit)(ref val3)).rigidbody;
webJoint.SetConnectedPoint(((RaycastHit)(ref val3)).point);
val = ((RaycastHit)(ref val3)).point;
}
}
webLine.UpdateLine(hand.palmPositionTransform.position, val);
val2 = val - anchorPoint;
float magnitude = ((Vector3)(ref val2)).magnitude;
if (magnitude < webLine_lowestLength)
{
webJoint.SetLinearLimit(magnitude, 1f);
webLine_lowestLength = magnitude;
}
if (((Object)(object)webbedCollider.attachedRigidbody == (Object)null || webbedCollider.attachedRigidbody.mass >= Player.GetCurrentAvatar().massTotal * 10f) && IsYanking(out var intensity))
{
float num = Prefs.WebzipImpulseSpeed * intensity;
Player.rigManager.physicsRig.torso.rbChest.AddForce(webLine.GetNormal() * num, (ForceMode)2);
hand.Controller.haptor.Haptic_Knock();
webzipCooldown.Set(1f);
}
if (!IsPlayerGesturing(HandGesture.GRIP) || (Object)(object)webbedCollider == (Object)null || !((Component)webbedCollider).gameObject.activeInHierarchy)
{
DestroyWebJoint();
}
}
private bool IsYanking(out float intensity)
{
//IL_000f: 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_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: 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_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_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_006b: 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_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: 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_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: 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)
//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_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_00e6: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = ((ControllerRig)Player.rigManager.openControllerRig).vrRoot.rotation * ((((Component)hand.Controller).transform.localPosition - lastControllerPos) / Time.deltaTime);
lastControllerPos = ((Component)hand.Controller).transform.localPosition;
controllerVelocities[rollingAverageVelIndex] = val;
rollingAverageVelIndex = (rollingAverageVelIndex + 1) % 8;
intensity = 0f;
if ((bool)webzipCooldown)
{
return false;
}
Vector3 val2 = Vector3.zero;
Vector3[] array = controllerVelocities;
foreach (Vector3 val3 in array)
{
val2 += val3;
}
val2 /= (float)controllerVelocities.Length;
if (Vector3.Dot(-webLine.GetNormal(), ((Vector3)(ref val2)).normalized) >= 0.4f && ((Vector3)(ref val2)).sqrMagnitude >= Prefs.webzipPullSpeedMin.Value * Prefs.webzipPullSpeedMin.Value)
{
float num = Mathf.InverseLerp(Prefs.webzipPullSpeedMin.Value, Prefs.WebzipPullSpeedMax, ((Vector3)(ref val2)).magnitude);
intensity = 1f - Mathf.Pow(1f - Mathf.Clamp01(num), 3f);
return true;
}
return false;
}
private void HandleAiming()
{
//IL_0026: 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_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: 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_0072: 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)
if ((Object)(object)Player.GetObjectInHand(hand) != (Object)null)
{
ToggleReticle(value: false);
return;
}
aimReticle.rotation = Quaternion.LookRotation(Player.playerHead.forward);
RaycastHit hit = default(RaycastHit);
if (Physics.SphereCast(((Component)this).transform.position, 0.07f, ((Component)this).transform.forward, ref hit, 70f, LayerMask.op_Implicit(layerMask), (QueryTriggerInteraction)1))
{
aimReticle.position = ((RaycastHit)(ref hit)).point;
ToggleReticle(value: true);
if (CanShootWebLine())
{
CreateWebJoint(hit);
PlayAudio(Bundles.webLineAudioHigh, Bundles.webLineAudioLow);
hand.Controller.haptor.Haptic_Tap();
ToggleReticle(value: false);
}
}
else
{
ToggleReticle(value: false);
}
}
private void ToggleReticle(bool value)
{
((Component)aimReticle).gameObject.SetActive(Prefs.enableAimReticle.Value && value);
}
private bool CheckDoubleTapWebline(bool currentState)
{
bool result = false;
if (currentState && !weblineLastDoubleTapState)
{
if ((bool)weblineDoubleTap)
{
weblineDoubleTap.Reset();
result = true;
}
else
{
weblineDoubleTap.Set(0.25f, overwrite: true);
}
}
weblineLastDoubleTapState = currentState;
return result;
}
private bool CanShootWebLine()
{
//IL_003e: 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_00a6: 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)
if (!Prefs.enableWebSwinging.Value)
{
return false;
}
switch (Prefs.weblineInput.Value)
{
case WeblineInput.TOUCHPAD:
if (ControllerInfo.GetTouchpadTouch(hand.handedness))
{
return IsPlayerGesturing(Prefs.selectedGesture.Value);
}
return false;
case WeblineInput.DOUBLE_TOUCHPAD:
if (CheckDoubleTapWebline(ControllerInfo.GetTouchpadTouch(hand.handedness)))
{
return IsPlayerGesturing(Prefs.selectedGesture.Value);
}
return false;
case WeblineInput.DOUBLE_GESTURE:
return CheckDoubleTapWebline(IsPlayerGesturing(Prefs.selectedGesture.Value));
case WeblineInput.DOUBLE_TRIGGER:
if (CheckDoubleTapWebline(ControllerInfo.GetTrigger(hand.handedness) >= 0.75f))
{
return IsPlayerGesturing(Prefs.selectedGesture.Value);
}
return false;
case WeblineInput.DOUBLE_TOUCH_BUTTONS:
if (CheckDoubleTapWebline(ControllerInfo.GetFaceButtonsTouch(hand.handedness)))
{
return IsPlayerGesturing(Prefs.selectedGesture.Value);
}
return false;
default:
return false;
}
}
private bool CanShootWebShot()
{
if (!IsWebAttatched() && IsPlayerGesturing(Prefs.selectedGesture.Value))
{
if (!hand.Controller.GetBButtonDown())
{
if (hand.Controller.GetBButtonUp())
{
return isWebShotBtnPressMomentary;
}
return false;
}
isWebShotBtnPressMomentary.Set(0.2f);
}
return false;
}
private bool IsPlayerGesturing(HandGesture gesture)
{
if ((Object)(object)Player.GetObjectInHand(hand) != (Object)null || hand.Skeleton.IsSnatching())
{
return false;
}
BaseController controller = hand.Controller;
switch (gesture)
{
case HandGesture.SPIDEY:
if (controller.GetIndexCurlAxis() <= 0.3f && controller.GetMiddleCurlAxis() >= 0.7f && controller.GetRingCurlAxis() >= 0.7f)
{
return controller.GetPinkyCurlAxis() <= 0.3f;
}
return false;
case HandGesture.GRIP:
return controller.GetIndexCurlAxis() + controller.GetMiddleCurlAxis() + controller.GetRingCurlAxis() + controller.GetPinkyCurlAxis() >= 1.4f;
default:
return false;
}
}
private bool IsWebAttatched()
{
return (Object)(object)webJoint != (Object)null;
}
private void CreateWebJoint(RaycastHit hit)
{
//IL_002f: 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_00f7: 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)
webJoint = ((Component)this).gameObject.AddComponent<ConfigurableJoint>();
((Joint)webJoint).connectedBody = ((RaycastHit)(ref hit)).rigidbody;
webJoint.SetAnchorPoint(((Component)this).transform.position);
webJoint.SetConnectedPoint(((RaycastHit)(ref hit)).point);
webJoint.SetLinearMotion((ConfigurableJointMotion)1);
webJoint.SetLinearLimit(((RaycastHit)(ref hit)).distance + 0.075f, 1f);
webLine_lowestLength = ((RaycastHit)(ref hit)).distance;
webJoint.SetSpringLimit(1372344f / (float)Math.E, 50485.715f);
webJoint.SetSpringDrive(0f, 0f, 0f);
((Joint)webJoint).breakForce = WEB_BREAK_FORCE;
((Joint)webJoint).enableCollision = true;
webbedCollider = ((RaycastHit)(ref hit)).collider;
webLine.SetActive(value: true);
webLine.UpdateLine(hand.palmPositionTransform.position, ((RaycastHit)(ref hit)).point);
}
private void DestroyWebJoint()
{
if ((Object)(object)webJoint != (Object)null)
{
webLine.SetActive(value: false);
Object.Destroy((Object)(object)webJoint);
}
}
private void PlayAudio(AudioClip high, AudioClip low)
{
AudioClip val = ((Random.value > 0.5f) ? high : low);
float num = 0.5f * (DataManager.ActiveSave.PlayerSettings.VolumeSFX / 10f);
audioSource.loop = false;
audioSource.PlayOneShot(val, num);
}
}
}