using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using Hoverboard; using Hoverboard.Config; using Hoverboard.Factory; using Hoverboard.TemplateUtils; using MelonLoader; using MelonLoader.Preferences; using Microsoft.CodeAnalysis; using ScheduleOne; using ScheduleOne.AvatarFramework.Equipping; using ScheduleOne.Core.Items.Framework; using ScheduleOne.DevUtilities; using ScheduleOne.Dialogue; using ScheduleOne.Equipping; using ScheduleOne.Experimental; using ScheduleOne.ItemFramework; using ScheduleOne.NPCs.CharacterClasses; using ScheduleOne.Persistence; using ScheduleOne.Skating; using ScheduleOne.Storage; using ScheduleOne.Weather; using UnityEngine; using UnityEngine.Events; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: MelonInfo(typeof(Core), "Hoverboard", "1.0.1", "OverweightUnicorn", null)] [assembly: MelonColor(255, 191, 0, 255)] [assembly: MelonGame("TVGS", "Schedule I")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("ScheduleOne.Core")] [assembly: AssemblyCompany("Hoverboard_Mono_1.0.2")] [assembly: AssemblyConfiguration("MONO")] [assembly: AssemblyFileVersion("1.0.2")] [assembly: AssemblyInformationalVersion("1.0.0+28ba72392e06a1553874309bd28df42bf6bdc77f")] [assembly: AssemblyProduct("Hoverboard_Mono_1.0.2")] [assembly: AssemblyTitle("Hoverboard_Mono_1.0.2")] [assembly: NeutralResourcesLanguage("en-US")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.2.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Hoverboard { public static class BuildInfo { public const string Name = "Hoverboard"; public const string Description = "Adds a hoverboard to the game...because why not?"; public const string Author = "OverweightUnicorn"; public const string Company = "UnicornsCanMod"; public const string Version = "1.0.1"; public const string DownloadLink = null; } public class Core : MelonMod { public override void OnInitializeMelon() { AssetBundleUtils.Initialize(this); HoverboardConfig.Initialize(); } public override void OnLateInitializeMelon() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown Singleton.Instance.onLoadComplete.AddListener(new UnityAction(InitMod)); } public override void OnSceneWasLoaded(int buildIndex, string sceneName) { if (sceneName == "Main" && (Object)(object)HoverboardFactory.hoverboardPrefab == (Object)null) { HoverboardFactory.Init(); } else { HoverboardFactory.Reset(); } } public void InitMod() { //IL_0072: 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_0082: 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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Expected O, but got Unknown bool flag = HoverboardFactory.EnsureStorableDefinitionRegistered(); Jeff val = Object.FindObjectOfType(); if (!((Object)(object)val != (Object)null)) { return; } GameObject gameObject = ((Component)val).gameObject; Transform val2 = gameObject.transform.Find("Dialogue"); if ((Object)(object)val2 != (Object)null) { DialogueController_SkateboardSeller component = ((Component)val2).gameObject.GetComponent(); if ((Object)(object)component != (Object)null && flag) { ItemDefinition item = Registry.GetItem("hoverboard"); Option item2 = new Option { Name = "Hoverboard", Price = HoverboardConfig.Price.Value, IsAvailable = ((Object)(object)item != (Object)null), NotAvailableReason = (((Object)(object)item != (Object)null) ? "You aren't cool enough" : "Item definition not found"), Item = item }; component.Options.Insert(0, item2); Utility.Success("Added hoverboard to seller options"); } else { Utility.Log($"InitMod: sellerController missing={(Object)(object)component == (Object)null}, itemRegistered={flag}"); } } else { Utility.Error("Could not find Dialogue child on Jeff"); } } } public static class Utility { public static void PrintException(Exception e) { MelonLogger.Msg(ConsoleColor.Red, e.Source); MelonLogger.Msg(ConsoleColor.DarkRed, e.Message); } public static void Error(string msg) { MelonLogger.Msg(ConsoleColor.Red, msg); } public static void Log(string msg) { MelonLogger.Msg(ConsoleColor.DarkMagenta, msg); } public static void Success(string msg) { MelonLogger.Msg(ConsoleColor.Green, msg); } public static void ListHierarchy(Transform transform, int depth) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown string text = new string(' ', depth * 2); MelonLogger.Msg(text + "- " + ((Object)transform).name); foreach (Transform item in transform) { Transform transform2 = item; ListHierarchy(transform2, depth + 1); } } } } namespace Hoverboard.TemplateUtils { public static class AssetBundleUtils { private static Core mod; private static MelonAssembly melonAssembly; private static Dictionary assetBundles = new Dictionary(); public static void Initialize(Core coreMod) { mod = coreMod; melonAssembly = ((MelonBase)mod).MelonAssembly; } public static AssetBundle LoadAssetBundle(string bundleFileName) { if (assetBundles.TryGetValue(bundleFileName, out var value) && (Object)(object)value != (Object)null) { return value; } try { string text = typeof(Core).Namespace + ".Assets." + bundleFileName; Stream manifestResourceStream = melonAssembly.Assembly.GetManifestResourceStream(text ?? ""); if (manifestResourceStream == null) { ((MelonBase)mod).Unregister("AssetBundle resource '" + text + "' not found.", false); return null; } byte[] array; using (manifestResourceStream) { using MemoryStream memoryStream = new MemoryStream(); manifestResourceStream.CopyTo(memoryStream); array = memoryStream.ToArray(); } if (array.Length == 0) { ((MelonBase)mod).Unregister("AssetBundle '" + bundleFileName + "' is empty.", false); return null; } AssetBundle val = AssetBundle.LoadFromMemory(array); if ((Object)(object)val == (Object)null) { ((MelonBase)mod).Unregister("Failed to load required AssetBundle '" + bundleFileName + "'.", false); return null; } assetBundles[bundleFileName] = val; return val; } catch (Exception arg) { ((MelonBase)mod).Unregister($"Failed to load required AssetBundle '{bundleFileName}': {arg}", false); return null; } } public static AssetBundle GetLoadedAssetBundle(string bundleName) { if (assetBundles.ContainsKey(bundleName)) { return assetBundles[bundleName]; } MelonLogger.Warning("Asset bundle '" + bundleName + "' is not loaded."); return null; } public static T LoadAssetFromBundle(string assetName, string bundleName) where T : Object { AssetBundle loadedAssetBundle = GetLoadedAssetBundle(bundleName); if ((Object)(object)loadedAssetBundle == (Object)null) { MelonLogger.Error("Couldn't find loaded bundle '" + bundleName + "'."); return default(T); } T val = default(T); try { val = loadedAssetBundle.LoadAsset(assetName); } catch (Exception arg) { MelonLogger.Error($"Failed loading asset '{assetName}' from bundle '{bundleName}'. The bundle may be invalid or have a zero internal pointer. {arg}"); return default(T); } if ((Object)(object)val == (Object)null) { MelonLogger.Error("Asset '" + assetName + "' not found in bundle '" + bundleName + "'."); return default(T); } return val; } } } namespace Hoverboard.Factory { public static class HoverboardFactory { public const string ITEM_ID = "hoverboard"; private const string ITEM_NAME = "Hoverboard"; private const string SOURCE_SKATEBOARD_ID = "goldenskateboard"; public static GameObject refStorage; public static GameObject hoverboardPrefab; public static GameObject visualPrefab; public static Skateboard hoverSkateboard; public static SkateboardVisuals hoverVisuals; public static SkateboardEffects hoverEffects; private static AvatarEquippable hoverAvatar; private static Skateboard_Equippable hoverEquippable; private static StoredItem hoverStored; private static SkateboardData hoverData; private static Sprite hoverIcon; public static MeshFilter hoverBoardFilter; public static MeshRenderer hoverBoardRenderer; public static AudioClip rollingAudio; private static Vector3? _trail0OriginalLocalPosition; private static Vector3? _trailMidpointLocalPosition; public static void Init() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown refStorage = new GameObject("HoverboardReferenceStorage"); refStorage.SetActive(false); Object.DontDestroyOnLoad((Object)(object)refStorage); try { LoadCustomAssets(); if ((Object)(object)hoverBoardFilter != (Object)null && (Object)(object)hoverBoardRenderer != (Object)null) { hoverSkateboard = CreateSkateboardPrefab(); if ((Object)(object)hoverSkateboard == (Object)null) { Utility.Error("Failed to create Skateboard prefab"); } hoverAvatar = CreateAvatarEquippablePrefab(); if ((Object)(object)hoverAvatar == (Object)null) { Utility.Error("Failed to create AvatarEquippable prefab"); } hoverEquippable = CreateEquippablePrefab(); if ((Object)(object)hoverEquippable == (Object)null) { Utility.Error("Failed to create Equippable prefab"); } hoverStored = CreateStoredPrefab(); if ((Object)(object)hoverStored == (Object)null) { Utility.Error("Failed to create Stored prefab"); } CreateVisualPrefab(); if ((Object)(object)hoverSkateboard != (Object)null && (Object)(object)hoverAvatar != (Object)null && (Object)(object)hoverEquippable != (Object)null && (Object)(object)hoverStored != (Object)null) { ((Equippable_Viewmodel)hoverEquippable).AvatarEquippable = hoverAvatar; hoverEquippable.SkateboardPrefab = hoverSkateboard; hoverSkateboard.Equippable = hoverEquippable; hoverSkateboard.SlowOnTerrain = false; SkateboardData val = Object.Instantiate(hoverSkateboard._defaultData, refStorage.transform); if ((Object)(object)val != (Object)null) { hoverData = val; hoverSkateboard._defaultData = val; } ApplyHoverSettings(); NeutralizeRainOverride(); SkateboardAudio componentInChildren = ((Component)hoverSkateboard).gameObject.GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null) { Transform obj = ((Component)componentInChildren).transform.Find("Audio Source (Skateboard rolling, FX)"); AudioSource val2 = ((obj != null) ? ((Component)obj).GetComponent() : null); Transform obj2 = ((Component)componentInChildren).transform.Find("Audio Source (Skateboard rolling, FX) (1)"); AudioSource val3 = ((obj2 != null) ? ((Component)obj2).GetComponent() : null); Transform obj3 = ((Component)componentInChildren).transform.Find("Audio Source (, FX)"); AudioSource val4 = ((obj3 != null) ? ((Component)obj3).GetComponent() : null); Transform obj4 = ((Component)componentInChildren).transform.Find("Audio Source (, FX)"); AudioSource val5 = ((obj4 != null) ? ((Component)obj4).GetComponent() : null); if ((Object)(object)componentInChildren.JumpAudio != (Object)null) { ((UnityEventBase)hoverSkateboard.OnJump).RemoveAllListeners(); AudioClip clip = ((Component)componentInChildren.JumpAudio).gameObject.GetComponent().clip; ((Component)componentInChildren.JumpAudio).gameObject.SetActive(false); if ((Object)(object)clip == (Object)null) { ((Component)componentInChildren.JumpAudio).gameObject.GetComponent().clip = null; } } if ((Object)(object)componentInChildren.LandAudio != (Object)null) { ((Component)componentInChildren.LandAudio).gameObject.SetActive(false); } if ((Object)(object)rollingAudio != (Object)null) { if ((Object)(object)val2 != (Object)null) { val2.clip = rollingAudio; } else { Utility.Error("Rolling FX is NULL"); } if ((Object)(object)val3 != (Object)null) { val3.clip = rollingAudio; Utility.Log("Dirt rolling audio clip assigned successfully"); } else { Utility.Error("audioController.DirtRollingAudio is NULL"); } } else { Utility.Error("rollingAudio clip is NULL"); } } else { Utility.Error("Audio controller is NULL"); } Utility.Log("11. Configuring Visuals"); SkateboardVisuals componentInChildren2 = ((Component)hoverSkateboard).gameObject.GetComponentInChildren(); if ((Object)(object)componentInChildren2 != (Object)null) { hoverVisuals = componentInChildren2; hoverVisuals.MaxBoardLean = HoverboardConfig.MaxBoardLean.Value; hoverVisuals.BoardLeanRate = HoverboardConfig.BoardLeanRate.Value; } Utility.Log("12. Configuring Effects"); SkateboardEffects componentInChildren3 = ((Component)hoverSkateboard).gameObject.GetComponentInChildren(); if ((Object)(object)componentInChildren3 != (Object)null) { hoverEffects = componentInChildren3; ApplyTrailSettings(); } Utility.Log("13. Creating Storable"); CreateStorableDefinition(); } else { Utility.Error("Failed to create one or more hoverboard prefabs - initialization incomplete"); } } else { if ((Object)(object)hoverBoardFilter == (Object)null) { Utility.Error("HoverBoardFilter is null - failed to load mesh"); } if ((Object)(object)hoverBoardRenderer == (Object)null) { Utility.Error("HoverBoardRenderer is null - failed to load renderer"); } Utility.Error("Initialization aborted due to missing mesh or renderer"); } } catch (Exception ex) { Utility.Error("=== CRITICAL ERROR during Hoverboard Factory Initialization ==="); Utility.Log(ex.ToString()); } } public static SkateboardSettings GetDefaultSettings() { if ((Object)(object)hoverSkateboard == (Object)null) { return null; } if (hoverSkateboard.DefaultSettings == null) { return null; } return hoverSkateboard.DefaultSettings; } public static void ApplyHoverSettings() { SkateboardSettings defaultSettings = GetDefaultSettings(); if (defaultSettings == null) { Utility.Error("ApplyHoverSettings: could not get default settings"); return; } defaultSettings.HoverHeight = HoverboardConfig.HoverHeight.Value; defaultSettings.TopSpeed_Kmh = HoverboardConfig.TopSpeed.Value; defaultSettings.HoverRayLength = HoverboardConfig.HoverHeight.Value + 0.05f; defaultSettings.Hover_P = HoverboardConfig.Proportional.Value; defaultSettings.Hover_I = HoverboardConfig.Integral.Value; defaultSettings.Hover_D = HoverboardConfig.Derivative.Value; RefreshActiveSettings(); Utility.Log($"ApplyHoverSettings: HoverHeight={defaultSettings.HoverHeight}, P={defaultSettings.Hover_P}, I={defaultSettings.Hover_I}, D={defaultSettings.Hover_D}"); } public static void RefreshActiveSettings() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown if (!((Object)(object)hoverSkateboard == (Object)null)) { hoverSkateboard.OnWeatherChange(new WeatherConditions()); } } private static void NeutralizeRainOverride() { //IL_0042: 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_004d: 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_0063: 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_0079: 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_008f: 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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: 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_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_014a: 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_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Expected O, but got Unknown if (!((Object)(object)hoverSkateboard == (Object)null)) { if ((Object)(object)hoverSkateboard._rainOverrideData == (Object)null) { Utility.Error("NeutralizeRainOverride: _rainOverrideData is null on hoverSkateboard - cannot neutralize rain override"); return; } SkateboardOverrideData val = ScriptableObject.CreateInstance(); val.Categories = (OverrideCategory)5; val.Settings = new SkateboardSettings { TurnForce = -1f, TurnChangeRate = -1f, TurnReturnToRestRate = -1f, TurnSpeedBoost = -1f, Gravity = -1f, BrakeForce = -1f, ReverseTopSpeed_Kmh = -1f, RotationClampForce = -1f, LongitudinalFrictionMultiplier = 0.8f, LateralFrictionForceMultiplier = 0.8f, JumpForce = -1f, JumpDuration_Min = -1f, JumpDuration_Max = -1f, JumpForwardBoost = -1f, HoverForce = -1f, HoverRayLength = -1f, HoverHeight = -1f, Hover_P = -1f, Hover_I = -1f, Hover_D = -1f, TopSpeed_Kmh = -1f, PushForceMultiplier = -1f, PushForceDuration = -1f, PushDelay = -1f, AirMovementForce = -1f, AirMovementJumpReductionDuration = -1f }; hoverSkateboard._rainOverrideData = val; Utility.Log("NeutralizeRainOverride: rain override replaced - hover fields protected"); } } public static void ApplyTrailSettings() { //IL_006c: 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_0080: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_029c: 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) if ((Object)(object)hoverEffects == (Object)null) { Utility.Error("ApplyTrailSettings: hoverEffects is null"); return; } TrailRenderer[] trails = hoverEffects.Trails; if (trails == null || trails.Length == 0) { Utility.Error("ApplyTrailSettings: no trails found on hoverEffects"); return; } if (!_trail0OriginalLocalPosition.HasValue) { _trail0OriginalLocalPosition = ((Component)trails[0]).transform.localPosition; Vector3 val = Vector3.zero; for (int i = 0; i < trails.Length; i++) { val += ((Component)trails[i]).transform.localPosition; } val /= (float)trails.Length; _trailMidpointLocalPosition = val; } int num = Mathf.Clamp(HoverboardConfig.TrailCount.Value, 0, trails.Length); float value = HoverboardConfig.TrailWidth.Value; float value2 = HoverboardConfig.TrailSpread.Value; switch (num) { case 0: { TrailRenderer[] array = trails; foreach (TrailRenderer val2 in array) { ((Component)val2).gameObject.SetActive(false); } return; } case 1: { ((Component)trails[0]).gameObject.SetActive(true); ((Component)trails[0]).transform.localPosition = _trailMidpointLocalPosition.Value; ApplyTrailAppearance(trails[0], value, HoverboardConfig.TrailColors[0].Value); for (int k = 1; k < trails.Length; k++) { ((Component)trails[k]).gameObject.SetActive(false); } return; } } float x = _trailMidpointLocalPosition.Value.x; float num2 = value2 / 2f; ((Component)trails[0]).gameObject.SetActive(true); ((Component)trails[0]).transform.localPosition = _trail0OriginalLocalPosition.Value; ApplyTrailAppearance(trails[0], value, HoverboardConfig.TrailColors[0].Value); if (trails.Length > 1) { ((Component)trails[1]).gameObject.SetActive(true); float num3 = _trail0OriginalLocalPosition.Value.x - x; Vector3 value3 = _trailMidpointLocalPosition.Value; value3.x = x - num3; ((Component)trails[0]).transform.localPosition = new Vector3(x - num2, _trail0OriginalLocalPosition.Value.y, _trail0OriginalLocalPosition.Value.z); ((Component)trails[1]).transform.localPosition = new Vector3(x + num2, value3.y, value3.z); ApplyTrailAppearance(trails[1], value, HoverboardConfig.TrailColors[1].Value); } } private static void ApplyTrailAppearance(TrailRenderer trail, float width, Color color) { //IL_0016: 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) //IL_0028: 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_0035: 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_0047: 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_0058: Unknown result type (might be due to invalid IL or missing references) trail.startWidth = width; trail.endWidth = 0f; float a = trail.startColor.a; trail.startColor = new Color(color.r, color.g, color.b, a); trail.endColor = new Color(color.r, color.g, color.b, 0f); } public static void LoadCustomAssets() { AssetBundle val = AssetBundleUtils.LoadAssetBundle("hoverboard"); if ((Object)(object)val == (Object)null) { Utility.Error("LoadCustomAssets: failed to load 'hoverboard' asset bundle."); return; } GameObject val2 = AssetBundleUtils.LoadAssetFromBundle("hoverboard.prefab", "hoverboard"); if ((Object)(object)val2 != (Object)null && (Object)(object)hoverboardPrefab == (Object)null) { hoverboardPrefab = Object.Instantiate(val2, refStorage.transform); Object.DontDestroyOnLoad((Object)(object)hoverboardPrefab); Sprite val3 = AssetBundleUtils.LoadAssetFromBundle("hoverboardvisual_icon.png", "hoverboard"); if ((Object)(object)val3 != (Object)null) { hoverIcon = val3; Object.DontDestroyOnLoad((Object)(object)hoverIcon); } else { Utility.Error("Failed to load icon sprite - icon will be missing"); } AudioClip val4 = AssetBundleUtils.LoadAssetFromBundle("hoverloop1.mp3", "hoverboard"); if ((Object)(object)val4 != (Object)null) { rollingAudio = val4; Object.DontDestroyOnLoad((Object)(object)rollingAudio); } else { Utility.Error("Failed to load jump audio 1 clip - jump sound will be missing"); } MeshFilter component = hoverboardPrefab.GetComponent(); if ((Object)(object)component != (Object)null) { hoverBoardFilter = component; } else { Utility.Error("MeshFilter component not found on hoverboard prefab"); } MeshRenderer component2 = hoverboardPrefab.GetComponent(); if ((Object)(object)component2 != (Object)null) { hoverBoardRenderer = component2; } else { Utility.Error("MeshRenderer component not found on hoverboard prefab"); } } else if ((Object)(object)val2 == (Object)null) { Utility.Error("Failed to load hoverboard prefab from asset bundle - asset is null"); } else if ((Object)(object)hoverboardPrefab != (Object)null) { Utility.Error("Hoverboard prefab already exists - skipping instantiation"); } } private static void HideTrucks(Transform prefab, string path) { Transform val = prefab.Find(path); if ((Object)(object)val == (Object)null) { return; } if ((Object)(object)val != (Object)null) { Transform val2 = val.Find("Truck"); if ((Object)(object)val2 != (Object)null) { ((Component)val2).gameObject.SetActive(false); } else { Utility.Error("Truck (1) not found in BoardContainer"); } Transform val3 = val.Find("Truck (1)"); if ((Object)(object)val3 != (Object)null) { ((Component)val3).gameObject.SetActive(false); } else { Utility.Error("Truck (2) not found in BoardContainer"); } } else { Utility.Error("BoardContainer not found - unable to hide trucks"); } } public static Skateboard CreateSkateboardPrefab() { GameObject val = Resources.Load("skateboards/goldenskateboard/GoldSkateboard"); GameObject val2 = Object.Instantiate(val, refStorage.transform); ((Object)val2).name = "Hoverboard"; HideTrucks(val2.transform, "Model/Skateboard"); Transform val3 = val2.transform.Find("Model/Skateboard/BoardContainer/Board"); if ((Object)(object)val3 != (Object)null) { ((Component)val3).GetComponent().mesh = hoverBoardFilter.mesh; ((Renderer)((Component)val3).GetComponent()).materials = ((Renderer)hoverBoardRenderer).materials; Transform val4 = val3.Find("BoardModel"); if ((Object)(object)val4 != (Object)null) { ((Component)val4).GetComponent().mesh = hoverBoardFilter.mesh; ((Renderer)((Component)val4).GetComponent()).materials = ((Renderer)hoverBoardRenderer).materials; Transform val5 = val4.Find("GoldSkateboardVisual/GoldSkateboard/BoardContainer/Board"); if ((Object)(object)val5 != (Object)null) { ((Component)val5).GetComponent().mesh = hoverBoardFilter.mesh; ((Renderer)((Component)val5).GetComponent()).materials = ((Renderer)hoverBoardRenderer).materials; } } return val2.GetComponent(); } return null; } public static AvatarEquippable CreateAvatarEquippablePrefab() { GameObject val = Resources.Load("skateboards/goldenskateboard/GoldSkateboard_AvatarEquippable"); GameObject val2 = Object.Instantiate(val, refStorage.transform); ((Object)val2).name = "Hoverboard_AvatarEquippable"; HideTrucks(val2.transform, "GoldSkateboardVisual/GoldSkateboard"); Transform val3 = val2.transform.Find("GoldSkateboardVisual/GoldSkateboard/BoardContainer/Board"); if ((Object)(object)val3 != (Object)null) { ((Component)val3).GetComponent().mesh = hoverBoardFilter.mesh; ((Renderer)((Component)val3).GetComponent()).materials = ((Renderer)hoverBoardRenderer).materials; return val2.GetComponent(); } return null; } public static Skateboard_Equippable CreateEquippablePrefab() { GameObject val = Resources.Load("skateboards/goldenskateboard/GoldSkateboard_Equippable"); GameObject val2 = Object.Instantiate(val, refStorage.transform); ((Object)val2).name = "Hoverboard_Equippable"; Skateboard_Equippable component = val2.GetComponent(); HideTrucks(val2.transform, "GoldSkateboardVisual/GoldSkateboard"); component.SkateboardPrefab = null; Transform val3 = val2.transform.Find("GoldSkateboardVisual/GoldSkateboard/BoardContainer/Board"); if ((Object)(object)val3 != (Object)null) { ((Component)val3).GetComponent().mesh = hoverBoardFilter.mesh; ((Renderer)((Component)val3).GetComponent()).materials = ((Renderer)hoverBoardRenderer).materials; return component; } return null; } public static StoredItem CreateStoredPrefab() { GameObject val = Resources.Load("skateboards/goldenskateboard/GoldSkateboard_Stored"); GameObject val2 = Object.Instantiate(val, refStorage.transform); ((Object)val2).name = "Hoverboard_Stored"; HideTrucks(val2.transform, "GoldSkateboardVisual/GoldSkateboard"); Transform val3 = val2.transform.Find("GoldSkateboardVisual/GoldSkateboard/BoardContainer/Board"); if ((Object)(object)val3 != (Object)null) { ((Component)val3).GetComponent().mesh = hoverBoardFilter.mesh; ((Renderer)((Component)val3).GetComponent()).materials = ((Renderer)hoverBoardRenderer).materials; return val2.GetComponent(); } return null; } public static StorableItemDefinition CreateStorableDefinition() { //IL_011b: 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) if (Registry.ItemExists("hoverboard")) { ItemDefinition item = Registry.GetItem("hoverboard"); return (StorableItemDefinition)(object)((item is StorableItemDefinition) ? item : null); } ItemDefinition item2 = Registry.GetItem("goldenskateboard"); if ((Object)(object)item2 == (Object)null) { Utility.Error("CreateStorableDefinition: source item 'goldenskateboard' not found in Registry. Registration likely ran too early or source ID changed."); return null; } StorableItemDefinition val = (StorableItemDefinition)(object)((item2 is StorableItemDefinition) ? item2 : null); if ((Object)(object)val == (Object)null) { Utility.Error("CreateStorableDefinition: source item 'goldenskateboard' is not a StorableItemDefinition."); return null; } if ((Object)(object)hoverEquippable == (Object)null || (Object)(object)hoverStored == (Object)null) { Utility.Error("CreateStorableDefinition: hover prefabs are not ready (Equippable or StoredItem is null)."); return null; } StorableItemDefinition val2 = Object.Instantiate(val); if ((Object)(object)val2 != (Object)null) { ((BaseItemDefinition)val2).ID = "hoverboard"; ((Object)val2).name = "Hoverboard"; ((BaseItemDefinition)val2).Name = "Hoverboard"; ((BaseItemDefinition)val2).Description = "A futuristic skateboard that hovers above the ground."; ((BaseItemDefinition)val2).StackLimit = 1; ((ItemDefinition)val2).Equippable = (Equippable)(object)hoverEquippable; val2.StoredItem = hoverStored; ((BaseItemDefinition)val2).legalStatus = (ELegalStatus)0; ((BaseItemDefinition)val2).Category = (EItemCategory)3; ((ItemDefinition)val2).AvailableInDemo = true; val2.BasePurchasePrice = HoverboardConfig.Price.Value; val2.ResellMultiplier = HoverboardConfig.ResellMultiplier.Value; if ((Object)(object)hoverIcon != (Object)null) { ((BaseItemDefinition)val2).Icon = hoverIcon; } Singleton.Instance.AddToRegistry((ItemDefinition)(object)val2); Utility.Success("CreateStorableDefinition: registered item 'hoverboard'."); return val2; } Utility.Error("CreateStorableDefinition: failed to instantiate hoverboard definition clone."); return null; } public static bool EnsureStorableDefinitionRegistered() { if (Registry.ItemExists("hoverboard")) { return true; } return (Object)(object)CreateStorableDefinition() != (Object)null; } public static void CreateVisualPrefab() { GameObject val = Resources.Load("skateboards/goldenskateboard/GoldSkateboardVisual"); visualPrefab = Object.Instantiate(val, refStorage.transform); ((Object)visualPrefab).name = "Hoverboard_Visuals"; Transform val2 = visualPrefab.transform.Find("GoldSkateboard/BoardContainer/Board"); if ((Object)(object)val2 != (Object)null) { ((Component)val2).GetComponent().mesh = hoverBoardFilter.mesh; ((Renderer)((Component)val2).GetComponent()).materials = ((Renderer)hoverBoardRenderer).materials; } } public static void Reset() { refStorage = null; visualPrefab = null; hoverboardPrefab = null; hoverSkateboard = null; hoverVisuals = null; hoverEffects = null; hoverAvatar = null; hoverEquippable = null; hoverStored = null; _trail0OriginalLocalPosition = null; _trailMidpointLocalPosition = null; Utility.Log("HoverboardFactory.Reset: scene state cleared"); } } } namespace Hoverboard.Config { public static class HoverboardConfig { private static MelonPreferences_Category _category; public static MelonPreferences_Entry Price; public static MelonPreferences_Entry ResellMultiplier; public static MelonPreferences_Entry HoverHeight; public static MelonPreferences_Entry TopSpeed; public static MelonPreferences_Entry Proportional; public static MelonPreferences_Entry Integral; public static MelonPreferences_Entry Derivative; public static MelonPreferences_Entry MaxBoardLean; public static MelonPreferences_Entry BoardLeanRate; public static MelonPreferences_Entry TrailCount; public static MelonPreferences_Entry TrailWidth; public static MelonPreferences_Entry TrailSpread; public static MelonPreferences_Entry[] TrailColors; private const int MaxTrails = 2; public static void Initialize() { //IL_03a2: Unknown result type (might be due to invalid IL or missing references) //IL_03a7: Unknown result type (might be due to invalid IL or missing references) //IL_03ae: Unknown result type (might be due to invalid IL or missing references) //IL_03b3: Unknown result type (might be due to invalid IL or missing references) //IL_03ea: Unknown result type (might be due to invalid IL or missing references) _category = MelonPreferences.CreateCategory("Hoverboard"); Price = _category.CreateEntry("Price", 2000f, "(Requires Save Reload) The price of the hoverboard in the in-game shop.\nDefault: 2000", (string)null, false, false, (ValueValidator)null, (string)null); ResellMultiplier = _category.CreateEntry("Resell Multiplier", 0.6f, "(Requires Save Reload) The resell price multiplier.\nDefault: 0.6", (string)null, false, false, (ValueValidator)null, (string)null); HoverHeight = _category.CreateEntry("Hover Height", 2f, "The height at which the hoverboard hovers above the ground.\nDefault: 2", (string)null, false, false, (ValueValidator)null, (string)null); ((MelonEventBase>)(object)HoverHeight.OnEntryValueChanged).Subscribe((LemonAction)delegate(float oldValue, float newValue) { SkateboardSettings defaultSettings5 = HoverboardFactory.GetDefaultSettings(); if (defaultSettings5 != null) { defaultSettings5.HoverHeight = newValue; defaultSettings5.HoverRayLength = newValue + 0.05f; HoverboardFactory.RefreshActiveSettings(); } }, 0, false); TopSpeed = _category.CreateEntry("Top Speed", 32f, "The maximum speed of the hoverboard.\nDefault: 32", (string)null, false, false, (ValueValidator)null, (string)null); ((MelonEventBase>)(object)TopSpeed.OnEntryValueChanged).Subscribe((LemonAction)delegate(float oldValue, float newValue) { SkateboardSettings defaultSettings4 = HoverboardFactory.GetDefaultSettings(); if (defaultSettings4 != null) { defaultSettings4.TopSpeed_Kmh = newValue; HoverboardFactory.RefreshActiveSettings(); } }, 0, false); MaxBoardLean = _category.CreateEntry("Max Board Lean", 8f, "The maximum angle the board leans when turning.\nDefault: 8", (string)null, false, false, (ValueValidator)null, (string)null); ((MelonEventBase>)(object)MaxBoardLean.OnEntryValueChanged).Subscribe((LemonAction)delegate(float oldValue, float newValue) { if ((Object)(object)HoverboardFactory.hoverVisuals != (Object)null) { HoverboardFactory.hoverVisuals.MaxBoardLean = newValue; } }, 0, false); BoardLeanRate = _category.CreateEntry("Board Lean Rate", 2f, "How quickly the board leans when turning.\nDefault: 2", (string)null, false, false, (ValueValidator)null, (string)null); ((MelonEventBase>)(object)BoardLeanRate.OnEntryValueChanged).Subscribe((LemonAction)delegate(float oldValue, float newValue) { if ((Object)(object)HoverboardFactory.hoverVisuals != (Object)null) { HoverboardFactory.hoverVisuals.BoardLeanRate = newValue; } }, 0, false); Proportional = _category.CreateEntry("Proportional", 2.7f, "How strongly the board reacts to height errors.\nHigher = Snappier response | Lower = Sluggish response\nDefault: 2.7", (string)null, false, false, (ValueValidator)null, (string)null); ((MelonEventBase>)(object)Proportional.OnEntryValueChanged).Subscribe((LemonAction)delegate(float oldValue, float newValue) { SkateboardSettings defaultSettings3 = HoverboardFactory.GetDefaultSettings(); if (defaultSettings3 != null) { defaultSettings3.Hover_P = newValue; HoverboardFactory.RefreshActiveSettings(); } }, 0, false); Integral = _category.CreateEntry("Integral", 0.1f, "How much the board corrects over time to reach exact height.\nHigher = Rigid, locked height | Lower = Floaty, drifty feel\nDefault: 0.1", (string)null, false, false, (ValueValidator)null, (string)null); ((MelonEventBase>)(object)Integral.OnEntryValueChanged).Subscribe((LemonAction)delegate(float oldValue, float newValue) { SkateboardSettings defaultSettings2 = HoverboardFactory.GetDefaultSettings(); if (defaultSettings2 != null) { defaultSettings2.Hover_I = newValue; HoverboardFactory.RefreshActiveSettings(); } }, 0, false); Derivative = _category.CreateEntry("Derivative", 0.5f, "How much the board resists sudden height changes.\nHigher = Smooth over bumps, less bounce | Lower = Bouncy, reactive\nDefault: 0.5", (string)null, false, false, (ValueValidator)null, (string)null); ((MelonEventBase>)(object)Derivative.OnEntryValueChanged).Subscribe((LemonAction)delegate(float oldValue, float newValue) { SkateboardSettings defaultSettings = HoverboardFactory.GetDefaultSettings(); if (defaultSettings != null) { defaultSettings.Hover_D = newValue; HoverboardFactory.RefreshActiveSettings(); } }, 0, false); TrailCount = _category.CreateEntry("Trail Count", 2, "Number of active trails. 0 = none, 2 = max", (string)null, false, false, (ValueValidator)null, (string)null); ((MelonEventBase>)(object)TrailCount.OnEntryValueChanged).Subscribe((LemonAction)delegate { HoverboardFactory.ApplyTrailSettings(); }, 0, false); TrailWidth = _category.CreateEntry("Trail Width", 0.05f, "Width of each trail renderer.\n Default: 0.05", (string)null, false, false, (ValueValidator)null, (string)null); ((MelonEventBase>)(object)TrailWidth.OnEntryValueChanged).Subscribe((LemonAction)delegate { HoverboardFactory.ApplyTrailSettings(); }, 0, false); TrailSpread = _category.CreateEntry("Trail Spread", 0.15f, "Lateral spacing between trails when using multiple.\n0 = stacked on centre, higher = further apart.\n Default: 0.15", (string)null, false, false, (ValueValidator)null, (string)null); ((MelonEventBase>)(object)TrailSpread.OnEntryValueChanged).Subscribe((LemonAction)delegate { HoverboardFactory.ApplyTrailSettings(); }, 0, false); Color[] array = (Color[])(object)new Color[2] { Color.white, Color.white }; TrailColors = new MelonPreferences_Entry[2]; for (int i = 0; i < 2; i++) { int num = i; TrailColors[i] = _category.CreateEntry($"Trail {i + 1} Color", array[i], $"Color for trail {i + 1}.", (string)null, false, false, (ValueValidator)null, (string)null); ((MelonEventBase>)(object)TrailColors[i].OnEntryValueChanged).Subscribe((LemonAction)delegate { HoverboardFactory.ApplyTrailSettings(); }, 0, false); } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { internal IgnoresAccessChecksToAttribute(string assemblyName) { } } }