Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of LethalBikesAndCarts v1.0.0
plugins/LethalBikesAndCarts/LethalBikesAndCarts.dll
Decompiled 2 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalBikesAndCarts.NetcodePatcher; using LethalLib.Modules; using Microsoft.CodeAnalysis; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.Audio; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.Rendering; using UnityEngine.Rendering.HighDefinition; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("LethalBikesAndCarts")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("LethalBikesAndCarts")] [assembly: AssemblyTitle("LethalBikesAndCarts")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace LethalBikesAndCarts { internal static class Borrowed { private static bool itemsDone; private static VehicleController? cruiser; private static Sprite? anyHoverIcon; public static AudioClip? SpraySound { get; private set; } public static AudioClip[]? ShakeSounds { get; private set; } public static AudioMixerGroup? EffectsMixer { get { VehicleController? obj = FindCruiser(); if (obj == null) { return null; } AudioSource miscAudio = obj.miscAudio; if (miscAudio == null) { return null; } return miscAudio.outputAudioMixerGroup; } } public static AudioClip[]? LightCollisions => FindCruiser()?.minCollisions; public static AudioClip[]? MediumCollisions => FindCruiser()?.medCollisions; public static AudioClip[]? HeavyCollisions => FindCruiser()?.maxCollisions; public static AudioClip[]? GearSounds => FindCruiser()?.gearStickAudios; public static AudioSource? Horn => FindCruiser()?.hornAudio; public static AudioClip? HeadlightSwitch => FindCruiser()?.headlightsToggleSFX; public static Material? HeadlightOn => FindCruiser()?.headlightsOnMat; public static GameObject? CruiserExplosion => FindCruiser()?.truckDestroyedExplosion; public static AudioClip? Beep { get { HUDManager instance = HUDManager.Instance; if (!((Object)(object)instance != (Object)null) || instance.warningSFX == null || instance.warningSFX.Length == 0) { return null; } return instance.warningSFX[0]; } } private static VehicleController? FindCruiser() { if ((Object)(object)cruiser != (Object)null) { return cruiser; } Terminal val = Object.FindObjectOfType<Terminal>(); if ((Object)(object)val == (Object)null || val.buyableVehicles == null) { return null; } BuyableVehicle[] buyableVehicles = val.buyableVehicles; foreach (BuyableVehicle val2 in buyableVehicles) { if (val2 != null && !((Object)(object)val2.vehiclePrefab == (Object)null)) { VehicleController component = val2.vehiclePrefab.GetComponent<VehicleController>(); if ((Object)(object)component != (Object)null && (Object)(object)component.driverSeatTrigger != (Object)null) { cruiser = component; break; } } } return cruiser; } private static Sprite? FindAnyHoverIcon() { if ((Object)(object)anyHoverIcon != (Object)null) { return anyHoverIcon; } InteractTrigger[] array = Object.FindObjectsOfType<InteractTrigger>(); foreach (InteractTrigger val in array) { if ((Object)(object)val.hoverIcon != (Object)null) { anyHoverIcon = val.hoverIcon; break; } } return anyHoverIcon; } public static void ApplyToSeat(InteractTrigger seat, bool driver) { VehicleController val = FindCruiser(); InteractTrigger val2 = (((Object)(object)val == (Object)null) ? null : (driver ? val.driverSeatTrigger : val.passengerSeatTrigger)); if ((Object)(object)val2 != (Object)null) { seat.animationString = val2.animationString; seat.stopAnimationString = val2.stopAnimationString; seat.animationWaitTime = val2.animationWaitTime; seat.hoverIcon = val2.hoverIcon; seat.disabledHoverIcon = (((Object)(object)val2.disabledHoverIcon != (Object)null) ? val2.disabledHoverIcon : val2.hoverIcon); seat.clampLooking = val2.clampLooking; seat.minVerticalClamp = val2.minVerticalClamp; seat.maxVerticalClamp = val2.maxVerticalClamp; seat.horizontalClamp = val2.horizontalClamp; Plugin.Log(string.Format("Seat ({0}) copies the Cruiser: animation '{1}', stop '{2}', clamp {3}", driver ? "driver" : "passenger", val2.animationString, val2.stopAnimationString, val2.clampLooking)); } else { Plugin.Logger.LogWarning((object)"Cruiser seat not found; seats use default animation values."); ApplyToPlainTrigger(seat); } } public static void ApplyToPlainTrigger(InteractTrigger trigger) { if (!((Object)(object)trigger.hoverIcon != (Object)null)) { VehicleController val = FindCruiser(); Sprite val2 = (((Object)(object)val != (Object)null && (Object)(object)val.driverSeatTrigger != (Object)null) ? val.driverSeatTrigger.hoverIcon : null); if ((Object)(object)val2 == (Object)null) { val2 = FindAnyHoverIcon(); } trigger.hoverIcon = val2; if ((Object)(object)trigger.disabledHoverIcon == (Object)null) { trigger.disabledHoverIcon = val2; } } } public static (TMP_FontAsset? font, Material? material) ScreenFont() { StartOfRound instance = StartOfRound.Instance; TextMeshProUGUI[] array = (TextMeshProUGUI[])(object)new TextMeshProUGUI[2] { ((Object)(object)instance != (Object)null) ? instance.profitQuotaMonitorText : null, ((Object)(object)instance != (Object)null) ? instance.deadlineMonitorText : null }; foreach (TextMeshProUGUI val in array) { if ((Object)(object)val != (Object)null && (Object)(object)((TMP_Text)val).font != (Object)null) { return (font: ((TMP_Text)val).font, material: ((TMP_Text)val).fontSharedMaterial); } } HUDManager instance2 = HUDManager.Instance; TextMeshProUGUI val2 = (((Object)(object)instance2 != (Object)null && instance2.controlTipLines != null && instance2.controlTipLines.Length != 0) ? instance2.controlTipLines[0] : null); if ((Object)(object)val2 != (Object)null && (Object)(object)((TMP_Text)val2).font != (Object)null) { return (font: ((TMP_Text)val2).font, material: ((TMP_Asset)((TMP_Text)val2).font).material); } return (font: null, material: null); } public static (Light? wide, Light? narrow) HeadlightTemplates() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) GameObject val = FindCruiser()?.headlightsContainer; Light val2 = null; Light val3 = null; if ((Object)(object)val == (Object)null) { return (wide: null, narrow: null); } Light[] componentsInChildren = val.GetComponentsInChildren<Light>(true); foreach (Light val4 in componentsInChildren) { if ((int)val4.type != 0) { continue; } if (val4.spotAngle >= 60f) { if ((Object)(object)val2 == (Object)null) { val2 = val4; } } else if ((Object)(object)val3 == (Object)null) { val3 = val4; } } return (wide: val2, narrow: val3); } public static GameObject? MakeFire(Transform parent) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) ParticleSystem val = FindCruiser()?.hoodFireParticle; if ((Object)(object)val == (Object)null) { return null; } GameObject val2 = Object.Instantiate<GameObject>(((Component)val).gameObject, parent, false); ((Object)val2).name = "LethalBikesAndCartsFire"; val2.transform.localPosition = Vector3.zero; val2.transform.localRotation = Quaternion.identity; ParticleSystem[] componentsInChildren = val2.GetComponentsInChildren<ParticleSystem>(true); foreach (ParticleSystem val3 in componentsInChildren) { val3.Stop(true, (ParticleSystemStopBehavior)0); } AudioSource val4 = val2.GetComponentInChildren<AudioSource>(true); AudioSource val5 = FindCruiser()?.hoodFireAudio; if ((Object)(object)val4 == (Object)null && (Object)(object)val5 != (Object)null && (Object)(object)val5.clip != (Object)null) { val4 = val2.AddComponent<AudioSource>(); val4.clip = val5.clip; val4.volume = val5.volume; val4.spatialBlend = 1f; val4.rolloffMode = val5.rolloffMode; val4.minDistance = val5.minDistance; val4.maxDistance = val5.maxDistance; val4.outputAudioMixerGroup = val5.outputAudioMixerGroup; } if ((Object)(object)val4 != (Object)null) { val4.loop = true; val4.playOnAwake = false; val4.Stop(); } val2.SetActive(true); return val2; } public static void ApplyToItems(StartOfRound round) { if (itemsDone || (Object)(object)round.allItemsList == (Object)null) { return; } Item val = null; foreach (Item items in round.allItemsList.itemsList) { if ((Object)(object)items == (Object)null) { continue; } if (items.itemName == "Key") { val = items; } if ((Object)(object)SpraySound == (Object)null && (Object)(object)items.spawnPrefab != (Object)null) { SprayPaintItem component = items.spawnPrefab.GetComponent<SprayPaintItem>(); if ((Object)(object)component != (Object)null && (Object)(object)component.spraySFX != (Object)null) { SpraySound = component.spraySFX; ShakeSounds = component.sprayCanShakeSFX; } } } if ((Object)(object)SpraySound == (Object)null) { Plugin.Logger.LogWarning((object)"Spray paint item not found; painting is silent."); } if ((Object)(object)val == (Object)null) { Plugin.Logger.LogWarning((object)"Vanilla key item not found; our items keep no icon."); return; } foreach (Item ourItem in Plugin.OurItems) { if ((Object)(object)ourItem.itemIcon == (Object)null) { ourItem.itemIcon = val.itemIcon; } if ((Object)(object)ourItem.grabSFX == (Object)null) { ourItem.grabSFX = val.grabSFX; } if ((Object)(object)ourItem.dropSFX == (Object)null) { ourItem.dropSFX = val.dropSFX; } if ((Object)(object)ourItem.pocketSFX == (Object)null) { ourItem.pocketSFX = val.pocketSFX; } } itemsDone = true; } } public class PluginConfig { public readonly ConfigEntry<int> MotorbikePrice; public readonly ConfigEntry<int> GolfCartPrice; public readonly ConfigEntry<int> ChainsPrice; public readonly ConfigEntry<int> PaintCanPrice; public readonly ConfigEntry<int> DetonatorPrice; public readonly ConfigEntry<string> MotorbikeGearSpeeds; public readonly ConfigEntry<string> MotorbikeGearAccelerations; public readonly ConfigEntry<string> MotorbikeGearSlopes; public readonly ConfigEntry<string> GolfCartGearSpeeds; public readonly ConfigEntry<string> GolfCartGearAccelerations; public readonly ConfigEntry<string> GolfCartGearSlopes; public static readonly float[] MotorbikeAccelerationDefaults = new float[3] { 20f, 13f, 8f }; public static readonly float[] GolfCartAccelerationDefaults = new float[3] { 18f, 12f, 7.5f }; public static readonly float[] MotorbikeSlopeDefaults = new float[3] { 60f, 38f, 24f }; public static readonly float[] GolfCartSlopeDefaults = new float[3] { 58f, 36f, 22f }; public readonly ConfigEntry<int> MotorbikeHealth; public readonly ConfigEntry<int> GolfCartHealth; public readonly ConfigEntry<float> ChainLength; public readonly ConfigEntry<float> SeatHeightOffset; public readonly KeyBinding ShiftUp; public readonly KeyBinding ShiftDown; public readonly KeyBinding LowBeams; public readonly KeyBinding HighBeams; public readonly KeyBinding Horn; public PluginConfig(ConfigFile cfg) { MotorbikePrice = cfg.Bind<int>("Store", "Motorbike keys price", 275, "Credits the motorbike keys cost."); GolfCartPrice = cfg.Bind<int>("Store", "Golf cart keys price", 400, "Credits the golf cart keys cost."); ChainsPrice = cfg.Bind<int>("Store", "Tow chains price", 200, "Credits the golf cart's tow chains cost. One set stays on the cart for good."); PaintCanPrice = cfg.Bind<int>("Store", "Cart and bike paint price", 100, "Credits the can of cart and bike paint costs. It never runs out."); DetonatorPrice = cfg.Bind<int>("Store", "Remote detonator price", 60, "Credits the remote detonator costs."); MotorbikeGearSpeeds = cfg.Bind<string>("Motorbike", "Top speed per gear in kmh", "40,80,120", "Top speed of 1st, 2nd and 3rd gear in km/h, separated by commas."); MotorbikeGearAccelerations = cfg.Bind<string>("Motorbike", "Acceleration per gear in ms2", Join(MotorbikeAccelerationDefaults), "Acceleration of 1st, 2nd and 3rd gear on flat ground in metres per second squared, separated by commas. 1st pulls hardest; 3rd pulls least. Reverse pulls like 1st gear."); MotorbikeGearSlopes = cfg.Bind<string>("Motorbike", "Steepest slope per gear in degrees", Join(MotorbikeSlopeDefaults), "Steepest slope, in degrees, that 1st, 2nd and 3rd gear can still climb, separated by commas. On anything steeper the vehicle slides back. Reverse climbs like 1st gear. At most 75."); GolfCartGearSpeeds = cfg.Bind<string>("Golf cart", "Top speed per gear in kmh", "40,80,120", "Top speed of 1st, 2nd and 3rd gear in km/h, separated by commas."); GolfCartGearAccelerations = cfg.Bind<string>("Golf cart", "Acceleration per gear in ms2", Join(GolfCartAccelerationDefaults), "Acceleration of 1st, 2nd and 3rd gear on flat ground in metres per second squared, separated by commas. 1st pulls hardest; 3rd pulls least. Reverse pulls like 1st gear."); GolfCartGearSlopes = cfg.Bind<string>("Golf cart", "Steepest slope per gear in degrees", Join(GolfCartSlopeDefaults), "Steepest slope, in degrees, that 1st, 2nd and 3rd gear can still climb, separated by commas. On anything steeper the vehicle slides back. Reverse climbs like 1st gear. At most 75."); MotorbikeHealth = cfg.Bind<int>("Damage", "Motorbike health", 12, "How much damage the motorbike takes before it catches fire and explodes. A hard crash takes 2 to 6; a fall from about 30 m wrecks it at once. Damage stays with the keys until the end of the day: putting the vehicle away does not repair it."); GolfCartHealth = cfg.Bind<int>("Damage", "Golf cart health", 16, "Same for the golf cart."); ChainLength = cfg.Bind<float>("Golf cart", "Chain length", 3f, "Longest distance in metres between the cart and a towed item."); SeatHeightOffset = cfg.Bind<float>("Seats", "Seat height offset", 0f, "Raises (positive) or lowers (negative) seated players, in metres, if they sink into the seat or float above it."); ShiftUp = new KeyBinding(cfg.Bind<string>("Controls", "Shift up", "UpArrow", "Driver: next gear. A key name from Unity's Input System, for example UpArrow, M, F5, Numpad8 or LeftBracket."), (Key)63); ShiftDown = new KeyBinding(cfg.Bind<string>("Controls", "Shift down", "DownArrow", "Driver: previous gear. A key name from Unity's Input System, for example UpArrow, M, F5, Numpad8 or LeftBracket."), (Key)64); LowBeams = new KeyBinding(cfg.Bind<string>("Controls", "Low beams", "LeftArrow", "Driver: low beams on or off. A key name from Unity's Input System, for example UpArrow, M, F5, Numpad8 or LeftBracket."), (Key)61); HighBeams = new KeyBinding(cfg.Bind<string>("Controls", "High beams", "RightArrow", "Driver: high beams on or off. A key name from Unity's Input System, for example UpArrow, M, F5, Numpad8 or LeftBracket."), (Key)62); Horn = new KeyBinding(cfg.Bind<string>("Controls", "Horn", "H", "Driver: hold to sound the horn. A key name from Unity's Input System, for example UpArrow, M, F5, Numpad8 or LeftBracket."), (Key)22); ReplaceOldDefault<int>(MotorbikePrice, 200); ReplaceOldDefault<int>(GolfCartPrice, 350); ReplaceOldDefault<int>(ChainsPrice, 100); ReplaceOldDefault<int>(PaintCanPrice, 60); ReplaceOldDefault<int>(DetonatorPrice, 80); ReplaceOldDefault<string>(MotorbikeGearAccelerations, "16,10,6"); ReplaceOldDefault<string>(GolfCartGearAccelerations, "14,9,5.5"); DropOldEntries(cfg); } private static string Join(float[] values) { string[] array = new string[values.Length]; for (int i = 0; i < values.Length; i++) { array[i] = values[i].ToString(CultureInfo.InvariantCulture); } return string.Join(",", array); } private static void ReplaceOldDefault<T>(ConfigEntry<T> entry, params T[] oldDefaults) { foreach (T val in oldDefaults) { if (object.Equals(entry.Value, val)) { entry.Value = (T)((ConfigEntryBase)entry).DefaultValue; break; } } } private static void DropOldEntries(ConfigFile cfg) { try { if (typeof(ConfigFile).GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(cfg) is Dictionary<ConfigDefinition, string> { Count: >0 } dictionary) { dictionary.Clear(); cfg.Save(); } } catch (Exception ex) { Plugin.Logger.LogWarning((object)("Could not tidy old settings out of the config file: " + ex.Message)); } } public static float[] ParseFloats(string text, float[] fallback) { string[] array = text.Split(','); if (array.Length != fallback.Length) { Plugin.Logger.LogWarning((object)$"Expected {fallback.Length} numbers separated by commas in '{text}'; using the defaults."); return fallback; } float[] array2 = new float[array.Length]; for (int i = 0; i < array.Length; i++) { if (!float.TryParse(array[i].Trim(), NumberStyles.Float, CultureInfo.InvariantCulture, out array2[i])) { Plugin.Logger.LogWarning((object)("'" + array[i].Trim() + "' in '" + text + "' is not a number; using the defaults.")); return fallback; } array2[i] = Mathf.Max(0.5f, array2[i]); } return array2; } } public sealed class KeyBinding { private readonly ConfigEntry<string> entry; private readonly Key fallback; private string parsedText = "\0"; private Key key; public Key Key { get { //IL_008c: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) if (entry.Value != parsedText) { parsedText = entry.Value; if (!Enum.TryParse<Key>(parsedText.Trim(), ignoreCase: true, out key) || (int)key == 0) { Plugin.Logger.LogWarning((object)$"Unknown key '{parsedText}' for '{((ConfigEntryBase)entry).Definition.Key}'; using {fallback}."); key = fallback; } } return key; } } private KeyControl? Control { get { //IL_000b: Unknown result type (might be due to invalid IL or missing references) Keyboard current = Keyboard.current; if (current != null) { return current[Key]; } return null; } } public bool WasPressed { get { KeyControl? control = Control; if (control == null) { return false; } return ((ButtonControl)control).wasPressedThisFrame; } } public bool IsHeld { get { KeyControl? control = Control; if (control == null) { return false; } return ((ButtonControl)control).isPressed; } } public string Label => "[" + Name(Key) + "]"; public KeyBinding(ConfigEntry<string> entry, Key fallback) { //IL_0019: 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) this.entry = entry; this.fallback = fallback; } private unsafe static string Name(Key key) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 //IL_004a: 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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected I4, but got Unknown //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Invalid comparison between Unknown and I4 //IL_000f: 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_0028: Expected I4, but got Unknown if ((int)key >= 41) { if ((int)key <= 49) { return (key - 41 + 1).ToString(); } if ((int)key == 50) { return "0"; } switch (key - 61) { case 2: return "Up"; case 3: return "Down"; case 0: return "Left"; case 1: return "Right"; } } return ((object)(*(Key*)(&key))/*cast due to .constrained prefix*/).ToString(); } } internal static class Dashboard { private static TextMeshProUGUI? label; private static string shown = ""; public static void Show(string text) { TextMeshProUGUI val = Get(); if (!((Object)(object)val == (Object)null)) { if (!((Component)val).gameObject.activeSelf) { ((Component)val).gameObject.SetActive(true); } if (!(text == shown)) { shown = text; ((TMP_Text)val).text = text; } } } public static void Hide() { if (!((Object)(object)label == (Object)null) && ((Component)label).gameObject.activeSelf) { ((Component)label).gameObject.SetActive(false); shown = ""; } } private static TextMeshProUGUI? Get() { //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Expected O, but got Unknown //IL_0095: 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_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0193: 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_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: 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) if ((Object)(object)label != (Object)null) { return label; } HUDManager instance = HUDManager.Instance; if ((Object)(object)instance == (Object)null || instance.controlTipLines == null || instance.controlTipLines.Length == 0) { return null; } TextMeshProUGUI[] controlTipLines = instance.controlTipLines; TextMeshProUGUI val = controlTipLines[^1]; if ((Object)(object)val == (Object)null) { return null; } GameObject val2 = Object.Instantiate<GameObject>(((Component)val).gameObject, ((TMP_Text)val).transform.parent); ((Object)val2).name = "LethalBikesAndCartsDashboard"; TextMeshProUGUI component = val2.GetComponent<TextMeshProUGUI>(); RectTransform val3 = (RectTransform)val2.transform; RectTransform val4 = (RectTransform)((TMP_Text)val).transform; Rect rect = val4.rect; float num = ((Rect)(ref rect)).height; if (controlTipLines.Length > 1 && (Object)(object)controlTipLines[0] != (Object)null) { num = Mathf.Abs(((RectTransform)((TMP_Text)controlTipLines[0]).transform).anchoredPosition.y - ((RectTransform)((TMP_Text)controlTipLines[1]).transform).anchoredPosition.y); } if (num < 4f) { num = 20f; } float y = val4.anchoredPosition.y; rect = val4.rect; float num2 = y - ((Rect)(ref rect)).height * val4.pivot.y; val3.pivot = new Vector2(val4.pivot.x, 1f); val3.anchoredPosition = new Vector2(val4.anchoredPosition.x, num2 - num * 0.6f); ((TMP_Text)component).enableWordWrapping = false; ((TMP_Text)component).overflowMode = (TextOverflowModes)0; ((TMP_Text)component).richText = true; ((TMP_Text)component).alignment = (TextAlignmentOptions)((((TMP_Text)val).alignment & 0xFF) | 0x100); ((TMP_Text)component).text = ""; label = component; shown = ""; return label; } } public class DetonatorItem : GrabbableObject { private enum Result { NotLinked, NoSignal, Wrecked, NotOut, Busy, Armed, Stopped, CannotLink } internal int linkCode; private int linkedKind = -1; private float nextUseTime; private string LinkedNoun { get { if (linkedKind != 0) { if (linkedKind != 1) { return "vehicle"; } return "golf cart"; } return "motorbike"; } } public override int GetItemDataToSave() { return (linkCode & 0xFFFF) | (linkedKind + 1 << 16); } public override void LoadItemSaveData(int saveData) { linkCode = saveData & 0xFFFF; linkedKind = ((linkCode == 0) ? (-1) : (((saveData >> 16) & 3) - 1)); } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); if ((Object)(object)base.playerHeldBy != (Object)null) { base.playerHeldBy.equippedUsableItemQE = true; } } public override void PocketItem() { if (((NetworkBehaviour)this).IsOwner && (Object)(object)base.playerHeldBy != (Object)null) { base.playerHeldBy.equippedUsableItemQE = false; } ((GrabbableObject)this).PocketItem(); } public override void DiscardItem() { if ((Object)(object)base.playerHeldBy != (Object)null) { base.playerHeldBy.equippedUsableItemQE = false; } ((GrabbableObject)this).DiscardItem(); } public override void SetControlTipsForItem() { HUDManager.Instance.ChangeControlTipMultiple(new string[3] { (linkCode != 0) ? ("Blow up the " + LinkedNoun + " : [RMB]") : "Detonate : [RMB]", "Link to the vehicle next to you : [Q]", (linkCode != 0) ? ("Linked to: " + Capitalised(LinkedNoun)) : "Not linked yet" }, true, base.itemProperties); } private static string Capitalised(string text) { if (text.Length != 0) { return char.ToUpperInvariant(text[0]) + text.Substring(1); } return text; } public override void ItemInteractLeftRight(bool right) { //IL_0064: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).ItemInteractLeftRight(right); if (!(!((NetworkBehaviour)this).IsOwner || right) && !((Object)(object)base.playerHeldBy == (Object)null)) { RideVehicle rideVehicle = RideVehicle.FindNear(base.playerHeldBy); if ((Object)(object)rideVehicle == (Object)null) { Tip("Stand next to a motorbike or golf cart to link the detonator to it."); } else if (rideVehicle.IsBroken) { Tip("That one is already a wreck."); } else { LinkServerRpc(new NetworkObjectReference(((NetworkBehaviour)rideVehicle).NetworkObject)); } } } public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); if (buttonDown && ((NetworkBehaviour)this).IsOwner && !(Time.time < nextUseTime)) { nextUseTime = Time.time + 0.5f; Click(); DetonateServerRpc(); } } [ServerRpc(RequireOwnership = false)] private void LinkServerRpc(NetworkObjectReference vehicleReference) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_00dc: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(3154722127u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe<NetworkObjectReference>(ref vehicleReference, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 3154722127u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; NetworkObject val3 = default(NetworkObject); if (((NetworkObjectReference)(ref vehicleReference)).TryGet(ref val3, (NetworkManager)null) && !((Object)(object)val3 == (Object)null)) { RideVehicle component = ((Component)val3).GetComponent<RideVehicle>(); if ((Object)(object)component == (Object)null || (Object)(object)component.keys == (Object)null || !((NetworkBehaviour)component.keys).IsSpawned) { ResultClientRpc(7); } else { LinkedClientRpc(component.keys.EnsureLinkCode(), (int)component.kind); } } } [ServerRpc(RequireOwnership = false)] private void DetonateServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(1412033267u, val2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 1412033267u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (linkCode == 0) { ResultClientRpc(0); return; } VehicleKeysItem vehicleKeysItem = VehicleKeysItem.FindByLinkCode(linkCode); if ((Object)(object)vehicleKeysItem == (Object)null) { ResultClientRpc(1); return; } if (vehicleKeysItem.wrecked) { ResultClientRpc(2); return; } if (!vehicleKeysItem.TryGetDeployed(out RideVehicle vehicle)) { ResultClientRpc(3); return; } if (vehicle.IsBroken) { ResultClientRpc(2); return; } bool flag = !vehicle.SelfDestructRunning; if (!vehicle.SetSelfDestructOnServer(flag)) { ResultClientRpc(4); } else { ResultClientRpc(flag ? 5 : 6); } } [ClientRpc] private void LinkedClientRpc(int code, int kind) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(119584507u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, code); BytePacker.WriteValueBitPacked(val, kind); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 119584507u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; linkCode = code; linkedKind = kind; if (((NetworkBehaviour)this).IsOwner) { Click(); if (base.isHeld && !base.isPocketed && (Object)(object)base.playerHeldBy == (Object)(object)GameNetworkManager.Instance.localPlayerController) { ((GrabbableObject)this).SetControlTipsForItem(); } Tip("Linked to this " + LinkedNoun + ". Left click, from anywhere, to blow it up."); } } [ClientRpc] private void ResultClientRpc(int result) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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_0089: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3006496337u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, result); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3006496337u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (((NetworkBehaviour)this).IsOwner) { string text = (Result)result switch { Result.NotLinked => "Not linked to anything. Stand next to your motorbike or golf cart and press [Q].", Result.NoSignal => "No signal. That vehicle's keys are gone.", Result.Wrecked => "Nothing left to blow up.", Result.NotOut => "Your " + LinkedNoun + " is not out. Throw its keys first.", Result.Busy => "Not right now.", Result.Armed => $"Self-destruct in {5f:0} seconds! Click again to stop it.", Result.Stopped => "Self-destruct stopped.", Result.CannotLink => "That vehicle can't be linked.", _ => null, }; if (text != null) { Tip(text, result == 5); } } } private void Click() { AudioSource component = ((Component)this).GetComponent<AudioSource>(); AudioClip beep = Borrowed.Beep; if ((Object)(object)component != (Object)null && (Object)(object)beep != (Object)null) { component.PlayOneShot(beep, 0.5f); } } private static void Tip(string text, bool warning = false) { HUDManager.Instance.DisplayTip("Remote detonator", text, warning, false, "LC_Tip1"); } protected override void __initializeVariables() { ((GrabbableObject)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(3154722127u, new RpcReceiveHandler(__rpc_handler_3154722127), "LinkServerRpc"); ((NetworkBehaviour)this).__registerRpc(1412033267u, new RpcReceiveHandler(__rpc_handler_1412033267), "DetonateServerRpc"); ((NetworkBehaviour)this).__registerRpc(119584507u, new RpcReceiveHandler(__rpc_handler_119584507), "LinkedClientRpc"); ((NetworkBehaviour)this).__registerRpc(3006496337u, new RpcReceiveHandler(__rpc_handler_3006496337), "ResultClientRpc"); ((GrabbableObject)this).__initializeRpcs(); } private static void __rpc_handler_3154722127(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference vehicleReference = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref vehicleReference, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)1; ((DetonatorItem)(object)target).LinkServerRpc(vehicleReference); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1412033267(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((DetonatorItem)(object)target).DetonateServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_119584507(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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_0061: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int code = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref code); int kind = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref kind); target.__rpc_exec_stage = (__RpcExecStage)1; ((DetonatorItem)(object)target).LinkedClientRpc(code, kind); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3006496337(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int result = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref result); target.__rpc_exec_stage = (__RpcExecStage)1; ((DetonatorItem)(object)target).ResultClientRpc(result); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "DetonatorItem"; } } internal static class ItemIcons { private const int Size = 256; private const int Supersample = 2; private static readonly Dictionary<string, Sprite> cache = new Dictionary<string, Sprite>(); private static readonly Vector3 LightDirection; public static Sprite? Get(GameObject item, int paintSlot, int paint) { //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) MeshFilter componentInChildren = item.GetComponentInChildren<MeshFilter>(); MeshRenderer val = (((Object)(object)componentInChildren != (Object)null) ? ((Component)componentInChildren).GetComponent<MeshRenderer>() : null); if ((Object)(object)componentInChildren == (Object)null || (Object)(object)val == (Object)null || (Object)(object)componentInChildren.sharedMesh == (Object)null) { return null; } Mesh sharedMesh = componentInChildren.sharedMesh; string key = ((Object)sharedMesh).name + "/" + paintSlot + "/" + paint; if (cache.TryGetValue(key, out Sprite value) && (Object)(object)value != (Object)null) { return value; } if (!sharedMesh.isReadable) { Plugin.Logger.LogWarning((object)("Mesh " + ((Object)sharedMesh).name + " is not readable; its item keeps the default icon.")); return null; } Material[] sharedMaterials = ((Renderer)val).sharedMaterials; Color[] baseColors = (Color[])(object)new Color[sharedMaterials.Length]; for (int i = 0; i < sharedMaterials.Length; i++) { Material val2 = sharedMaterials[i]; baseColors[i] = (((Object)(object)val2 != (Object)null && val2.HasProperty("_BaseColor")) ? val2.GetColor("_BaseColor") : Color.grey); } Func<int, Vector2, Color> colorOf = delegate(int submesh, Vector2 uv) { //IL_0036: 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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) if (submesh == paintSlot && paint != 0) { return Paints.Sample(paint, uv); } return (submesh >= baseColors.Length) ? Color.grey : baseColors[submesh]; }; Sprite val3; try { val3 = Render(sharedMesh, colorOf); } catch (Exception arg) { Plugin.Logger.LogWarning((object)$"Could not draw the icon of {((Object)sharedMesh).name}: {arg}"); return null; } if ((Object)(object)val3 != (Object)null) { cache[key] = val3; } return val3; } private static Sprite? Render(Mesh mesh, Func<int, Vector2, Color> colorOf) { //IL_0023: 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_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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0090: 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_009a: 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_009e: 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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0124: 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_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0135: 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_0151: 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_0172: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0250: 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_0278: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_0265: 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_0292: Unknown result type (might be due to invalid IL or missing references) //IL_05ab: Unknown result type (might be due to invalid IL or missing references) //IL_05b0: Unknown result type (might be due to invalid IL or missing references) //IL_086c: Unknown result type (might be due to invalid IL or missing references) //IL_0871: Unknown result type (might be due to invalid IL or missing references) //IL_0887: Unknown result type (might be due to invalid IL or missing references) //IL_088e: Unknown result type (might be due to invalid IL or missing references) //IL_0897: Expected O, but got Unknown //IL_08bf: Unknown result type (might be due to invalid IL or missing references) //IL_08ce: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_062f: Unknown result type (might be due to invalid IL or missing references) //IL_0702: Unknown result type (might be due to invalid IL or missing references) //IL_0707: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_0658: Unknown result type (might be due to invalid IL or missing references) //IL_065f: Unknown result type (might be due to invalid IL or missing references) //IL_066c: Unknown result type (might be due to invalid IL or missing references) //IL_0673: Unknown result type (might be due to invalid IL or missing references) //IL_0680: Unknown result type (might be due to invalid IL or missing references) //IL_0687: Unknown result type (might be due to invalid IL or missing references) //IL_0696: Unknown result type (might be due to invalid IL or missing references) //IL_0651: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_05d0: Unknown result type (might be due to invalid IL or missing references) //IL_05d5: Unknown result type (might be due to invalid IL or missing references) //IL_05d7: Unknown result type (might be due to invalid IL or missing references) //IL_05d9: Unknown result type (might be due to invalid IL or missing references) //IL_05e0: Unknown result type (might be due to invalid IL or missing references) //IL_05e8: Unknown result type (might be due to invalid IL or missing references) //IL_05ef: Unknown result type (might be due to invalid IL or missing references) //IL_05f7: Unknown result type (might be due to invalid IL or missing references) //IL_05fe: Unknown result type (might be due to invalid IL or missing references) //IL_0606: Unknown result type (might be due to invalid IL or missing references) //IL_060d: Unknown result type (might be due to invalid IL or missing references) //IL_0612: Unknown result type (might be due to invalid IL or missing references) //IL_0617: Unknown result type (might be due to invalid IL or missing references) //IL_069b: Unknown result type (might be due to invalid IL or missing references) //IL_0794: Unknown result type (might be due to invalid IL or missing references) //IL_07a2: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_07be: Unknown result type (might be due to invalid IL or missing references) //IL_07c5: Unknown result type (might be due to invalid IL or missing references) //IL_07cc: Unknown result type (might be due to invalid IL or missing references) //IL_07d3: Unknown result type (might be due to invalid IL or missing references) //IL_07d8: Unknown result type (might be due to invalid IL or missing references) //IL_07df: Unknown result type (might be due to invalid IL or missing references) //IL_07e4: Unknown result type (might be due to invalid IL or missing references) //IL_07e8: Unknown result type (might be due to invalid IL or missing references) //IL_07f2: Unknown result type (might be due to invalid IL or missing references) //IL_07fa: Unknown result type (might be due to invalid IL or missing references) //IL_07ff: Unknown result type (might be due to invalid IL or missing references) //IL_0806: Unknown result type (might be due to invalid IL or missing references) //IL_07b7: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_0355: Unknown result type (might be due to invalid IL or missing references) //IL_035c: Unknown result type (might be due to invalid IL or missing references) //IL_0363: 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_0388: Unknown result type (might be due to invalid IL or missing references) //IL_038f: Unknown result type (might be due to invalid IL or missing references) //IL_03b0: Unknown result type (might be due to invalid IL or missing references) //IL_03b7: Unknown result type (might be due to invalid IL or missing references) //IL_03be: Unknown result type (might be due to invalid IL or missing references) //IL_080b: Unknown result type (might be due to invalid IL or missing references) //IL_081a: Unknown result type (might be due to invalid IL or missing references) //IL_0821: Unknown result type (might be due to invalid IL or missing references) //IL_0828: Unknown result type (might be due to invalid IL or missing references) //IL_0831: Unknown result type (might be due to invalid IL or missing references) //IL_0836: Unknown result type (might be due to invalid IL or missing references) //IL_0403: Unknown result type (might be due to invalid IL or missing references) //IL_040a: Unknown result type (might be due to invalid IL or missing references) //IL_0414: Unknown result type (might be due to invalid IL or missing references) //IL_041d: Unknown result type (might be due to invalid IL or missing references) //IL_0424: Unknown result type (might be due to invalid IL or missing references) //IL_042e: Unknown result type (might be due to invalid IL or missing references) //IL_043d: Unknown result type (might be due to invalid IL or missing references) //IL_0444: Unknown result type (might be due to invalid IL or missing references) //IL_044e: Unknown result type (might be due to invalid IL or missing references) //IL_0457: Unknown result type (might be due to invalid IL or missing references) //IL_045e: Unknown result type (might be due to invalid IL or missing references) //IL_0468: Unknown result type (might be due to invalid IL or missing references) //IL_04aa: Unknown result type (might be due to invalid IL or missing references) //IL_04b4: Unknown result type (might be due to invalid IL or missing references) //IL_04bf: Unknown result type (might be due to invalid IL or missing references) //IL_04e7: Unknown result type (might be due to invalid IL or missing references) //IL_04eb: Unknown result type (might be due to invalid IL or missing references) //IL_04f0: Unknown result type (might be due to invalid IL or missing references) //IL_04f4: Unknown result type (might be due to invalid IL or missing references) //IL_04f9: Unknown result type (might be due to invalid IL or missing references) //IL_04fe: Unknown result type (might be due to invalid IL or missing references) //IL_0502: Unknown result type (might be due to invalid IL or missing references) //IL_0507: Unknown result type (might be due to invalid IL or missing references) //IL_050c: Unknown result type (might be due to invalid IL or missing references) //IL_0511: Unknown result type (might be due to invalid IL or missing references) //IL_0517: Unknown result type (might be due to invalid IL or missing references) //IL_0521: Unknown result type (might be due to invalid IL or missing references) //IL_052b: Unknown result type (might be due to invalid IL or missing references) //IL_053a: Unknown result type (might be due to invalid IL or missing references) //IL_053f: Unknown result type (might be due to invalid IL or missing references) Vector3[] vertices = mesh.vertices; Vector2[] uv = mesh.uv; if (vertices.Length == 0) { return null; } Quaternion val = Quaternion.Euler(-50f, 0f, 0f) * Quaternion.Euler(0f, 45f, 0f); Vector3[] array = (Vector3[])(object)new Vector3[vertices.Length]; Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(float.MaxValue, float.MaxValue); Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(float.MinValue, float.MinValue); for (int i = 0; i < vertices.Length; i++) { Vector3 val4 = (array[i] = val * vertices[i]); val2 = Vector2.Min(val2, Vector2.op_Implicit(val4)); val3 = Vector2.Max(val3, Vector2.op_Implicit(val4)); } int num = 512; float num2 = Mathf.Max(new float[3] { val3.x - val2.x, val3.y - val2.y, 1E-05f }); float num3 = (float)num * 0.84f / num2; Vector2 val5 = (val2 + val3) * 0.5f; for (int j = 0; j < array.Length; j++) { Vector3 val6 = array[j]; array[j] = new Vector3((val6.x - val5.x) * num3 + (float)num * 0.5f, (val6.y - val5.y) * num3 + (float)num * 0.5f, val6.z); } Color[] array2 = (Color[])(object)new Color[num * num]; float[] array3 = new float[num * num]; for (int k = 0; k < array3.Length; k++) { array3[k] = float.MaxValue; } for (int l = 0; l < mesh.subMeshCount; l++) { int[] triangles = mesh.GetTriangles(l); for (int m = 0; m + 2 < triangles.Length; m += 3) { int num4 = triangles[m]; int num5 = triangles[m + 1]; int num6 = triangles[m + 2]; Vector3 val7 = array[num4]; Vector3 val8 = array[num5]; Vector3 val9 = array[num6]; Vector3 val10 = Vector3.Cross(val * (vertices[num5] - vertices[num4]), val * (vertices[num6] - vertices[num4])); Vector3 val11 = ((Vector3)(ref val10)).normalized; if (val11.z > 0f) { val11 = -val11; } float num7 = 0.45f + 0.6f * Mathf.Max(0f, Vector3.Dot(val11, LightDirection)); Vector2 val12 = ((num4 < uv.Length) ? uv[num4] : Vector2.zero); Vector2 val13 = ((num5 < uv.Length) ? uv[num5] : Vector2.zero); Vector2 val14 = ((num6 < uv.Length) ? uv[num6] : Vector2.zero); float num8 = (val8.y - val9.y) * (val7.x - val9.x) + (val9.x - val8.x) * (val7.y - val9.y); if (Mathf.Abs(num8) < 1E-06f) { continue; } int num9 = Mathf.Max(0, Mathf.FloorToInt(Mathf.Min(val7.x, Mathf.Min(val8.x, val9.x)))); int num10 = Mathf.Min(num - 1, Mathf.CeilToInt(Mathf.Max(val7.x, Mathf.Max(val8.x, val9.x)))); int num11 = Mathf.Max(0, Mathf.FloorToInt(Mathf.Min(val7.y, Mathf.Min(val8.y, val9.y)))); int num12 = Mathf.Min(num - 1, Mathf.CeilToInt(Mathf.Max(val7.y, Mathf.Max(val8.y, val9.y)))); for (int n = num11; n <= num12; n++) { float num13 = (float)n + 0.5f; for (int num14 = num9; num14 <= num10; num14++) { float num15 = (float)num14 + 0.5f; float num16 = ((val8.y - val9.y) * (num15 - val9.x) + (val9.x - val8.x) * (num13 - val9.y)) / num8; float num17 = ((val9.y - val7.y) * (num15 - val9.x) + (val7.x - val9.x) * (num13 - val9.y)) / num8; float num18 = 1f - num16 - num17; if (!(num16 < 0f) && !(num17 < 0f) && !(num18 < 0f)) { float num19 = num16 * val7.z + num17 * val8.z + num18 * val9.z; int num20 = n * num + num14; if (!(num19 >= array3[num20])) { array3[num20] = num19; Color val15 = colorOf(l, val12 * num16 + val13 * num17 + val14 * num18); array2[num20] = new Color(val15.r * num7, val15.g * num7, val15.b * num7, 1f); } } } } } } Color[] array4 = (Color[])(object)new Color[65536]; float num21 = 4f; for (int num22 = 0; num22 < 256; num22++) { for (int num23 = 0; num23 < 256; num23++) { Color val16 = Color.clear; for (int num24 = 0; num24 < 2; num24++) { for (int num25 = 0; num25 < 2; num25++) { Color val17 = array2[(num22 * 2 + num24) * num + num23 * 2 + num25]; val16 += new Color(val17.r * val17.a, val17.g * val17.a, val17.b * val17.a, val17.a); } } float num26 = val16.a / num21; array4[num22 * 256 + num23] = (Color)((num26 > 0f) ? new Color(Mathf.Clamp01(val16.r / val16.a), Mathf.Clamp01(val16.g / val16.a), Mathf.Clamp01(val16.b / val16.a), num26) : Color.clear); } } Color[] array5 = (Color[])(object)new Color[array4.Length]; Color val18 = default(Color); ((Color)(ref val18))..ctor(0.05f, 0.05f, 0.06f); for (int num27 = 0; num27 < 256; num27++) { for (int num28 = 0; num28 < 256; num28++) { Color val19 = array4[num27 * 256 + num28]; float num29 = 0f; for (int num30 = -3; num30 <= 3; num30++) { if (!(num29 < 1f)) { break; } int num31 = num27 + num30; if (num31 < 0 || num31 >= 256) { continue; } for (int num32 = -3; num32 <= 3; num32++) { int num33 = num28 + num32; if (num33 >= 0 && num33 < 256 && num32 * num32 + num30 * num30 <= 9) { num29 = Mathf.Max(num29, array4[num31 * 256 + num33].a); } } } float num34 = val19.a + num29 * (1f - val19.a); Color val20 = ((num34 > 0f) ? ((new Color(val19.r, val19.g, val19.b) * val19.a + val18 * num29 * (1f - val19.a)) / num34) : Color.clear); array5[num27 * 256 + num28] = new Color(val20.r, val20.g, val20.b, num34); } } Texture2D val21 = new Texture2D(256, 256, (TextureFormat)4, false, false) { name = "LethalBikesAndCartsIcon_" + ((Object)mesh).name, wrapMode = (TextureWrapMode)1, filterMode = (FilterMode)1 }; val21.SetPixels(array5); val21.Apply(false, true); Sprite val22 = Sprite.Create(val21, new Rect(0f, 0f, 256f, 256f), new Vector2(0.5f, 0.5f), 100f); ((Object)val22).name = ((Object)val21).name; return val22; } public static void ShowInLocalSlots(GrabbableObject item, Sprite? sprite) { if ((Object)(object)sprite == (Object)null || (Object)(object)HUDManager.Instance == (Object)null || (Object)(object)GameNetworkManager.Instance == (Object)null) { return; } PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if ((Object)(object)localPlayerController == (Object)null || (Object)(object)item.playerHeldBy != (Object)(object)localPlayerController) { return; } Image[] itemSlotIcons = HUDManager.Instance.itemSlotIcons; for (int i = 0; i < localPlayerController.ItemSlots.Length && i < itemSlotIcons.Length; i++) { if ((Object)(object)localPlayerController.ItemSlots[i] == (Object)(object)item) { itemSlotIcons[i].sprite = sprite; } } if ((Object)(object)localPlayerController.ItemOnlySlot == (Object)(object)item && (Object)(object)HUDManager.Instance.itemOnlySlotIcon != (Object)null) { HUDManager.Instance.itemOnlySlotIcon.sprite = sprite; } } static ItemIcons() { //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_0021: 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) Vector3 val = new Vector3(-0.45f, 0.75f, -0.5f); LightDirection = ((Vector3)(ref val)).normalized; } } public class PaintCanItem : GrabbableObject { public int paintSlot = -1; internal int selected = 1; private Material? factoryLabel; private float nextPaintTime; private void Awake() { if ((Object)(object)base.mainObjectRenderer != (Object)null && paintSlot >= 0 && paintSlot < ((Renderer)base.mainObjectRenderer).sharedMaterials.Length) { factoryLabel = ((Renderer)base.mainObjectRenderer).sharedMaterials[paintSlot]; } } public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); ApplyLabel(); } public override int GetItemDataToSave() { return selected; } public override void LoadItemSaveData(int saveData) { selected = Paints.Clamp(saveData); ApplyLabel(); } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); if ((Object)(object)base.playerHeldBy != (Object)null) { base.playerHeldBy.equippedUsableItemQE = true; } ItemIcons.ShowInLocalSlots((GrabbableObject)(object)this, Icon()); } public override void PocketItem() { if (((NetworkBehaviour)this).IsOwner && (Object)(object)base.playerHeldBy != (Object)null) { base.playerHeldBy.equippedUsableItemQE = false; } ((GrabbableObject)this).PocketItem(); } public override void DiscardItem() { if ((Object)(object)base.playerHeldBy != (Object)null) { base.playerHeldBy.equippedUsableItemQE = false; } ((GrabbableObject)this).DiscardItem(); } public override void SetControlTipsForItem() { HUDManager.Instance.ChangeControlTipMultiple(new string[3] { "Paint vehicle : [RMB]", "Change paint : [Q] / [E]", "Paint: " + Paints.NameOf(selected) }, true, base.itemProperties); } private Sprite? Icon() { return ItemIcons.Get(base.itemProperties.spawnPrefab, paintSlot, selected); } public override void ItemInteractLeftRight(bool right) { ((GrabbableObject)this).ItemInteractLeftRight(right); if (((NetworkBehaviour)this).IsOwner) { int index = Paints.Next(selected, right ? 1 : (-1)); Select(index); SelectServerRpc(index); } } [ServerRpc(RequireOwnership = false)] private void SelectServerRpc(int index) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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_0089: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(1472978502u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, index); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 1472978502u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; SelectClientRpc(index); } } } [ClientRpc] private void SelectClientRpc(int index) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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_0089: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1101564664u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, index); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 1101564664u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (!((NetworkBehaviour)this).IsOwner) { Select(index); } } } private void Select(int index) { selected = Paints.Clamp(index); ApplyLabel(); AudioClip[] shakeSounds = Borrowed.ShakeSounds; AudioSource component = ((Component)this).GetComponent<AudioSource>(); if (shakeSounds != null && shakeSounds.Length != 0 && (Object)(object)component != (Object)null) { component.PlayOneShot(shakeSounds[Random.Range(0, shakeSounds.Length)], 0.8f); } if (((NetworkBehaviour)this).IsOwner && base.isHeld && !base.isPocketed) { ((GrabbableObject)this).SetControlTipsForItem(); } ItemIcons.ShowInLocalSlots((GrabbableObject)(object)this, Icon()); } private void ApplyLabel() { Paints.Apply((Renderer?)(object)base.mainObjectRenderer, paintSlot, factoryLabel, selected); } public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); if (!buttonDown || !((NetworkBehaviour)this).IsOwner || (Object)(object)base.playerHeldBy == (Object)null || Time.time < nextPaintTime) { return; } RideVehicle rideVehicle = RideVehicle.FindNear(base.playerHeldBy); if ((Object)(object)rideVehicle == (Object)null) { Tip("Get closer to a motorbike or golf cart to paint it."); } else if (!rideVehicle.IsBusy) { if (rideVehicle.IsBroken) { Tip("No paint can save that wreck."); return; } if (rideVehicle.Paint == selected) { Tip((selected == 0) ? "It already has its factory paint." : ("It is already " + Paints.NameOf(selected) + ".")); return; } nextPaintTime = Time.time + 1f; rideVehicle.PaintServerRpc(selected); } } private static void Tip(string text) { HUDManager.Instance.DisplayTip("Cart and bike paint", text, false, false, "LC_Tip1"); } protected override void __initializeVariables() { ((GrabbableObject)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(1472978502u, new RpcReceiveHandler(__rpc_handler_1472978502), "SelectServerRpc"); ((NetworkBehaviour)this).__registerRpc(1101564664u, new RpcReceiveHandler(__rpc_handler_1101564664), "SelectClientRpc"); ((GrabbableObject)this).__initializeRpcs(); } private static void __rpc_handler_1472978502(NetworkBehaviour? target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int index = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref index); target.__rpc_exec_stage = (__RpcExecStage)1; ((PaintCanItem)(object)target).SelectServerRpc(index); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1101564664(NetworkBehaviour? target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int index = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref index); target.__rpc_exec_stage = (__RpcExecStage)1; ((PaintCanItem)(object)target).SelectClientRpc(index); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string? __getTypeName() { return "PaintCanItem"; } } internal enum Pattern { Solid, Flames, Camo, Zebra, Ladybug, Hazard, Checker, Rainbow, Galaxy, Leopard, Cow, Radioactive, Rust, Hearts } internal sealed class Finish { public readonly string Name; public readonly Pattern Pattern; public readonly Color Color; public readonly float Tile; public readonly float Metallic; public readonly float Smoothness; public readonly Color Glow; public Finish(string name, Pattern pattern, Color color, float tile, float metallic, float smoothness, Color glow = default(Color)) { //IL_0015: 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_0034: 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) Name = name; Pattern = pattern; Color = color; Tile = tile; Metallic = metallic; Smoothness = smoothness; Glow = glow; } } internal static class Paints { public const int Factory = 0; private const int TextureSize = 256; public static readonly Finish[] All = new Finish[19] { new Finish("Factory", Pattern.Solid, Color.white, 1f, 0f, 0f), new Finish("Cherry Red", Pattern.Solid, new Color(0.78f, 0.04f, 0.07f), 1f, 0.25f, 0.8f), new Finish("Ocean Blue", Pattern.Solid, new Color(0.05f, 0.32f, 0.82f), 1f, 0.25f, 0.8f), new Finish("Bubblegum Pink", Pattern.Solid, new Color(1f, 0.45f, 0.72f), 1f, 0.15f, 0.75f), new Finish("Midnight Black", Pattern.Solid, new Color(0.04f, 0.04f, 0.05f), 1f, 0.5f, 0.9f), new Finish("Solid Gold", Pattern.Solid, new Color(1f, 0.77f, 0.3f), 1f, 1f, 0.85f), new Finish("Hot Rod Flames", Pattern.Flames, Color.white, 1.6f, 0.2f, 0.8f), new Finish("Woodland Camo", Pattern.Camo, Color.white, 2.5f, 0f, 0.25f), new Finish("Zebra", Pattern.Zebra, Color.white, 2f, 0f, 0.4f), new Finish("Ladybug", Pattern.Ladybug, Color.white, 1.2f, 0.1f, 0.85f), new Finish("Hazard Stripes", Pattern.Hazard, Color.white, 1f, 0f, 0.45f), new Finish("Checkered Flag", Pattern.Checker, Color.white, 1.2f, 0f, 0.6f), new Finish("Rainbow", Pattern.Rainbow, Color.white, 4f, 0.1f, 0.75f), new Finish("Galaxy", Pattern.Galaxy, Color.white, 3f, 0.3f, 0.85f), new Finish("Leopard", Pattern.Leopard, Color.white, 1.5f, 0f, 0.35f), new Finish("Cow", Pattern.Cow, Color.white, 2.5f, 0f, 0.3f), new Finish("Radioactive", Pattern.Radioactive, Color.white, 2f, 0f, 0.6f, new Color(0.35f, 1f, 0.2f) * 0.55f), new Finish("Rust Bucket", Pattern.Rust, Color.white, 2f, 0.3f, 0.12f), new Finish("Love Hearts", Pattern.Hearts, Color.white, 1f, 0.1f, 0.75f) }; private static Material? template; private static readonly Dictionary<int, Material> materials = new Dictionary<int, Material>(); private static readonly Dictionary<int, Color32[]> pixels = new Dictionary<int, Color32[]>(); private static Material? burnt; public static int Count => All.Length; public static int Clamp(int index) { if (index < 0 || index >= All.Length) { return 0; } return index; } public static int Next(int index, int direction) { return ((index + direction) % All.Length + All.Length) % All.Length; } public static string NameOf(int index) { return All[Clamp(index)].Name; } public static void Init(Material paintTemplate) { template = paintTemplate; } public static void Apply(Renderer? renderer, int slot, Material? original, int index) { if ((Object)(object)renderer == (Object)null || slot < 0) { return; } Material[] sharedMaterials = renderer.sharedMaterials; if (slot < sharedMaterials.Length) { Material val = ((index == 0) ? original : GetMaterial(index)); if (!((Object)(object)val == (Object)null) && !((Object)(object)sharedMaterials[slot] == (Object)(object)val)) { sharedMaterials[slot] = val; renderer.sharedMaterials = sharedMaterials; } } } public static Material? GetMaterial(int index) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: 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_00d7: 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_00f2: Unknown result type (might be due to invalid IL or missing references) index = Clamp(index); if (index == 0 || (Object)(object)template == (Object)null) { return null; } if (materials.TryGetValue(index, out Material value) && (Object)(object)value != (Object)null) { return value; } Finish finish = All[index]; Material val = new Material(template) { name = "LethalBikesAndCartsPaint_" + finish.Name }; if (finish.Pattern == Pattern.Solid) { val.SetColor("_BaseColor", finish.Color); } else { val.SetColor("_BaseColor", Color.white); val.SetTexture("_BaseColorMap", (Texture)(object)MakeTexture(index)); val.SetTextureScale("_BaseColorMap", Vector2.one / finish.Tile); } val.SetFloat("_Metallic", finish.Metallic); val.SetFloat("_Smoothness", finish.Smoothness); Color glow = finish.Glow; if (((Color)(ref glow)).maxColorComponent > 0f) { val.SetColor("_EmissiveColor", finish.Glow); val.SetFloat("_AlbedoAffectEmissive", 1f); val.SetFloat("_EmissiveExposureWeight", 0f); } materials[index] = val; return val; } public static Material? Burnt() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_0055: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)burnt != (Object)null) { return burnt; } if ((Object)(object)template == (Object)null) { return null; } burnt = new Material(template) { name = "LethalBikesAndCartsBurnt" }; burnt.SetColor("_BaseColor", new Color(0.055f, 0.05f, 0.045f)); burnt.SetFloat("_Metallic", 0f); burnt.SetFloat("_Smoothness", 0.12f); return burnt; } public static void Scorch(Renderer? renderer) { Material val = Burnt(); if (!((Object)(object)renderer == (Object)null) && !((Object)(object)val == (Object)null)) { Material[] sharedMaterials = renderer.sharedMaterials; for (int i = 0; i < sharedMaterials.Length; i++) { sharedMaterials[i] = val; } renderer.sharedMaterials = sharedMaterials; } } public static Color Sample(int index, Vector2 uv) { //IL_0023: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) Finish finish = All[Clamp(index)]; if (finish.Pattern == Pattern.Solid) { return finish.Color; } Color32[] array = GetPixels(index); float num = uv.x / finish.Tile; float num2 = uv.y / finish.Tile; int num3 = Mathf.FloorToInt((num - Mathf.Floor(num)) * 256f) % 256; int num4 = Mathf.FloorToInt((num2 - Mathf.Floor(num2)) * 256f) % 256; return Color32.op_Implicit(array[num4 * 256 + num3]); } public static Color Swatch(int index) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) Finish finish = All[Clamp(index)]; if (finish.Pattern == Pattern.Solid) { return finish.Color; } Color32[] array = GetPixels(index); float num = 0f; float num2 = 0f; float num3 = 0f; for (int i = 0; i < array.Length; i += 7) { num += (float)(int)array[i].r; num2 += (float)(int)array[i].g; num3 += (float)(int)array[i].b; } float num4 = Mathf.Ceil((float)array.Length / 7f) * 255f; return new Color(num / num4, num2 / num4, num3 / num4); } private static Texture2D MakeTexture(int index) { //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_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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown Texture2D val = new Texture2D(256, 256, (TextureFormat)4, true, false) { name = "LethalBikesAndCartsPattern_" + All[index].Name, wrapMode = (TextureWrapMode)0, filterMode = (FilterMode)1, anisoLevel = 4 }; val.SetPixels32(GetPixels(index)); val.Apply(true, true); return val; } private static Color32[] GetPixels(int index) { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) if (pixels.TryGetValue(index, out Color32[] value)) { return value; } Pattern pattern = All[index].Pattern; Color32[] array = (Color32[])(object)new Color32[65536]; for (int i = 0; i < 256; i++) { float v = ((float)i + 0.5f) / 256f; for (int j = 0; j < 256; j++) { float u = ((float)j + 0.5f) / 256f; array[i * 256 + j] = Color32.op_Implicit(PatternColor(pattern, u, v)); } } pixels[index] = array; return array; } private static Color PatternColor(Pattern pattern, float u, float v) { //IL_0043: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: 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_0109: Unknown result type (might be due to invalid IL or missing references) //IL_014d: 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_015d: 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_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) switch (pattern) { case Pattern.Flames: return Flames(u, v); case Pattern.Camo: return Camo(u, v); case Pattern.Zebra: return Zebra(u, v); case Pattern.Ladybug: return Ladybug(u, v); case Pattern.Hazard: if (!(Frac((u + v) * 4f) < 0.5f)) { return new Color(0.07f, 0.07f, 0.07f); } return new Color(1f, 0.78f, 0.05f); case Pattern.Checker: if (((Mathf.FloorToInt(u * 6f) + Mathf.FloorToInt(v * 6f)) & 1) != 0) { return new Color(0.05f, 0.05f, 0.05f); } return new Color(0.95f, 0.95f, 0.95f); case Pattern.Rainbow: return Color.HSVToRGB(Frac(u + v), 0.78f, 1f); case Pattern.Galaxy: return Galaxy(u, v); case Pattern.Leopard: return Leopard(u, v); case Pattern.Cow: if (!(Fbm(u, v, 5, 3, 99) > 0.58f)) { return new Color(0.95f, 0.94f, 0.9f); } return new Color(0.07f, 0.06f, 0.06f); case Pattern.Radioactive: return Radioactive(u, v); case Pattern.Rust: return Rust(u, v); case Pattern.Hearts: return Hearts(u, v); default: return Color.white; } } private static Color Flames(float u, float v) { //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: 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_0134: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) float num = u + 0.045f * Mathf.Sin((v * 2f + u) * MathF.PI * 2f) + 0.02f * Mathf.Sin(v * 5f * MathF.PI * 2f); float num2 = num * 5f; int x = (Mathf.FloorToInt(num2) % 5 + 5) % 5; float num3 = num2 - Mathf.Floor(num2); float num4 = Mathf.Pow(1f - Mathf.Abs(2f * num3 - 1f), 1.6f); float num5 = 0.14f + 0.72f * num4 * (0.7f + 0.3f * Hash(x, 0, 7)); if (v >= num5) { return new Color(0.04f, 0.04f, 0.05f); } if (num5 - v < 0.018f) { return new Color(0.45f, 0.03f, 0.01f); } float num6 = v / num5; if (num6 < 0.3f) { return new Color(1f, 0.9f, 0.3f); } if (num6 < 0.64f) { return new Color(1f, 0.52f, 0.07f); } return new Color(0.88f, 0.1f, 0.03f); } private static Color Camo(float u, float v) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) float num = Fbm(u, v, 4, 3, 11); float num2 = Fbm(u, v, 4, 3, 57); if (num2 > 0.62f) { return new Color(0.09f, 0.09f, 0.07f); } if (num2 < 0.37f) { return new Color(0.38f, 0.27f, 0.15f); } if (num < 0.46f) { return new Color(0.22f, 0.29f, 0.14f); } if (num < 0.56f) { return new Color(0.4f, 0.42f, 0.22f); } return new Color(0.56f, 0.52f, 0.34f); } private static Color Zebra(float u, float v) { //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) float num = 0.25f * Mathf.Sin(v * MathF.PI * 4f) + 0.9f * Fbm(u, v, 3, 3, 5); float num2 = Mathf.Sin((u * 5f + num) * MathF.PI * 2f); if (!(num2 > 0.15f)) { return new Color(0.95f, 0.95f, 0.93f); } return new Color(0.06f, 0.06f, 0.06f); } private static Color Ladybug(float u, float v) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) var (num, num2) = NearestSpot(u, v, 4, 0.6f, 3); if (!(num < 0.065f + 0.04f * num2)) { return new Color(0.86f, 0.07f, 0.05f); } return new Color(0.05f, 0.04f, 0.04f); } private static Color Galaxy(float u, float v) { //IL_0027: 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_0050: 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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0066: 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_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0097: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) float x = Fbm(u, v, 3, 4, 21); float x2 = Fbm(u, v, 5, 3, 77); Color val = Color.Lerp(new Color(0.03f, 0.02f, 0.1f), new Color(0.36f, 0.08f, 0.46f), SmoothStep(0.45f, 0.75f, x)); val = Color.Lerp(val, new Color(0.08f, 0.26f, 0.62f), SmoothStep(0.5f, 0.8f, x2) * 0.7f); val = Color.Lerp(val, new Color(0.9f, 0.35f, 0.75f), SmoothStep(0.7f, 0.85f, x) * 0.5f); if (Hash(Mathf.FloorToInt(u * 128f) % 128, Mathf.FloorToInt(v * 128f) % 128, 3) > 0.986f) { val = Color.Lerp(val, Color.white, 0.85f); } float item = NearestSpot(u, v, 6, 0.9f, 41).distance; if (item < 0.008f) { val = Color.white; } return val; } private static Color Leopard(float u, float v) { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) (float distance, float random) tuple = NearestSpot(u, v, 5, 0.8f, 13); float item = tuple.distance; float item2 = tuple.random; item *= 0.8f + 0.4f * Noise(u, v, 16, 8); float num = 0.06f + 0.03f * item2; if (item < num * 0.55f) { return new Color(0.7f, 0.42f, 0.16f); } if (item < num) { return new Color(0.15f, 0.09f, 0.04f); } return new Color(0.87f, 0.63f, 0.3f); } private static Color Radioactive(float u, float v) { //IL_0023: 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_0040: Unknown result type (might be due to invalid IL or missing references) float num = Fbm(u, v, 4, 4, 31); if (num > 0.6f) { return new Color(0.08f, 0.35f, 0.05f); } if (num > 0.55f) { return new Color(0.2f, 0.6f, 0.08f); } return new Color(0.4f, 0.95f, 0.16f); } private static Color Rust(float u, float v) { //IL_002e: 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_0074: 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_004b: Unknown result type (might be due to invalid IL or missing references) float num = Fbm(u, v, 4, 4, 13); float num2 = Fbm(u, v, 8, 3, 5); if (num2 > 0.66f) { return new Color(0.42f, 0.5f, 0.46f); } if (num < 0.36f) { return new Color(0.2f, 0.1f, 0.05f); } return Color.Lerp(new Color(0.42f, 0.18f, 0.07f), new Color(0.7f, 0.34f, 0.12f), SmoothStep(0.4f, 0.65f, num)); } private static Color Hearts(float u, float v) { //IL_00b1: 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) float num = v * 4f; int num2 = Mathf.FloorToInt(num); float num3 = u * 4f + (((num2 & 1) == 0) ? 0f : 0.5f); float num4 = (num3 - Mathf.Floor(num3) - 0.5f) * 2.6f; float num5 = (num - Mathf.Floor(num) - 0.5f) * 2.6f + 0.25f; float num6 = num4 * num4 + num5 * num5 - 1f; if (!(num6 * num6 * num6 - num4 * num4 * num5 * num5 * num5 < 0f)) { return new Color(1f, 0.64f, 0.8f); } return new Color(0.88f, 0.1f, 0.25f); } private static float Frac(float x) { return x - Mathf.Floor(x); } private static float SmoothStep(float from, float to, float x) { float num = Mathf.Clamp01((x - from) / (to - from)); return num * num * (3f - 2f * num); } private static int Mod(int a, int m) { return (a % m + m) % m; } private static float Hash(int x, int y, int seed) { uint num = (uint)(x * 374761393 + y * 668265263 + seed * 144665 + 1013904223); num = (num ^ (num >> 13)) * 1274126177; num ^= num >> 16; return (float)(num & 0xFFFFFF) / 16777216f; } private static float Noise(float u, float v, int period, int seed) { float num = u * (float)period; float num2 = v * (float)period; int num3 = Mathf.FloorToInt(num); int num4 = Mathf.FloorToInt(num2); float num5 = num - (float)num3; float num6 = num2 - (float)num4; num5 = num5 * num5 * (3f - 2f * num5); num6 = num6 * num6 * (3f - 2f * num6); float num7 = Hash(Mod(num3, period), Mod(num4, period), seed); float num8 = Hash(Mod(num3 + 1, period), Mod(num4, period), seed); float num9 = Hash(Mod(num3, period), Mod(num4 + 1, period), seed); float num10 = Hash(Mod(num3 + 1, period), Mod(num4 + 1, period),