Decompiled source of Dynamite Launcher v2.0.0
plugins/DynamiteLauncher.dll
Decompiled a day 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.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using ExitGames.Client.Photon; using HarmonyLib; using Microsoft.CodeAnalysis; using Peak; using Photon.Pun; using Photon.Realtime; using TMPro; using UnityEngine; using UnityEngine.Rendering; using Zorro.ControllerSupport; using Zorro.Core; using Zorro.Settings; [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("DynamiteLauncher")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("2.0.0.0")] [assembly: AssemblyInformationalVersion("2.0.0+11af8eebae9a9da70e83539f4ce3ac2dc24c9605")] [assembly: AssemblyProduct("DynamiteLauncher")] [assembly: AssemblyTitle("DynamiteLauncher")] [assembly: AssemblyVersion("2.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace DynamiteLauncher { internal static class ExplosionRecolor { private const float GreenHueShift = 0.25f; private const int MaxTexturePixels = 4194304; private static readonly Dictionary<Texture, Texture> GreenTextures = new Dictionary<Texture, Texture>(); internal static void Apply(GameObject effect) { //IL_0013: 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) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //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_009a: 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) ParticleSystem[] componentsInChildren = effect.GetComponentsInChildren<ParticleSystem>(true); foreach (ParticleSystem obj in componentsInChildren) { MainModule main = obj.main; ((MainModule)(ref main)).startColor = Shift(((MainModule)(ref main)).startColor); ColorOverLifetimeModule colorOverLifetime = obj.colorOverLifetime; if (((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled) { ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = Shift(((ColorOverLifetimeModule)(ref colorOverLifetime)).color); } ColorBySpeedModule colorBySpeed = obj.colorBySpeed; if (((ColorBySpeedModule)(ref colorBySpeed)).enabled) { ((ColorBySpeedModule)(ref colorBySpeed)).color = Shift(((ColorBySpeedModule)(ref colorBySpeed)).color); } TrailModule trails = obj.trails; if (((TrailModule)(ref trails)).enabled) { ((TrailModule)(ref trails)).colorOverLifetime = Shift(((TrailModule)(ref trails)).colorOverLifetime); ((TrailModule)(ref trails)).colorOverTrail = Shift(((TrailModule)(ref trails)).colorOverTrail); } } Light[] componentsInChildren2 = effect.GetComponentsInChildren<Light>(true); foreach (Light obj2 in componentsInChildren2) { obj2.color = Shift(obj2.color); } Renderer[] componentsInChildren3 = effect.GetComponentsInChildren<Renderer>(true); for (int i = 0; i < componentsInChildren3.Length; i++) { Material[] materials = componentsInChildren3[i].materials; for (int j = 0; j < materials.Length; j++) { RecolorMaterial(materials[j]); } } } private static void RecolorMaterial(Material material) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Invalid comparison between Unknown and I4 Shader shader = material.shader; for (int i = 0; i < shader.GetPropertyCount(); i++) { string propertyName = shader.GetPropertyName(i); if (!material.HasProperty(propertyName)) { continue; } ShaderPropertyType propertyType = shader.GetPropertyType(i); if ((int)propertyType != 0) { if ((int)propertyType == 4 && !propertyName.Contains("Bump") && !propertyName.Contains("Normal")) { Texture texture = material.GetTexture(propertyName); Texture2D val = (Texture2D)(object)((texture is Texture2D) ? texture : null); if (val != null) { material.SetTexture(propertyName, Greened(val)); } } } else { material.SetColor(propertyName, Shift(material.GetColor(propertyName))); } } } private static Texture Greened(Texture2D source) { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown //IL_007b: Unknown result type (might be due to invalid IL or missing references) if (GreenTextures.TryGetValue((Texture)(object)source, out var value)) { return value; } if (((Texture)source).width * ((Texture)source).height > 4194304) { return (Texture)(object)source; } RenderTexture temporary = RenderTexture.GetTemporary(((Texture)source).width, ((Texture)source).height, 0, (RenderTextureFormat)0, (RenderTextureReadWrite)2); Graphics.Blit((Texture)(object)source, temporary); RenderTexture active = RenderTexture.active; RenderTexture.active = temporary; Texture2D val = new Texture2D(((Texture)source).width, ((Texture)source).height, (TextureFormat)4, false); val.ReadPixels(new Rect(0f, 0f, (float)((Texture)source).width, (float)((Texture)source).height), 0, 0); RenderTexture.active = active; RenderTexture.ReleaseTemporary(temporary); Color32[] pixels = val.GetPixels32(); for (int i = 0; i < pixels.Length; i++) { byte r = pixels[i].r; pixels[i].r = pixels[i].g; pixels[i].g = r; } val.SetPixels32(pixels); val.Apply(); GreenTextures[(Texture)(object)source] = (Texture)(object)val; return (Texture)(object)val; } private static Color Shift(Color color) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) float num = default(float); float num2 = default(float); float num3 = default(float); Color.RGBToHSV(color, ref num, ref num2, ref num3); Color result = Color.HSVToRGB((num + 0.25f) % 1f, num2, num3, true); result.a = color.a; return result; } private static Gradient Shift(Gradient gradient) { //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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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_0045: Expected O, but got Unknown GradientColorKey[] colorKeys = gradient.colorKeys; for (int i = 0; i < colorKeys.Length; i++) { colorKeys[i].color = Shift(colorKeys[i].color); } Gradient val = new Gradient(); val.SetKeys(colorKeys, gradient.alphaKeys); return val; } private static MinMaxGradient Shift(MinMaxGradient source) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected I4, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: 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_009f: 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) ParticleSystemGradientMode mode = ((MinMaxGradient)(ref source)).mode; switch ((int)mode) { case 0: return new MinMaxGradient(Shift(((MinMaxGradient)(ref source)).color)); case 2: return new MinMaxGradient(Shift(((MinMaxGradient)(ref source)).colorMin), Shift(((MinMaxGradient)(ref source)).colorMax)); case 1: return new MinMaxGradient(Shift(((MinMaxGradient)(ref source)).gradient)); case 3: return new MinMaxGradient(Shift(((MinMaxGradient)(ref source)).gradientMin), Shift(((MinMaxGradient)(ref source)).gradientMax)); case 4: { MinMaxGradient result = default(MinMaxGradient); ((MinMaxGradient)(ref result))..ctor(Shift(((MinMaxGradient)(ref source)).gradient)); ((MinMaxGradient)(ref result)).mode = (ParticleSystemGradientMode)4; return result; } default: return source; } } } public class FlareProjectile : MonoBehaviour { private const float CastMargin = 0.15f; private static readonly List<FlareProjectile> Active = new List<FlareProjectile>(); private Item _item; private float _age; private bool _finished; private bool _guided; private static Color FlareColor { get { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) Color result = default(Color); if (!ColorUtility.TryParseHtmlString(Plugin.FlareColorHex.Value, ref result)) { return Color.red; } return result; } } public Vector3 Direction { get; set; } public Item Source { get; set; } public int Variant { get; set; } private void Start() { //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) _item = ((Component)this).GetComponent<Item>(); _item.rig.useGravity = false; _item.blockInteraction = true; Active.Add(this); _guided = Variants.IsGuided(Variant); if (_guided && (Object)(object)Source != (Object)null && ((MonoBehaviourPun)Source).photonView.IsMine) { GuidedCamera.Begin(this); } if (Plugin.FlareLit.Value) { ((Component)this).GetComponent<Flare>().flareColor = FlareColor; _item.GetData<ColorItemData>((DataEntryKey)9).Value = FlareColor; _item.GetData<BoolItemData>((DataEntryKey)3).Value = true; } } private void OnDestroy() { Active.Remove(this); GuidedCamera.End(this); } private void FixedUpdate() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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) //IL_008b: 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_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) if (_finished) { return; } _age += Time.fixedDeltaTime; Rigidbody rig = _item.rig; rig.linearVelocity = Direction * Plugin.FlareSpeed.Value; rig.angularVelocity = Vector3.zero; rig.rotation = (_guided ? GuidedCamera.BodyRotation(Direction) : RotationFor(Direction)); float num = Plugin.FlareSpeed.Value * Time.fixedDeltaTime + 0.15f; RaycastHit[] array = Physics.SphereCastAll(rig.position, Plugin.FlareRadius.Value, Direction, num, LayerMask.op_Implicit(HelperFunctions.AllPhysical), (QueryTriggerInteraction)1); bool flag = false; float num2 = float.MaxValue; Vector3 point = Vector3.zero; RaycastHit[] array2 = array; Character val2 = default(Character); for (int i = 0; i < array2.Length; i++) { RaycastHit val = array2[i]; if (!((Component)((RaycastHit)(ref val)).collider).transform.IsChildOf(((Component)this).transform) && (!CharacterRagdoll.TryGetCharacterFromCollider(((RaycastHit)(ref val)).collider, ref val2) || !((Object)(object)val2 == (Object)(object)Character.localCharacter))) { bool flag2 = ((RaycastHit)(ref val)).distance <= 0f; if (((RaycastHit)(ref val)).distance < num2) { flag = true; num2 = ((RaycastHit)(ref val)).distance; point = (flag2 ? rig.position : (((RaycastHit)(ref val)).point + ((RaycastHit)(ref val)).normal * Plugin.ExplosionOffset.Value)); } } } if (flag) { Impact(point); } else if (_age >= Plugin.FlareLifetime.Value) { Finish(); } } public static void DetonateAll(Item source) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) for (int num = Active.Count - 1; num >= 0; num--) { FlareProjectile flareProjectile = Active[num]; if ((Object)(object)flareProjectile == (Object)null) { Active.RemoveAt(num); } else if ((Object)(object)flareProjectile.Source == (Object)(object)source && !flareProjectile._finished) { flareProjectile.Impact(((Component)flareProjectile).transform.position); } } } public static Quaternion RotationFor(Vector3 direction) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) return Quaternion.FromToRotation(Vector3.up, -direction); } internal static void Detonate(int variant, Vector3 point) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) if (Variants.IsJump(variant)) { JumpBlast.Trigger(point); } else { ((MonoBehaviour)Plugin.Instance).StartCoroutine(Plugin.Instance.ExplodeDynamite(point)); } } private void Impact(Vector3 point) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) Detonate(Variant, point); Finish(); } private void Finish() { _finished = true; GuidedCamera.End(this); PhotonNetwork.Destroy(((Component)this).gameObject); } } public static class GuidedCamera { private const float MaxPitch = 85f; private const float FlareSoundFactor = 0.1f; private const float CentimetresToMetres = 0.01f; private const float PercentToFactor = 0.01f; private const float MillisecondsPerSecond = 1000f; private static readonly Quaternion MountRotation = Quaternion.LookRotation(Vector3.down, Vector3.forward); private static FlareProjectile _flare; private static Vector3 _startPosition; private static Quaternion _startRotation; private static float _blend; private static AudioSource[] _sounds; private static float[] _soundVolumes; private static float _yaw; private static float _pitch; private static Vector2 _smoothedInput; public static bool Active => (Object)(object)_flare != (Object)null; public static void Begin(FlareProjectile flare) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) Transform transform = ((Component)MainCamera.instance).transform; _flare = flare; _startPosition = transform.position; _startRotation = transform.rotation; _blend = 0f; _smoothedInput = Vector2.zero; RememberSounds(flare); Vector3 direction = flare.Direction; Vector3 normalized = ((Vector3)(ref direction)).normalized; _yaw = Mathf.Atan2(normalized.x, normalized.z) * 57.29578f; _pitch = Mathf.Asin(Mathf.Clamp(normalized.y, -1f, 1f)) * 57.29578f; } public static void End(FlareProjectile flare) { if ((Object)(object)_flare == (Object)(object)flare) { _flare = null; } } internal static void Tick() { Character localCharacter = Character.localCharacter; if ((Object)(object)_flare == (Object)null || (Object)(object)localCharacter == (Object)null || localCharacter.data.dead || localCharacter.data.fullyPassedOut) { _flare = null; return; } float unscaledDeltaTime = Time.unscaledDeltaTime; Steer(localCharacter, unscaledDeltaTime); MuteSounds(); Mount(unscaledDeltaTime); } private static void RememberSounds(FlareProjectile flare) { _sounds = ((Component)flare).GetComponentsInChildren<AudioSource>(true); _soundVolumes = new float[_sounds.Length]; for (int i = 0; i < _sounds.Length; i++) { _soundVolumes[i] = _sounds[i].volume; } } private static void MuteSounds() { for (int i = 0; i < _sounds.Length; i++) { if ((Object)(object)_sounds[i] != (Object)null) { _sounds[i].volume = _soundVolumes[i] * 0.1f; } } } internal static Quaternion BodyRotation(Vector3 direction) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) return Quaternion.LookRotation(direction, Vector3.up) * Quaternion.Inverse(MountRotation); } private static void Mount(float deltaTime) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_002b: 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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) Quaternion val = BodyRotation(_flare.Direction); Vector3 val2 = new Vector3(0f, (float)Plugin.GuidedCameraBack.Value, (float)Plugin.GuidedCameraHeight.Value) * 0.01f; Vector3 val3 = ((Component)_flare).transform.position + val * val2; Quaternion val4 = val * MountRotation; _blend = Mathf.Min(1f, _blend + deltaTime * 1000f / (float)Plugin.GuidedCameraBlendTime.Value); float num = Mathf.SmoothStep(0f, 1f, _blend); ((Component)MainCamera.instance).transform.SetPositionAndRotation(Vector3.Lerp(_startPosition, val3, num), Quaternion.Slerp(_startRotation, val4, num)); } private static void Steer(Character character, float deltaTime) { //IL_000b: 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_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: 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_008a: 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_00a4: 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_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) SettingsHandler settingsHandler = GameHandler.Instance.SettingsHandler; float num = (((int)InputHandler.GetCurrentUsedInputScheme() == 0) ? ((FloatSetting)settingsHandler.GetSetting<MouseSensitivitySetting>()).Value : ((FloatSetting)settingsHandler.GetSetting<ControllerSensitivitySetting>()).Value); Vector2 val = character.input.lookInput * num * (float)Plugin.GuidedTurnSpeed.Value * 0.01f; val.x *= (((int)((EnumSetting<OffOnMode>)(object)settingsHandler.GetSetting<InvertXSetting>()).Value == 0) ? 1f : (-1f)); val.y *= (((int)((EnumSetting<OffOnMode>)(object)settingsHandler.GetSetting<InvertYSetting>()).Value == 0) ? 1f : (-1f)); _smoothedInput = Vector2.Lerp(_smoothedInput, val, 1f - Mathf.Exp((float)(-Plugin.GuidedTurnSmoothing.Value) * deltaTime)); _yaw += _smoothedInput.x; _pitch = Mathf.Clamp(_pitch + _smoothedInput.y, -85f, 85f); _flare.Direction = Quaternion.Euler(0f - _pitch, _yaw, 0f) * Vector3.forward; } } [HarmonyPatch(typeof(MainCameraMovement), "LateUpdate")] internal static class GuidedCameraPatch { private static void Postfix() { if (GuidedCamera.Active) { GuidedCamera.Tick(); } } } [HarmonyPatch(typeof(CharacterMovement), "CanMoveCamera")] internal static class GuidedLookLockPatch { private static void Postfix(ref bool __result) { if (GuidedCamera.Active) { __result = false; } } } [HarmonyPatch(typeof(GUIManager), "UpdateItemPrompts")] public static class ItemPromptPatch { private static void Postfix(GUIManager __instance) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected I4, but got Unknown Item val = (((Object)(object)Character.localCharacter != (Object)null) ? Character.localCharacter.data.currentItem : null); if ((Object)(object)val == (Object)null || (Object)(object)Character.localCharacter != (Object)(object)Character.observedCharacter) { return; } int num = Plugin.VariantOf(val); if (num != 0) { int num2 = (int)LocalizedText.CURRENT_LANGUAGE; bool flag = Variants.IsJump(num); ((TMP_Text)__instance.itemPromptMain).text = (flag ? LauncherText.FireForwardPrompts : LauncherText.FirePrompts)[num2]; ((Component)__instance.itemPromptMain).gameObject.SetActive(true); if (SecondaryUsePatch.UsesRightButton(num)) { ((TMP_Text)__instance.itemPromptSecondary).text = (flag ? LauncherText.FireBackPrompts : LauncherText.DetonatePrompts)[num2]; ((Component)__instance.itemPromptSecondary).gameObject.SetActive(true); } } } } [HarmonyPatch] internal static class ChargeSpeedPatch { private static IEnumerable<MethodBase> TargetMethods() { yield return AccessTools.Method(typeof(Item), "StartUsePrimary", (Type[])null, (Type[])null); yield return AccessTools.Method(typeof(Item), "ContinueUsePrimary", (Type[])null, (Type[])null); } private static void Prefix(Item __instance, out float? __state) { __state = null; float value = Plugin.ChargeSpeedMultiplier.Value; if (value != 1f && Plugin.VariantOf(__instance) != 0) { __state = __instance.usingTimePrimary; __instance.usingTimePrimary /= value; } } private static void Finalizer(Item __instance, float? __state) { if (__state.HasValue) { __instance.usingTimePrimary = __state.Value; } } } [HarmonyPatch(typeof(Action_RaycastSpawnSomething), "FixedUpdate")] public static class RangePatch { private static void Postfix(Item ___item) { if (Plugin.VariantOf(___item) != 0) { ___item.UIData.isShootable = true; } } } [HarmonyPatch(typeof(Action_ReduceUses), "ReduceUsesRPC")] public static class InfiniteAmmoPatch { private static bool Prefix(Item ___item) { return !Variants.InfiniteAmmo(Plugin.VariantOf(___item)); } } public static class JumpBlast { private const byte EventCode = 77; private const float FallDamageCapTime = 8f; private const float PushDuration = 0.15f; private const float MinimumFactor = 0.35f; private static GameObject _effectPrefab; private static GameObject _greenOrb; public static void Subscribe() { PhotonNetwork.NetworkingClient.EventReceived += OnEvent; } public static void Unsubscribe() { PhotonNetwork.NetworkingClient.EventReceived -= OnEvent; } public static void Trigger(Vector3 point) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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_003a: 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_004b: Expected O, but got Unknown SpawnEffect(point); PushSelf(point); PushOthers(point); PhotonNetwork.RaiseEvent((byte)77, (object)new float[3] { point.x, point.y, point.z }, new RaiseEventOptions { Receivers = (ReceiverGroup)0 }, SendOptions.SendReliable); } private static void OnEvent(EventData photonEvent) { //IL_0030: 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_004b: 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_0051: Unknown result type (might be due to invalid IL or missing references) if (photonEvent.Code != 77 || !(photonEvent.CustomData is float[] array) || array.Length != 3) { return; } Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(array[0], array[1], array[2]); SpawnEffect(val); Character localCharacter = Character.localCharacter; if ((Object)(object)localCharacter != (Object)null) { Vector3 val2 = localCharacter.Center - val; if (((Vector3)(ref val2)).sqrMagnitude <= Plugin.JumpBlastRange.Value * Plugin.JumpBlastRange.Value) { localCharacter.refs.movement.CapFallDamage(0f, 8f); } } } private static void SpawnEffect(Vector3 point) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_effectPrefab == (Object)null) { _effectPrefab = Resources.Load<GameObject>("0_Items/Dynamite").GetComponent<Dynamite>().explosionPrefab; } GameObject val = new GameObject("JumpBlastHolder"); val.SetActive(false); GameObject val2 = Object.Instantiate<GameObject>(_effectPrefab, point, Quaternion.identity, val.transform); AOE[] componentsInChildren = val2.GetComponentsInChildren<AOE>(true); for (int i = 0; i < componentsInChildren.Length; i++) { Object.DestroyImmediate((Object)(object)componentsInChildren[i]); } ExplosionEffect componentInChildren = val2.GetComponentInChildren<ExplosionEffect>(true); if ((Object)(object)componentInChildren != (Object)null && (Object)(object)componentInChildren.explosionOrb != (Object)null) { componentInChildren.explosionOrb = GreenOrb(componentInChildren.explosionOrb); } ExplosionRecolor.Apply(val2); val2.transform.SetParent((Transform)null, true); Object.Destroy((Object)(object)val); } private static GameObject GreenOrb(GameObject original) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown if ((Object)(object)_greenOrb != (Object)null) { return _greenOrb; } GameObject val = new GameObject("JumpBlastOrbTemplates"); val.SetActive(false); Object.DontDestroyOnLoad((Object)(object)val); _greenOrb = Object.Instantiate<GameObject>(original, val.transform); ExplosionRecolor.Apply(_greenOrb); return _greenOrb; } private static void PushSelf(Vector3 point) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0099: 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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) Character localCharacter = Character.localCharacter; if (!((Object)(object)localCharacter == (Object)null) && !localCharacter.data.dead) { Vector3 val = localCharacter.Center - point; float value = Plugin.JumpBlastRange.Value; float magnitude = ((Vector3)(ref val)).magnitude; if (!(magnitude > value)) { float num = Mathf.Max(1f - magnitude / value, 0.35f); Vector3 val2 = ((magnitude > 0.001f) ? (val / magnitude) : Vector3.zero) + Vector3.up * Plugin.JumpUpwardBias.Value; Vector3 acceleration = ((Vector3)(ref val2)).normalized * Plugin.JumpForce.Value * num / 0.15f; localCharacter.refs.movement.CapFallDamage(0f, 8f); ((MonoBehaviour)Plugin.Instance).StartCoroutine(PushOverTime(localCharacter, acceleration)); } } } private static IEnumerator PushOverTime(Character character, Vector3 acceleration) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) for (float elapsed = 0f; elapsed < 0.15f; elapsed += Time.fixedDeltaTime) { if (!((Object)(object)character != (Object)null)) { break; } foreach (Bodypart part in character.refs.ragdoll.partList) { part.AddForce(acceleration, (ForceMode)5); } yield return (object)new WaitForFixedUpdate(); } } private static void PushOthers(Vector3 point) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: 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) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_0100: 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_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) float value = Plugin.JumpBlastRange.Value; foreach (Character allCharacter in Character.AllCharacters) { if ((Object)(object)allCharacter == (Object)(object)Character.localCharacter || allCharacter.data.dead) { continue; } Vector3 val = allCharacter.Center - point; if (((Vector3)(ref val)).sqrMagnitude > value * value) { continue; } float num = 0f; foreach (Bodypart part in allCharacter.refs.ragdoll.partList) { num += part.Rig.mass; } num /= (float)allCharacter.refs.ragdoll.partList.Count; Vector3 val2 = ((Vector3)(ref val)).normalized + Vector3.up * Plugin.JumpUpwardBias.Value; Vector3 val3 = ((Vector3)(ref val2)).normalized * Plugin.JumpForce.Value * num; ((MonoBehaviourPun)allCharacter).photonView.RPC("RPCA_AddForceAtPosition", (RpcTarget)0, new object[3] { val3, point, value }); } } } public static class LauncherText { public static readonly string[] FirePrompts = new string[15] { "Fire", "Tirer", "Sparare", "Feuern", "Disparar", "Disparar", "Atirar", "Выстрел", "Постріл", "发射", "發射", "発射", "발사", "Strzał", "Ateş" }; public static readonly string[] DetonatePrompts = new string[15] { "Detonate", "Détoner", "Detonare", "Zünden", "Detonar", "Detonar", "Detonar", "Подрыв", "Підрив", "引爆", "引爆", "起爆", "기폭", "Detonuj", "Patlat" }; public static readonly string[] FireForwardPrompts = new string[15] { "Fire forward", "Tirer devant", "Spara avanti", "Nach vorne feuern", "Disparar adelante", "Disparar adelante", "Atirar para a frente", "Выстрел вперёд", "Постріл вперед", "向前发射", "向前發射", "前方に発射", "앞으로 발사", "Strzał w przód", "İleri ateş" }; public static readonly string[] FireBackPrompts = new string[15] { "Fire backward", "Tirer derrière", "Spara indietro", "Nach hinten feuern", "Disparar atrás", "Disparar atrás", "Atirar para trás", "Выстрел назад", "Постріл назад", "向后发射", "向後發射", "後方に発射", "뒤로 발사", "Strzał w tył", "Geriye ateş" }; public static readonly string[] SilverNames = new string[15] { "Dynamite Launcher", "Lance-dynamite", "Lanciadinamite", "Dynamit-Werfer", "Lanzadinamita", "Lanzadinamita", "Lança-dinamite", "Динамитомёт", "Динамітомет", "炸药发射器", "炸藥發射器", "ダイナマイトランチャー", "다이너마이트 발사기", "Wyrzutnia dynamitu", "Dinamit Fırlatıcı" }; public static readonly string[] GoldNames = new string[15] { "Golden Dynamite Launcher", "Lance-dynamite doré", "Lanciadinamite dorato", "Goldener Dynamit-Werfer", "Lanzadinamita dorado", "Lanzadinamita dorado", "Lança-dinamite dourado", "Золотой динамитомёт", "Золотий динамітомет", "黄金炸药发射器", "黃金炸藥發射器", "黄金のダイナマイトランチャー", "황금 다이너마이트 발사기", "Złota wyrzutnia dynamitu", "Altın Dinamit Fırlatıcı" }; public static readonly string[] SilverDescriptions = new string[15] { "Fires a slow red flare that turns into exploding dynamite on impact.", "Tire une fusée rouge lente qui devient de la dynamite explosive à l'impact.", "Spara un razzo rosso lento che diventa dinamite esplosiva all'impatto.", "Feuert eine langsame rote Leuchtfackel ab, die beim Aufprall zu explodierendem Dynamit wird.", "Dispara una bengala roja lenta que se convierte en dinamita explosiva al impactar.", "Dispara una bengala roja lenta que se convierte en dinamita explosiva al impactar.", "Dispara um sinalizador vermelho lento que vira dinamite explosiva ao impacto.", "Выпускает медленную красную сигнальную ракету, которая при ударе превращается во взрывающийся динамит.", "Випускає повільну червону сигнальну ракету, яка при ударі стає динамітом, що вибухає.", "发射缓慢飞行的红色信号弹,撞击后变成爆炸的炸药。", "發射緩慢飛行的紅色信號彈,撞擊後變成爆炸的炸藥。", "ゆっくり飛ぶ赤い信号弾を発射し、着弾するとダイナマイトが爆発する。", "느리게 날아가는 붉은 신호탄을 발사하며, 충돌하면 폭발하는 다이너마이트가 됩니다.", "Wystrzeliwuje wolną czerwoną racę, która po uderzeniu zamienia się w wybuchający dynamit.", "Yavaş uçan kırmızı bir fişek atar; çarpınca patlayan dinamite dönüşür." }; public static readonly string[] GoldDescriptions = new string[15] { "Fires a slow red flare that turns into exploding dynamite on impact. Infinite ammo.", "Tire une fusée rouge lente qui devient de la dynamite explosive à l'impact. Munitions infinies.", "Spara un razzo rosso lento che diventa dinamite esplosiva all'impatto. Munizioni infinite.", "Feuert eine langsame rote Leuchtfackel ab, die beim Aufprall zu explodierendem Dynamit wird. Unendlich Munition.", "Dispara una bengala roja lenta que se convierte en dinamita explosiva al impactar. Munición infinita.", "Dispara una bengala roja lenta que se convierte en dinamita explosiva al impactar. Munición infinita.", "Dispara um sinalizador vermelho lento que vira dinamite explosiva ao impacto. Munição infinita.", "Выпускает медленную красную сигнальную ракету, которая при ударе превращается во взрывающийся динамит. Бесконечные патроны.", "Випускає повільну червону сигнальну ракету, яка при ударі стає динамітом, що вибухає. Нескінченні патрони.", "发射缓慢飞行的红色信号弹,撞击后变成爆炸的炸药。弹药无限。", "發射緩慢飛行的紅色信號彈,撞擊後變成爆炸的炸藥。彈藥無限。", "ゆっくり飛ぶ赤い信号弾を発射し、着弾するとダイナマイトが爆発する。弾数無制限。", "느리게 날아가는 붉은 신호탄을 발사하며, 충돌하면 폭발하는 다이너마이트가 됩니다. 무한 탄약.", "Wystrzeliwuje wolną czerwoną racę, która po uderzeniu zamienia się w wybuchający dynamit. Nieskończona amunicja.", "Yavaş uçan kırmızı bir fişek atar; çarpınca patlayan dinamite dönüşür. Sınırsız mermi." }; public static readonly string[] JumpSilverNames = new string[15] { "Dynamite Jumper", "Saute-dynamite", "Salta-dinamite", "Dynamit-Springer", "Saltadinamita", "Saltadinamita", "Salta-dinamite", "Динамитный прыгун", "Динамітний стрибун", "炸药跳跃器", "炸藥跳躍器", "ダイナマイトジャンパー", "다이너마이트 점퍼", "Skoczek dynamitowy", "Dinamit Zıplatıcı" }; public static readonly string[] JumpGoldNames = new string[15] { "Golden Dynamite Jumper", "Saute-dynamite doré", "Salta-dinamite dorato", "Goldener Dynamit-Springer", "Saltadinamita dorado", "Saltadinamita dorado", "Salta-dinamite dourado", "Золотой динамитный прыгун", "Золотий динамітний стрибун", "黄金炸药跳跃器", "黃金炸藥跳躍器", "ゴールデン・ダイナマイトジャンパー", "황금 다이너마이트 점퍼", "Złoty skoczek dynamitowy", "Altın Dinamit Zıplatıcı" }; public static readonly string[] JumpSilverDescriptions = new string[15] { "Fires a slow flare that blasts you harmlessly away on impact. Shoot at your feet to jump. Hold right-click to fire from the rear.", "Tire une fusée lente dont l'impact vous projette sans danger. Tirez à vos pieds pour sauter. Clic droit : tir par l'arrière.", "Spara un razzo lento che all'impatto ti scaraventa via senza danni. Spara ai tuoi piedi per saltare. Clic destro: spara da dietro.", "Feuert eine langsame Leuchtfackel ab, deren Aufprall dich ungefährlich wegschleudert. Schieße auf deine Füße, um zu springen. Rechtsklick feuert nach hinten.", "Dispara una bengala lenta cuyo impacto te lanza sin hacerte daño. Dispara a tus pies para saltar. Clic derecho: dispara hacia atrás.", "Dispara una bengala lenta cuyo impacto te lanza sin hacerte daño. Dispara a tus pies para saltar. Clic derecho: dispara hacia atrás.", "Dispara um sinalizador lento cujo impacto te arremessa sem causar dano. Atire nos seus pés para pular. Clique direito: atira para trás.", "Выпускает медленную ракету, взрыв которой безвредно отбрасывает вас. Стреляйте себе под ноги, чтобы прыгнуть. Правая кнопка мыши — выстрел назад.", "Випускає повільну ракету, вибух якої безпечно відкидає вас. Стріляйте собі під ноги, щоб стрибнути. Права кнопка миші — постріл назад.", "发射缓慢飞行的信号弹,撞击后会无伤地把你弹开。朝脚下射击即可起跳。右键:向后发射。", "發射緩慢飛行的信號彈,撞擊後會無傷地把你彈開。朝腳下射擊即可起跳。右鍵:向後發射。", "ゆっくり飛ぶ信号弾を発射し、着弾すると無害に吹き飛ばす。足元を撃てばジャンプできる。右クリックで後方に発射。", "느리게 날아가는 신호탄을 발사하며, 충돌하면 피해 없이 날려 보냅니다. 발밑을 쏘면 점프할 수 있습니다. 우클릭으로 뒤로 발사.", "Wystrzeliwuje wolną racę, której uderzenie odrzuca cię bez obrażeń. Strzel pod nogi, by skoczyć. Prawy przycisk myszy strzela do tyłu.", "Yavaş bir fişek atar; çarpınca seni zarar vermeden savurur. Zıplamak için ayaklarına ateş et. Sağ tık geriye ateş eder." }; public static readonly string[] JumpGoldDescriptions = new string[15] { "Fires a slow flare that blasts you harmlessly away on impact. Shoot at your feet to jump. Hold right-click to fire from the rear. Infinite ammo.", "Tire une fusée lente dont l'impact vous projette sans danger. Tirez à vos pieds pour sauter. Clic droit : tir par l'arrière. Munitions infinies.", "Spara un razzo lento che all'impatto ti scaraventa via senza danni. Spara ai tuoi piedi per saltare. Clic destro: spara da dietro. Munizioni infinite.", "Feuert eine langsame Leuchtfackel ab, deren Aufprall dich ungefährlich wegschleudert. Schieße auf deine Füße, um zu springen. Rechtsklick feuert nach hinten. Unendlich Munition.", "Dispara una bengala lenta cuyo impacto te lanza sin hacerte daño. Dispara a tus pies para saltar. Clic derecho: dispara hacia atrás. Munición infinita.", "Dispara una bengala lenta cuyo impacto te lanza sin hacerte daño. Dispara a tus pies para saltar. Clic derecho: dispara hacia atrás. Munición infinita.", "Dispara um sinalizador lento cujo impacto te arremessa sem causar dano. Atire nos seus pés para pular. Clique direito: atira para trás. Munição infinita.", "Выпускает медленную ракету, взрыв которой безвредно отбрасывает вас. Стреляйте себе под ноги, чтобы прыгнуть. Правая кнопка мыши — выстрел назад. Бесконечные заряды.", "Випускає повільну ракету, вибух якої безпечно відкидає вас. Стріляйте собі під ноги, щоб стрибнути. Права кнопка миші — постріл назад. Нескінченні заряди.", "发射缓慢飞行的信号弹,撞击后会无伤地把你弹开。朝脚下射击即可起跳。右键:向后发射。 无限弹药。", "發射緩慢飛行的信號彈,撞擊後會無傷地把你彈開。朝腳下射擊即可起跳。右鍵:向後發射。 無限彈藥。", "ゆっくり飛ぶ信号弾を発射し、着弾すると無害に吹き飛ばす。足元を撃てばジャンプできる。右クリックで後方に発射。 弾薬無限。", "느리게 날아가는 신호탄을 발사하며, 충돌하면 피해 없이 날려 보냅니다. 발밑을 쏘면 점프할 수 있습니다. 우클릭으로 뒤로 발사. 무한 탄약.", "Wystrzeliwuje wolną racę, której uderzenie odrzuca cię bez obrażeń. Strzel pod nogi, by skoczyć. Prawy przycisk myszy strzela do tyłu. Nieskończona amunicja.", "Yavaş bir fişek atar; çarpınca seni zarar vermeden savurur. Zıplamak için ayaklarına ateş et. Sağ tık geriye ateş eder. Sınırsız mühimmat." }; public static readonly string[] GuidedSilverNames = new string[15] { "Guided Dynamite Launcher", "Lance-dynamite guidé", "Lanciadinamite guidato", "Gelenkter Dynamit-Werfer", "Lanzadinamita guiado", "Lanzadinamita guiado", "Lança-dinamite guiado", "Управляемый динамитомёт", "Кермований динамітомет", "制导炸药发射器", "導引炸藥發射器", "誘導ダイナマイトランチャー", "유도 다이너마이트 발사기", "Kierowana wyrzutnia dynamitu", "Güdümlü Dinamit Fırlatıcı" }; public static readonly string[] GuidedGoldNames = new string[15] { "Golden Guided Dynamite Launcher", "Lance-dynamite guidé doré", "Lanciadinamite guidato dorato", "Goldener gelenkter Dynamit-Werfer", "Lanzadinamita guiado dorado", "Lanzadinamita guiado dorado", "Lança-dinamite guiado dourado", "Золотой управляемый динамитомёт", "Золотий кермований динамітомет", "黄金制导炸药发射器", "黃金導引炸藥發射器", "黄金の誘導ダイナマイトランチャー", "황금 유도 다이너마이트 발사기", "Złota kierowana wyrzutnia dynamitu", "Altın Güdümlü Dinamit Fırlatıcı" }; public static readonly string[] GuidedSilverDescriptions = new string[15] { "Fires a slow flare you steer with the mouse while the camera follows it. Impact or right-click detonates it and snaps the view back.", "Tire une fusée lente que vous pilotez à la souris pendant que la caméra la suit. L'impact ou le clic droit la fait exploser et rend la vue instantanément.", "Spara un razzo lento che guidi con il mouse mentre la telecamera lo segue. L'impatto o il clic destro lo fa esplodere e la vista torna subito indietro.", "Feuert eine langsame Leuchtfackel ab, die du mit der Maus lenkst, während die Kamera ihr folgt. Aufprall oder Rechtsklick zündet sie, die Ansicht springt sofort zurück.", "Dispara una bengala lenta que diriges con el ratón mientras la cámara la sigue. El impacto o el clic derecho la detona y la vista vuelve al instante.", "Dispara una bengala lenta que diriges con el ratón mientras la cámara la sigue. El impacto o el clic derecho la detona y la vista vuelve al instante.", "Dispara um sinalizador lento que você guia com o mouse enquanto a câmera o segue. O impacto ou o clique direito o detona e a visão volta na hora.", "Выпускает медленную ракету, которой вы управляете мышью, пока камера летит за ней. Удар или правая кнопка мыши взрывают её, и камера мгновенно возвращается.", "Випускає повільну ракету, якою ви керуєте мишею, поки камера летить за нею. Удар або права кнопка миші підривають її, і камера миттєво повертається.", "发射缓慢飞行的信号弹,可用鼠标操控,镜头会跟随。撞击或右键引爆,视角立刻回到玩家。", "發射緩慢飛行的信號彈,可用滑鼠操控,鏡頭會跟隨。撞擊或右鍵引爆,視角立刻回到玩家。", "ゆっくり飛ぶ信号弾をマウスで操縦し、カメラが追従する。着弾か右クリックで起爆し、視点は即座に戻る。", "느리게 날아가는 신호탄을 마우스로 조종하며 카메라가 따라갑니다. 충돌하거나 우클릭하면 기폭하고 시점이 즉시 돌아옵니다.", "Wystrzeliwuje wolną racę sterowaną myszą, za którą podąża kamera. Uderzenie lub prawy przycisk myszy detonuje ją, a widok natychmiast wraca.", "Fareyle yönlendirdiğin yavaş bir fişek atar; kamera onu izler. Çarpma veya sağ tık patlatır ve görüş anında geri döner." }; public static readonly string[] GuidedGoldDescriptions = new string[15] { "Fires a slow flare you steer with the mouse while the camera follows it. Impact or right-click detonates it and snaps the view back. Infinite ammo.", "Tire une fusée lente que vous pilotez à la souris pendant que la caméra la suit. L'impact ou le clic droit la fait exploser et rend la vue instantanément. Munitions infinies.", "Spara un razzo lento che guidi con il mouse mentre la telecamera lo segue. L'impatto o il clic destro lo fa esplodere e la vista torna subito indietro. Munizioni infinite.", "Feuert eine langsame Leuchtfackel ab, die du mit der Maus lenkst, während die Kamera ihr folgt. Aufprall oder Rechtsklick zündet sie, die Ansicht springt sofort zurück. Unendlich Munition.", "Dispara una bengala lenta que diriges con el ratón mientras la cámara la sigue. El impacto o el clic derecho la detona y la vista vuelve al instante. Munición infinita.", "Dispara una bengala lenta que diriges con el ratón mientras la cámara la sigue. El impacto o el clic derecho la detona y la vista vuelve al instante. Munición infinita.", "Dispara um sinalizador lento que você guia com o mouse enquanto a câmera o segue. O impacto ou o clique direito o detona e a visão volta na hora. Munição infinita.", "Выпускает медленную ракету, которой вы управляете мышью, пока камера летит за ней. Удар или правая кнопка мыши взрывают её, и камера мгновенно возвращается. Бесконечные патроны.", "Випускає повільну ракету, якою ви керуєте мишею, поки камера летить за нею. Удар або права кнопка миші підривають її, і камера миттєво повертається. Нескінченні патрони.", "发射缓慢飞行的信号弹,可用鼠标操控,镜头会跟随。撞击或右键引爆,视角立刻回到玩家。弹药无限。", "發射緩慢飛行的信號彈,可用滑鼠操控,鏡頭會跟隨。撞擊或右鍵引爆,視角立刻回到玩家。彈藥無限。", "ゆっくり飛ぶ信号弾をマウスで操縦し、カメラが追従する。着弾か右クリックで起爆し、視点は即座に戻る。弾数無制限。", "느리게 날아가는 신호탄을 마우스로 조종하며 카메라가 따라갑니다. 충돌하거나 우클릭하면 기폭하고 시점이 즉시 돌아옵니다. 무한 탄약.", "Wystrzeliwuje wolną racę sterowaną myszą, za którą podąża kamera. Uderzenie lub prawy przycisk myszy detonuje ją, a widok natychmiast wraca. Nieskończona amunicja.", "Fareyle yönlendirdiğin yavaş bir fişek atar; kamera onu izler. Çarpma veya sağ tık patlatır ve görüş anında geri döner. Sınırsız mühimmat." }; } [HarmonyPatch(typeof(LootData), "GetRandomItems")] internal static class LauncherLootPoolPatch { private static void Prefix(SpawnPool __0, out (SpawnPool Pool, Dictionary<ushort, int> Original) __state) { //IL_0076: 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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) __state = default((SpawnPool, Dictionary<ushort, int>)); if (!Plugin.SpawnInLoot.Value || !PhotonNetwork.InRoom || !PhotonNetwork.IsMasterClient || (Object)(object)Plugin.SilverPrefab == (Object)null || (Object)(object)Plugin.GoldPrefab == (Object)null || (Object)(object)Plugin.JumpSilverPrefab == (Object)null || (Object)(object)Plugin.JumpGoldPrefab == (Object)null || (Object)(object)Plugin.GuidedSilverPrefab == (Object)null || (Object)(object)Plugin.GuidedGoldPrefab == (Object)null) { return; } Dictionary<ushort, int> dictionary = new Dictionary<ushort, int>(); AddFamily(__0, Plugin.EnableMagicalLoot.Value, Plugin.EnableRareChestLoot.Value, Plugin.ChestLootRarity.Value, Plugin.SilverPrefab, Plugin.GoldPrefab, dictionary); AddFamily(__0, Plugin.JumperEnableMagicalLoot.Value, Plugin.JumperEnableRareChestLoot.Value, Plugin.JumperChestLootRarity.Value, Plugin.JumpSilverPrefab, Plugin.JumpGoldPrefab, dictionary); AddFamily(__0, Plugin.GuidedEnableMagicalLoot.Value, Plugin.GuidedEnableRareChestLoot.Value, Plugin.GuidedChestLootRarity.Value, Plugin.GuidedSilverPrefab, Plugin.GuidedGoldPrefab, dictionary); if (dictionary.Count == 0) { return; } if (LootData.AllSpawnWeightData == null) { LootData.PopulateLootData(); } SpawnPool val = EffectivePool(__0); if (!LootData.AllSpawnWeightData.TryGetValue(val, out var value)) { return; } Dictionary<ushort, int> dictionary2 = new Dictionary<ushort, int>(value); foreach (KeyValuePair<ushort, int> item in dictionary) { dictionary2[item.Key] = (LootData.RarityWeights.TryGetValue((Rarity)item.Value, out var value2) ? value2 : LootData.RarityWeights[(Rarity)2]); } __state = (Pool: val, Original: value); LootData.AllSpawnWeightData[val] = dictionary2; } private static void AddFamily(SpawnPool pool, bool magicalEnabled, bool chestEnabled, Rarity chestRarity, GameObject silver, GameObject gold, Dictionary<ushort, int> additions) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Invalid comparison between Unknown and I4 //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Invalid comparison between Unknown and I4 //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Invalid comparison between Unknown and I4 //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Invalid comparison between Unknown and I4 //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Invalid comparison between Unknown and I4 //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Invalid comparison between Unknown and I4 //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Invalid comparison between Unknown and I4 //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Invalid comparison between Unknown and I4 //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Invalid comparison between Unknown and I4 //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Invalid comparison between Unknown and I4 //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Invalid comparison between Unknown and I4 //IL_0080: 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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Invalid comparison between Unknown and I4 //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Invalid comparison between Unknown and I4 //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Invalid comparison between Unknown and I4 //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Expected I4, but got Unknown //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected I4, but got Unknown Rarity val; if ((int)pool <= 16384) { if ((int)pool <= 2048) { if ((int)pool != 1024 && (int)pool != 2048) { return; } } else if ((int)pool != 4096 && (int)pool != 8192 && (int)pool != 16384) { return; } } else if ((int)pool <= 16777216) { if ((int)pool == 32768 || (int)pool == 131072) { if (!magicalEnabled) { return; } val = (Rarity)5; goto IL_0082; } if ((int)pool != 16777216) { return; } } else if ((int)pool != 67108864 && (int)pool != 268435456 && (int)pool != 536870912) { return; } if (!chestEnabled) { return; } val = chestRarity; goto IL_0082; IL_0082: additions[silver.GetComponent<Item>().itemID] = (int)val; additions[gold.GetComponent<Item>().itemID] = (int)val; } private static void Finalizer((SpawnPool Pool, Dictionary<ushort, int> Original) __state) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) if (__state.Original != null) { LootData.AllSpawnWeightData[__state.Pool] = __state.Original; } } private static SpawnPool EffectivePool(SpawnPool pool) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) if (RunSettings.GetValue((SETTINGTYPE)20010, false) != 1) { return pool; } return (SpawnPool)134217728; } } [HarmonyPatch(typeof(PhotonNetwork), "InstantiateItemRoom")] internal static class LauncherLootSpawnPatch { private static void Prefix(ref string __0, out int __state) { __state = 0; if (PhotonNetwork.InRoom && PhotonNetwork.IsMasterClient) { __state = Variants.FromPrefabName(__0); if (__state != 0) { __0 = "AntiZooka"; } } } private static void Postfix(GameObject __result, int __state) { if (__state != 0 && (Object)(object)__result != (Object)null) { Plugin.InitializeLauncher(__result.GetComponent<Item>(), __state); } } } [BepInPlugin("capitan.peak.dynamitelauncher", "Dynamite Launcher", "2.0.0")] public class Plugin : BaseUnityPlugin { public const string SilverPrefabName = "DynamiteLauncher"; public const string GoldPrefabName = "DynamiteLauncherGold"; public const string JumpSilverPrefabName = "DynamiteJumper"; public const string JumpGoldPrefabName = "DynamiteJumperGold"; public const string GuidedSilverPrefabName = "DynamiteGuided"; public const string GuidedGoldPrefabName = "DynamiteGuidedGold"; internal const string SourcePrefabName = "AntiZooka"; internal const string ItemsFolder = "0_Items/"; internal const string DynamitePrefabName = "Dynamite"; internal const string FlarePrefabName = "Flare"; private const float ReloadDelay = 0.3f; public const DataEntryKey VariantKey = (DataEntryKey)200; public const DataEntryKey CreatorKey = (DataEntryKey)201; public const int SilverVariant = 1; public const int GoldVariant = 2; public const int JumpSilverVariant = 3; public const int JumpGoldVariant = 4; public const int GuidedSilverVariant = 5; public const int GuidedGoldVariant = 6; private FileSystemWatcher _configWatcher; private volatile bool _changed; private float _reloadAt; private bool _registered; public static Plugin Instance { get; private set; } public static Texture2D Camo { get; private set; } public static Texture2D SilverAtlas { get; private set; } public static Texture2D SilverIcon { get; private set; } public static Texture2D GoldIcon { get; private set; } public static GameObject SilverPrefab { get; private set; } public static GameObject GoldPrefab { get; private set; } public static Texture2D CamoGreen { get; private set; } public static Texture2D JumpSilverIcon { get; private set; } public static Texture2D JumpGoldIcon { get; private set; } public static GameObject JumpSilverPrefab { get; private set; } public static GameObject JumpGoldPrefab { get; private set; } public static Texture2D CamoBlue { get; private set; } public static Texture2D GuidedSilverIcon { get; private set; } public static Texture2D GuidedGoldIcon { get; private set; } public static GameObject GuidedSilverPrefab { get; private set; } public static GameObject GuidedGoldPrefab { get; private set; } internal static ConfigEntry<bool> SpawnInLoot { get; private set; } internal static ConfigEntry<bool> EnableRareChestLoot { get; private set; } internal static ConfigEntry<Rarity> ChestLootRarity { get; private set; } internal static ConfigEntry<bool> EnableMagicalLoot { get; private set; } internal static ConfigEntry<bool> JumperEnableRareChestLoot { get; private set; } internal static ConfigEntry<Rarity> JumperChestLootRarity { get; private set; } internal static ConfigEntry<bool> JumperEnableMagicalLoot { get; private set; } internal static ConfigEntry<bool> GuidedEnableRareChestLoot { get; private set; } internal static ConfigEntry<Rarity> GuidedChestLootRarity { get; private set; } internal static ConfigEntry<bool> GuidedEnableMagicalLoot { get; private set; } public static ConfigEntry<int> GuidedSilverAmmo { get; private set; } public static ConfigEntry<bool> GuidedGoldInfiniteAmmo { get; private set; } public static ConfigEntry<int> GuidedCameraHeight { get; private set; } public static ConfigEntry<int> GuidedCameraBack { get; private set; } public static ConfigEntry<int> GuidedCameraBlendTime { get; private set; } public static ConfigEntry<int> GuidedTurnSpeed { get; private set; } public static ConfigEntry<int> GuidedTurnSmoothing { get; private set; } public static ConfigEntry<int> JumpSilverAmmo { get; private set; } public static ConfigEntry<bool> JumpGoldInfiniteAmmo { get; private set; } public static ConfigEntry<float> JumpForce { get; private set; } public static ConfigEntry<float> JumpBlastRange { get; private set; } public static ConfigEntry<float> JumpUpwardBias { get; private set; } public static ConfigEntry<int> SilverAmmo { get; private set; } public static ConfigEntry<bool> GoldInfiniteAmmo { get; private set; } public static ConfigEntry<float> ChargeSpeedMultiplier { get; private set; } public static ConfigEntry<bool> DetonateOnRightClick { get; private set; } public static ConfigEntry<bool> ReplaceOthersShots { get; private set; } public static ConfigEntry<float> FlareSpeed { get; private set; } public static ConfigEntry<float> FlareLifetime { get; private set; } public static ConfigEntry<float> FlareRadius { get; private set; } public static ConfigEntry<float> FlareSpawnOffset { get; private set; } public static ConfigEntry<bool> FlareLit { get; private set; } public static ConfigEntry<string> FlareColorHex { get; private set; } public static ConfigEntry<float> ExplosionOffset { get; private set; } public static ConfigEntry<float> DynamiteDestroyDelay { get; private set; } public static ConfigEntry<bool> CamoEnabled { get; private set; } public static ConfigEntry<bool> SilverTrim { get; private set; } private void Awake() { //IL_0074: Unknown result type (might be due to invalid IL or missing references) Instance = this; BindConfig(); LoadTextures(); CamoEnabled.SettingChanged += delegate { CamoPatch.RefreshAll(); }; SilverTrim.SettingChanged += delegate { CamoPatch.RefreshAll(); }; JumpBlast.Subscribe(); StartConfigWatcher(); new Harmony("capitan.peak.dynamitelauncher").PatchAll(); } private void BindConfig() { //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Expected O, but got Unknown //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Expected O, but got Unknown //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Expected O, but got Unknown //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Expected O, but got Unknown //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Expected O, but got Unknown //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Expected O, but got Unknown //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Expected O, but got Unknown //IL_0327: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Expected O, but got Unknown //IL_0364: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Expected O, but got Unknown //IL_03a1: Unknown result type (might be due to invalid IL or missing references) //IL_03ab: Expected O, but got Unknown //IL_03d6: Unknown result type (might be due to invalid IL or missing references) //IL_03e0: Expected O, but got Unknown //IL_0433: Unknown result type (might be due to invalid IL or missing references) //IL_043d: Expected O, but got Unknown //IL_04b0: Unknown result type (might be due to invalid IL or missing references) //IL_04ba: Expected O, but got Unknown //IL_04ed: Unknown result type (might be due to invalid IL or missing references) //IL_04f7: Expected O, but got Unknown //IL_052a: Unknown result type (might be due to invalid IL or missing references) //IL_0534: Expected O, but got Unknown SpawnInLoot = ((BaseUnityPlugin)this).Config.Bind<bool>("Loot", "SpawnInLoot", false, "Host only. Master switch: while false, no launcher or jumper appears in world loot, whatever the settings below say."); EnableRareChestLoot = ((BaseUnityPlugin)this).Config.Bind<bool>("Loot", "EnableRareChestLoot", false, "Host only. Add both launchers to ordinary luggage using ChestLootRarity."); ChestLootRarity = ((BaseUnityPlugin)this).Config.Bind<Rarity>("Loot", "ChestLootRarity", (Rarity)2, "Host only. Rarity of both launchers in ordinary luggage when EnableRareChestLoot is enabled."); EnableMagicalLoot = ((BaseUnityPlugin)this).Config.Bind<bool>("Loot", "EnableMagicalLoot", false, "Host only. Add both launchers to statue rewards and ancient luggage as Mythic loot."); JumperEnableRareChestLoot = ((BaseUnityPlugin)this).Config.Bind<bool>("Loot", "JumperEnableRareChestLoot", false, "Host only. Add both Dynamite Jumpers to ordinary luggage using JumperChestLootRarity."); JumperChestLootRarity = ((BaseUnityPlugin)this).Config.Bind<Rarity>("Loot", "JumperChestLootRarity", (Rarity)2, "Host only. Rarity of both Dynamite Jumpers in ordinary luggage when JumperEnableRareChestLoot is enabled."); JumperEnableMagicalLoot = ((BaseUnityPlugin)this).Config.Bind<bool>("Loot", "JumperEnableMagicalLoot", false, "Host only. Add both Dynamite Jumpers to statue rewards and ancient luggage as Mythic loot."); GuidedEnableRareChestLoot = ((BaseUnityPlugin)this).Config.Bind<bool>("Loot", "GuidedEnableRareChestLoot", false, "Host only. Add both Guided Dynamite Launchers to ordinary luggage using GuidedChestLootRarity."); GuidedChestLootRarity = ((BaseUnityPlugin)this).Config.Bind<Rarity>("Loot", "GuidedChestLootRarity", (Rarity)2, "Host only. Rarity of both Guided Dynamite Launchers in ordinary luggage when GuidedEnableRareChestLoot is enabled."); GuidedEnableMagicalLoot = ((BaseUnityPlugin)this).Config.Bind<bool>("Loot", "GuidedEnableMagicalLoot", false, "Host only. Add both Guided Dynamite Launchers to statue rewards and ancient luggage as Mythic loot."); GuidedSilverAmmo = ((BaseUnityPlugin)this).Config.Bind<int>("Guided", "SilverAmmo", 3, new ConfigDescription("Shots in the silver Guided Dynamite Launcher. Applies to newly spawned launchers.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 999), Array.Empty<object>())); GuidedGoldInfiniteAmmo = ((BaseUnityPlugin)this).Config.Bind<bool>("Guided", "GoldInfiniteAmmo", true, "If false, the golden Guided Dynamite Launcher spends ammo like the silver one."); GuidedCameraHeight = ((BaseUnityPlugin)this).Config.Bind<int>("Guided", "CameraHeightCm", 30, new ConfigDescription("How far above the flare axis the camera is mounted, in centimetres (fixed to the flare).", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 3000), Array.Empty<object>())); GuidedCameraBack = ((BaseUnityPlugin)this).Config.Bind<int>("Guided", "CameraBackCm", 30, new ConfigDescription("How far behind the flare centre the camera is mounted, in centimetres (fixed to the flare).", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 3000), Array.Empty<object>())); GuidedCameraBlendTime = ((BaseUnityPlugin)this).Config.Bind<int>("Guided", "CameraBlendMs", 400, new ConfigDescription("How long the camera takes to fly from your eyes onto the flare, in milliseconds.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(50, 3000), Array.Empty<object>())); GuidedTurnSpeed = ((BaseUnityPlugin)this).Config.Bind<int>("Guided", "TurnSpeedPercent", 100, new ConfigDescription("Mouse steering strength in percent, on top of the game's mouse sensitivity setting.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(10, 500), Array.Empty<object>())); GuidedTurnSmoothing = ((BaseUnityPlugin)this).Config.Bind<int>("Guided", "TurnSmoothing", 8, new ConfigDescription("How quickly steering follows the mouse. Lower is smoother but laggier.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 60), Array.Empty<object>())); JumpSilverAmmo = ((BaseUnityPlugin)this).Config.Bind<int>("Jumper", "SilverAmmo", 3, new ConfigDescription("Shots in the silver Dynamite Jumper. Applies to newly spawned jumpers.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 999), Array.Empty<object>())); JumpGoldInfiniteAmmo = ((BaseUnityPlugin)this).Config.Bind<bool>("Jumper", "GoldInfiniteAmmo", true, "If false, the gold Dynamite Jumper spends ammo like the silver one."); JumpForce = ((BaseUnityPlugin)this).Config.Bind<float>("Jumper", "LaunchSpeed", 120f, new ConfigDescription("Speed in m/s the blast gives at point-blank range; it fades with distance.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 300f), Array.Empty<object>())); JumpBlastRange = ((BaseUnityPlugin)this).Config.Bind<float>("Jumper", "BlastRange", 6f, new ConfigDescription("Radius of the blast; the push fades with distance.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 30f), Array.Empty<object>())); JumpUpwardBias = ((BaseUnityPlugin)this).Config.Bind<float>("Jumper", "UpwardBias", 0.7f, new ConfigDescription("Extra upward component of the push. 0 pushes straight away from the blast point.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 5f), Array.Empty<object>())); SilverAmmo = ((BaseUnityPlugin)this).Config.Bind<int>("Ammo", "SilverAmmo", 3, new ConfigDescription("Shots in the silver launcher. Applies to newly spawned launchers; the host's value matters for synced items.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 999), Array.Empty<object>())); GoldInfiniteAmmo = ((BaseUnityPlugin)this).Config.Bind<bool>("Ammo", "GoldInfiniteAmmo", true, "If false, the gold launcher spends ammo like the silver one."); ChargeSpeedMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Launcher", "ChargeSpeedMultiplier", 1f, new ConfigDescription("Charge speed for both launcher variants. 1 keeps the stock speed; 2 charges twice as fast.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 10f), Array.Empty<object>())); DetonateOnRightClick = ((BaseUnityPlugin)this).Config.Bind<bool>("Launcher", "DetonateOnRightClick", true, "Right mouse button detonates all flares in flight fired from the launcher you hold."); ReplaceOthersShots = ((BaseUnityPlugin)this).Config.Bind<bool>("Launcher", "ReplaceOthersShots", false, "Launchers you created: when a player without the mod fires one, replace their anti-gravity sphere with the flare (you must be in the room)."); FlareSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Flare", "Speed", 14f, new ConfigDescription("Flare flight speed, m/s.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 200f), Array.Empty<object>())); FlareLifetime = ((BaseUnityPlugin)this).Config.Bind<float>("Flare", "LifetimeSeconds", 25f, new ConfigDescription("The flare is deleted after this many seconds without hitting anything.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 600f), Array.Empty<object>())); FlareRadius = ((BaseUnityPlugin)this).Config.Bind<float>("Flare", "CollisionRadius", 0.12f, new ConfigDescription("Sphere-cast radius used to detect obstacles.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.01f, 2f), Array.Empty<object>())); FlareSpawnOffset = ((BaseUnityPlugin)this).Config.Bind<float>("Flare", "SpawnOffset", 0.6f, "Distance in front of the muzzle where the flare appears."); FlareLit = ((BaseUnityPlugin)this).Config.Bind<bool>("Flare", "Lit", true, "Fire a lit, glowing flare. If false, the flare flies unlit."); FlareColorHex = ((BaseUnityPlugin)this).Config.Bind<string>("Flare", "ColorHex", "#FF1A1A", "Flare light color as HTML hex, e.g. #FF1A1A."); ExplosionOffset = ((BaseUnityPlugin)this).Config.Bind<float>("Explosion", "OffsetFromSurface", 0.3f, "How far from the hit surface (along its normal) the dynamite explodes."); DynamiteDestroyDelay = ((BaseUnityPlugin)this).Config.Bind<float>("Explosion", "DynamiteDestroyDelaySeconds", 0.2f, "Time before the exploded dynamite object is removed."); SilverTrim = ((BaseUnityPlugin)this).Config.Bind<bool>("Visual", "SilverTrim", true, "Silver stars/outline/frame on the silver launcher (local only); gold launcher keeps the original gold."); CamoEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Visual", "Camo", true, "Red camo on the launcher barrel (local only)."); } private void LoadTextures() { Camo = LoadCamo("camo_red.png"); CamoGreen = LoadCamo("camo_green.png"); CamoBlue = LoadCamo("camo_blue.png"); SilverAtlas = LoadTexture("silver_atlas.png"); GuidedSilverIcon = LoadTexture("icon_blue_silver.png"); GuidedGoldIcon = LoadTexture("icon_blue_gold.png"); JumpSilverIcon = LoadTexture("icon_jump_silver.png"); JumpGoldIcon = LoadTexture("icon_jump_gold.png"); SilverIcon = LoadTexture("icon_silver.png"); GoldIcon = LoadTexture("icon_gold.png"); } private void StartConfigWatcher() { _configWatcher = new FileSystemWatcher(Path.GetDirectoryName(((BaseUnityPlugin)this).Config.ConfigFilePath), Path.GetFileName(((BaseUnityPlugin)this).Config.ConfigFilePath)) { NotifyFilter = (NotifyFilters.FileName | NotifyFilters.Size | NotifyFilters.LastWrite), EnableRaisingEvents = true }; _configWatcher.Changed += delegate { _changed = true; }; _configWatcher.Created += delegate { _changed = true; }; } private void OnDestroy() { JumpBlast.Unsubscribe(); _configWatcher?.Dispose(); } private static Texture2D LoadCamo(string fileName) { Texture2D obj = LoadTexture(fileName); ((Texture)obj).wrapMode = (TextureWrapMode)0; obj.Compress(true); return obj; } private static Texture2D LoadTexture(string fileName) { //IL_003f: 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_0050: Expected O, but got Unknown //IL_0052: Expected O, but got Unknown using Stream stream = typeof(Plugin).Assembly.GetManifestResourceStream("DynamiteLauncher." + fileName) ?? throw new FileNotFoundException("Embedded texture not found.", fileName); using MemoryStream memoryStream = new MemoryStream(); stream.CopyTo(memoryStream); Texture2D val = new Texture2D(2, 2); ImageConversion.LoadImage(val, memoryStream.ToArray()); return val; } private void Update() { if (_changed) { _changed = false; _reloadAt = Time.realtimeSinceStartup + 0.3f; } if (_reloadAt > 0f && Time.realtimeSinceStartup >= _reloadAt) { _reloadAt = 0f; ((BaseUnityPlugin)this).Config.Reload(); } if (!_registered) { TryRegisterItems(); } } public static int VariantOf(Item item) { IntItemData val = default(IntItemData); if (!((Object)(object)item != (Object)null) || item.data == null || !item.data.TryGetDataEntry<IntItemData>((DataEntryKey)200, ref val)) { return 0; } return val.Value; } public static void GiveLauncher(int variant) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) Character localCharacter = Character.localCharacter; if (!((Object)(object)localCharacter == (Object)null) && PhotonNetwork.InRoom) { Item component = PhotonNetwork.Instantiate("0_Items/AntiZooka", localCharacter.Center, Quaternion.identity, (byte)0, (object[])null).GetComponent<Item>(); InitializeLauncher(component, variant); component.RequestPickup(((Component)localCharacter).GetComponent<PhotonView>()); } } internal static void InitializeLauncher(Item item, int variant) { item.GetData<IntItemData>((DataEntryKey)200).Value = variant; item.GetData<IntItemData>((DataEntryKey)201).Value = PhotonNetwork.LocalPlayer.ActorNumber; OptionableIntItemData data = item.GetData<OptionableIntItemData>((DataEntryKey)2); data.HasData = true; data.Value = Variants.Ammo(variant); item.GetData<FloatItemData>((DataEntryKey)11).Value = 1f; ((Component)item).GetComponent<PhotonView>().RPC("SetItemInstanceDataRPC", (RpcTarget)0, new object[1] { item.data }); } private void TryRegisterItems() { //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Expected O, but got Unknown ItemDatabase instance = SingletonAsset<ItemDatabase>.Instance; if ((Object)(object)instance == (Object)null || instance.itemLookup.Count == 0) { return; } Item val = null; foreach (Item @object in ((DatabaseAsset<ItemDatabase, Item>)(object)instance).Objects) { if ((Object)(object)@object != (Object)null && ((Object)((Component)@object).gameObject).name == "AntiZooka") { val = @object; break; } } if ((Object)(object)val == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)"Source item 'AntiZooka' not found in ItemDatabase"); _registered = true; return; } ushort num = 0; foreach (ushort key in instance.itemLookup.Keys) { num = ((key > num) ? key : num); } GameObject val2 = new GameObject("DynamiteLauncherTemplates"); val2.SetActive(false); Object.DontDestroyOnLoad((Object)(object)val2); GoldPrefab = RegisterVariant(instance, val, val2, 2, ++num, LauncherText.GoldNames, LauncherText.GoldDescriptions); SilverPrefab = RegisterVariant(instance, val, val2, 1, ++num, LauncherText.SilverNames, LauncherText.SilverDescriptions); JumpGoldPrefab = RegisterVariant(instance, val, val2, 4, ++num, LauncherText.JumpGoldNames, LauncherText.JumpGoldDescriptions); JumpSilverPrefab = RegisterVariant(instance, val, val2, 3, ++num, LauncherText.JumpSilverNames, LauncherText.JumpSilverDescriptions); GuidedGoldPrefab = RegisterVariant(instance, val, val2, 6, ++num, LauncherText.GuidedGoldNames, LauncherText.GuidedGoldDescriptions); GuidedSilverPrefab = RegisterVariant(instance, val, val2, 5, ++num, LauncherText.GuidedSilverNames, LauncherText.GuidedSilverDescriptions); _registered = true; } private GameObject RegisterVariant(ItemDatabase database, Item source, GameObject holder, int variant, ushort id, string[] names, string[] descriptions) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) GameObject obj = Object.Instantiate<GameObject>(((Component)source).gameObject, holder.transform); string name = Variants.PrefabName(variant); string text = Variants.TextKey(variant); ((Object)obj).name = name; Item component = obj.GetComponent<Item>(); LootData val = default(LootData); if (obj.TryGetComponent<LootData>(ref val)) { val.spawnLocations = (SpawnPool)0; val.useOtherItemForSpawningValidity = ((Component)source).gameObject; } component.totalUses = Variants.Ammo(variant); component.itemID = id; component.UIData.itemName = text; component.UIData.icon = Variants.Icon(variant); LocalizedText.mainTable[LocalizedText.GetNameIndex(text)] = new List<string>(names); LocalizedText.mainTable[LocalizedText.GetDescriptionIndex(text)] = new List<string>(descriptions); ((DatabaseAsset<ItemDatabase, Item>)(object)database).AddRuntimeEntry(component); database.itemLookup[id] = component; return obj; } public IEnumerator ExplodeDynamite(Vector3 position) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) GameObject dynamite = PhotonNetwork.Instantiate("0_Items/Dynamite", position, Quaternion.identity, (byte)0, (object[])null); dynamite.GetComponent<PhotonView>().RPC("RPC_Explode", (RpcTarget)0, Array.Empty<object>()); yield return (object)new WaitForSeconds(DynamiteDestroyDelay.Value); if ((Object)(object)dynamite != (Object)null) { PhotonNetwork.Destroy(dynamite); } } } [HarmonyPatch(typeof(AntiSphere), "FixedUpdate")] public static class RemoteShotPatch { private class Checked : MonoBehaviour { } private class Snapshot { public Item Item; public int Variant; public bool IsCreator; public Vector3 Muzzle; public float Time; } private const byte DestroyEventCode = 204; private const int DestroyResends = 4; private const float DestroyResendDelay = 0.4f; private const float HeldMemory = 2f; private static readonly Dictionary<Character, Snapshot> Held = new Dictionary<Character, Snapshot>(); private static void Prefix(AntiSphere __instance) { //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: 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_00d8: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.ReplaceOthersShots.Value || (Object)(object)((Component)__instance).GetComponent<Checked>() != (Object)null) { return; } ((Component)__instance).gameObject.AddComponent<Checked>(); PhotonView component = ((Component)__instance).GetComponent<PhotonView>(); if ((Object)(object)component == (Object)null || component.IsMine) { return; } foreach (Character allCharacter in Character.AllCharacters) { if (((MonoBehaviourPun)allCharacter).photonView.Owner == component.Owner && Held.TryGetValue(allCharacter, out var value) && !(Time.time - value.Time > 2f)) { if (value.IsCreator) { Vector3 val = ((Component)__instance).transform.position - value.Muzzle; ShootPatch.Launch(value.Item, value.Variant, value.Muzzle, (((Vector3)(ref val)).sqrMagnitude > 0.01f) ? ((Vector3)(ref val)).normalized : ((Component)allCharacter).transform.forward); DestroyRemote(component); } break; } } } internal static void Remember(Character character) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) Item currentItem = character.data.currentItem; if (!((Object)(object)currentItem == (Object)null)) { int num = Plugin.VariantOf(currentItem); if (num != 0) { Held[character] = new Snapshot { Item = currentItem, Variant = num, IsCreator = IsCreator(currentItem), Muzzle = ((Component)currentItem).GetComponent<Action_RaycastSpawnSomething>().rayOrigin.position, Time = Time.time }; } } } private static bool IsCreator(Item item) { IntItemData val = default(IntItemData); if (item.data.TryGetDataEntry<IntItemData>((DataEntryKey)201, ref val)) { return val.Value == PhotonNetwork.LocalPlayer.ActorNumber; } return false; } private static IEnumerator SendDestroyRepeatedly(int viewId) { Hashtable data = new Hashtable { [(byte)0] = viewId }; for (int i = 0; i < 4; i++) { PhotonNetwork.NetworkingClient.OpRaiseEvent((byte)204, (object)data, new RaiseEventOptions { Receivers = (ReceiverGroup)0 }, SendOptions.SendReliable); yield return (object)new WaitForSeconds(0.4f); } } private static void DestroyRemote(PhotonView view) { if (view.IsMine) { PhotonNetwork.Destroy(((Component)view).gameObject); return; } ((MonoBehaviour)Plugin.Instance).StartCoroutine(SendDestroyRepeatedly(view.ViewID)); Object.Destroy((Object)(object)((Component)view).gameObject); } } [HarmonyPatch(typeof(Character), "Update")] internal static class HeldLauncherPatch { private static void Postfix(Character __instance) { if (Plugin.ReplaceOthersShots.Value && !__instance.IsLocal) { RemoteShotPatch.Remember(__instance); } } } [HarmonyPatch(typeof(Item), "StartUseSecondary")] public static class SecondaryUsePatch { public static bool UsesRightButton(int variant) { if (variant != 0) { if (!Plugin.DetonateOnRightClick.Value && !Variants.IsJump(variant)) { return Variants.IsGuided(variant); } return true; } return false; } private static void Postfix(Item __instance, bool __state) { int num = Plugin.VariantOf(__instance); if (num != 0 && ((MonoBehaviourPun)__instance).photonView.IsMine && __state) { if (Variants.IsJump(num)) { JumpHold.Begin(__instance); } else if (UsesRightButton(num)) { FlareProjectile.DetonateAll(__instance); } } } private static void Prefix(Item __instance, out bool __state) { __state = !__instance.isUsingPrimary && !__instance.isUsingSecondary; } internal static void FireRear(Item item) { //IL_002b: 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) OptionableIntItemData data = item.GetData<OptionableIntItemData>((DataEntryKey)2); if (!data.HasData || data.Value != 0) { ShootPatch.Launch(item, Plugin.VariantOf(item), ((Component)item).GetComponent<Action_RaycastSpawnSomething>().rayOrigin.position, ((Component)MainCamera.instance).transform.forward, rear: true); ((ItemActionBase)((Component)item).GetComponent<Action_ReduceUses>()).RunAction(); } } } public static class JumpHold { private static readonly MethodInfo PlayChargeEffect = AccessTools.Method(typeof(Action_Antizooka), "PlayChargeFX", (Type[])null, (Type[])null); private static readonly MethodInfo StopChargeEffect = AccessTools.Method(typeof(Action_Antizooka), "StopChargeFX", (Type[])null, (Type[])null); private static Item _item; private static float _startTime; private static bool _fired; public static void Begin(Item item) { _item = item; _startTime = Time.time; _fired = false; PlayChargeEffect.Invoke(((Component)item).GetComponent<Action_Antizooka>(), null); } public static void Cancel(Item item) { if ((Object)(object)_item == (Object)(object)item) { _item = null; StopChargeEffect.Invoke(((Component)item).GetComponent<Action_Antizooka>(), null); } } public static bool IsCharging(Item item) { if ((Object)(object)_item == (Object)(object)item && !_fired) { return item.isUsingSecondary; } return false; } public static float Fraction(Item item) { float num = item.usingTimePrimary / Plugin.ChargeSpeedMultiplier.Value; if (!(num <= 0f)) { return Mathf.Clamp01((Time.time - _startTime) / num); } return 1f; } public static void Tick(Item item) { if (IsCharging(item) && Fraction(item) >= 1f) { _fired = true; SecondaryUsePatch.FireRear(item); } } } [HarmonyPatch(typeof(Item), "ContinueUseSecondary")] public static class JumpHoldTickPatch { private static void Postfix(Item __instance) { JumpHold.Tick(__instance); } } [HarmonyPatch(typeof(Item), "CancelUseSecondary")] public static class JumpHoldCancelPatch { private static void Postfix(Item __instance) { JumpHold.Cancel(__instance); } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public static class JumpHoldProgressPatch { private static void Postfix(Item __instance, ref float __result) { if (JumpHold.IsCharging(__instance)) { __result = JumpHold.Fraction(__instance); } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public static class JumpHoldShowPatch { private static void Postfix(Item __instance, ref bool __result) { if (JumpHold.IsCharging(__instance)) { __result = true; } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public static class DetonateProgressPatch { private static void Postfix(Item __instance, ref bool __result) { int variant = Plugin.VariantOf(__instance); if (__result && __instance.isUsingSecondary && SecondaryUsePatch.UsesRightButton(variant) && !Variants.IsJump(variant)) { __result = false; } } } [HarmonyPatch(typeof(Item), "CanUseSecondary")] public static class DetonateAllowedPatch { private static void Postfix(Item __instance, ref bool __result) { if (SecondaryUsePatch.UsesRightButton(Plugin.VariantOf(__instance))) { __result = true; } } } [HarmonyPatch(typeof(Action_RaycastSpawnSomething), "RunAction")] public static class ShootPatch { private const float RearMuzzleDistance = 2f; internal static void Launch(Item source, int variant, Vector3 muzzle, Vector3 direction, bool rear = false) { //IL_0016: 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) //IL_0019: 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) //IL_0040: 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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002d: 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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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) float num = Plugin.FlareSpawnOffset.Value + Plugin.FlareRadius.Value; Vector3 val = direction; Vector3 val2 = muzzle; if (rear) { val = -direction; num += 2f; val2 = muzzle + val * 2f; } if (SpawnBlocked(muzzle, val, num, out var point)) { FlareProjectile.Detonate(variant, point); return; } FlareProjectile flareProjectile = PhotonNetwork.Instantiate("0_Items/Flare", val2 + val * Plugin.FlareSpawnOffset.Value, FlareProjectile.RotationFor(val), (byte)0, (object[])null).AddComponent<FlareProjectile>(); flareProjectile.Direction = val; flareProjectile.Source = source; flareProjectile.Variant = variant; } private static bool IsOwnCollider(Collider collider) { Character val = default(Character); if (CharacterRagdoll.TryGetCharacterFromCollider(collider, ref val)) { return (Object)(object)val == (Object)(object)Character.localCharacter; } return false; } private static bool SpawnBlocked(Vector3 start, Vector3 direction, float reach, out Vector3 point) { //IL_0007: Unknown result type (might be due to invalid IL or missing references)