Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of PlagueDoctor v1.1.0
plugins/PlagueDoctor.dll
Decompiled a week 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.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security.Cryptography; using System.Text; using BepInEx; using BepInEx.Logging; using EntityStates; using HarmonyLib; using KinematicCharacterController; using Microsoft.CodeAnalysis; using PlagueDoctor.States; using RoR2; using RoR2.ContentManagement; using RoR2.Projectile; using RoR2.Skills; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.AddressableAssets.ResourceLocators; using UnityEngine.Networking; using UnityEngine.Rendering; using UnityEngine.ResourceManagement.ResourceLocations; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("0.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 PlagueDoctor { internal static class DoctorModel { private sealed class Look { public Color Color; public float Smoothness; public Color Emission; public float EmissionPower; } private static readonly Dictionary<string, Look> Looks = new Dictionary<string, Look> { ["Coat"] = new Look { Color = new Color(0.022f, 0.02f, 0.026f), Smoothness = 0.25f }, ["Lining"] = new Look { Color = new Color(0.05f, 0.16f, 0.13f), Smoothness = 0.2f }, ["Leather"] = new Look { Color = new Color(0.11f, 0.06f, 0.035f), Smoothness = 0.4f }, ["DarkLeather"] = new Look { Color = new Color(0.04f, 0.025f, 0.02f), Smoothness = 0.45f }, ["Mask"] = new Look { Color = new Color(0.62f, 0.55f, 0.42f), Smoothness = 0.45f }, ["Stitch"] = new Look { Color = new Color(0.2f, 0.12f, 0.07f), Smoothness = 0.3f }, ["Brass"] = new Look { Color = new Color(0.75f, 0.52f, 0.2f), Smoothness = 0.75f }, ["Steel"] = new Look { Color = new Color(0.45f, 0.45f, 0.48f), Smoothness = 0.7f }, ["Wood"] = new Look { Color = new Color(0.09f, 0.045f, 0.025f), Smoothness = 0.4f }, ["Cloth"] = new Look { Color = new Color(0.06f, 0.06f, 0.07f), Smoothness = 0.15f }, ["HatBand"] = new Look { Color = new Color(0.28f, 0.04f, 0.04f), Smoothness = 0.3f }, ["Cork"] = new Look { Color = new Color(0.35f, 0.22f, 0.12f), Smoothness = 0.1f }, ["Glass"] = new Look { Color = new Color(0.6f, 0.75f, 0.7f), Smoothness = 0.9f }, ["Toxic"] = new Look { Color = new Color(0.2f, 0.9f, 0.15f), Smoothness = 0.9f, Emission = new Color(0.25f, 1f, 0.1f), EmissionPower = 2.5f }, ["Smoke"] = new Look { Color = new Color(0.45f, 0.25f, 0.7f), Smoothness = 0.9f, Emission = new Color(0.55f, 0.25f, 1f), EmissionPower = 2f }, ["Lens"] = new Look { Color = new Color(0.1f, 1f, 0.25f), Smoothness = 0.95f, Emission = new Color(0.15f, 1f, 0.2f), EmissionPower = 3f } }; private static GameObject _prefab; private static Shader _shader; private static readonly Dictionary<string, Material> _materials = new Dictionary<string, Material>(); private static Material _skin; public static bool Load(string pluginFolder) { string text = Path.Combine(pluginFolder, "plaguedoctor"); if (!File.Exists(text)) { Plugin.Log.LogWarning((object)"No model bundle next to the mod, keeping Bandit's model."); return false; } AssetBundle val = AssetBundle.LoadFromFile(text); _prefab = (((Object)(object)val != (Object)null) ? val.LoadAsset<GameObject>("mdlPlagueDoctor") : null); _shader = GameAssets.Load<Shader>("Assets/RoR2/Base/Shaders/Deferred/HGStandard.shader"); if ((Object)(object)_prefab == (Object)null) { Plugin.Log.LogError((object)"The model bundle has no mdlPlagueDoctor."); } return (Object)(object)_prefab != (Object)null; } public static void ReplaceModel(GameObject bodyPrefab) { //IL_002c: 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_005d: 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_012b: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) ModelLocator component = bodyPrefab.GetComponent<ModelLocator>(); Transform modelTransform = component.modelTransform; Transform val = (((Object)(object)component.modelBaseTransform != (Object)null) ? component.modelBaseTransform : modelTransform.parent); Vector3 localPosition = modelTransform.localPosition; Object.DestroyImmediate((Object)(object)((Component)modelTransform).gameObject); GameObject val2 = Object.Instantiate<GameObject>(_prefab, val); ((Object)val2).name = "mdlPlagueDoctor"; val2.transform.localPosition = localPosition; ApplyMaterials(val2); val2.AddComponent<LayerFader>(); try { CaneTrail.Attach(val2); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Cane trail skipped: " + ex.Message)); } CharacterBody component2 = bodyPrefab.GetComponent<CharacterBody>(); CharacterModel obj = val2.AddComponent<CharacterModel>(); obj.body = component2; obj.autoPopulateLightInfos = true; obj.baseRendererInfos = ((IEnumerable<Renderer>)(from r in val2.GetComponentsInChildren<Renderer>() orderby ((Object)r).name == "PD_Coat" descending select r)).Select((Func<Renderer, RendererInfo>)((Renderer r) => new RendererInfo { renderer = r, defaultMaterial = r.sharedMaterial, defaultShadowCastingMode = (ShadowCastingMode)1, ignoreOverlays = false })).ToArray(); GameObject val3 = new GameObject("HurtBox") { layer = LayerIndex.entityPrecise.intVal }; val3.transform.SetParent(val2.transform, false); val3.transform.position = val2.transform.position + Vector3.up * 0.95f; val3.transform.rotation = Quaternion.identity; Vector3 lossyScale = val2.transform.lossyScale; val3.transform.localScale = new Vector3(1f / lossyScale.x, 1f / lossyScale.y, 1f / lossyScale.z); CapsuleCollider obj2 = val3.AddComponent<CapsuleCollider>(); obj2.radius = 0.38f; obj2.height = 1.9f; obj2.direction = 1; HurtBox val4 = val3.AddComponent<HurtBox>(); HurtBoxGroup val5 = val2.AddComponent<HurtBoxGroup>(); val4.healthComponent = bodyPrefab.GetComponent<HealthComponent>(); val4.isBullseye = true; val4.damageModifier = (DamageModifier)0; val4.hurtBoxGroup = val5; val4.indexInGroup = 0; val5.hurtBoxes = (HurtBox[])(object)new HurtBox[1] { val4 }; val5.mainHurtBox = val4; val5.bullseyeCount = 1; ChildLocator obj3 = val2.AddComponent<ChildLocator>(); List<NameTransformPair> list = new List<NameTransformPair>(); (string, string)[] array = new(string, string)[6] { ("Cane", "cane"), ("HandL", "hand.L"), ("HandR", "hand.R"), ("Head", "head"), ("Chest", "chest"), ("Hips", "hips") }; for (int num = 0; num < array.Length; num++) { (string, string) tuple = array[num]; string item = tuple.Item1; string bone = tuple.Item2; Transform val6 = ((IEnumerable<Transform>)val2.GetComponentsInChildren<Transform>()).FirstOrDefault((Func<Transform, bool>)((Transform t) => ((Object)t).name == bone)); if ((Object)(object)val6 != (Object)null) { list.Add(new NameTransformPair { name = item, transform = val6 }); } } typeof(ChildLocator).GetField("transformPairs", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(obj3, list.ToArray()); typeof(ModelLocator).GetField("_modelTransform", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(component, val2.transform); CharacterDirection component3 = bodyPrefab.GetComponent<CharacterDirection>(); if ((Object)(object)component3 != (Object)null) { component3.modelAnimator = val2.GetComponent<Animator>(); } } public static GameObject MakeDisplay(Transform holder) { GameObject obj = Object.Instantiate<GameObject>(_prefab, holder); ((Object)obj).name = "PlagueDoctorDisplay"; ApplyMaterials(obj); obj.AddComponent<SelectIntro>(); return obj; } private static Material SkinFrom(Material source) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_skin != (Object)null) { return _skin; } _skin = (((Object)(object)_shader != (Object)null) ? new Material(_shader) : new Material(Shader.Find("Standard"))); ((Object)_skin).name = "matPlagueDoctorSkin"; _skin.SetColor("_Color", Color.white); _skin.SetTexture("_MainTex", source.mainTexture); _skin.SetFloat("_Smoothness", 0.15f); Texture val = (source.HasProperty("_BumpMap") ? source.GetTexture("_BumpMap") : null); if ((Object)(object)val != (Object)null) { _skin.EnableKeyword("FORCE_SPEC"); _skin.SetTexture("_NormalTex", val); _skin.SetFloat("_NormalStrength", 0.6f); } Texture val2 = (source.HasProperty("_EmissionMap") ? source.GetTexture("_EmissionMap") : null); if ((Object)(object)val2 != (Object)null) { _skin.EnableKeyword("_EMISSION"); _skin.SetTexture("_EmTex", val2); _skin.SetColor("_EmColor", Color.white); _skin.SetFloat("_EmPower", 1.6f); } return _skin; } private static void ApplyMaterials(GameObject model) { Renderer[] componentsInChildren = model.GetComponentsInChildren<Renderer>(); foreach (Renderer val in componentsInChildren) { Material sharedMaterial = val.sharedMaterial; if ((Object)(object)sharedMaterial != (Object)null && (Object)(object)sharedMaterial.mainTexture != (Object)null) { val.sharedMaterial = SkinFrom(sharedMaterial); continue; } string text = (((Object)val).name.StartsWith("PD_") ? ((Object)val).name.Substring(3) : ((Object)val).name); int num = text.IndexOf('.'); if (num > 0) { text = text.Substring(0, num); } val.sharedMaterial = MaterialFor(text); } } private static Material MaterialFor(string key) { //IL_0056: 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_005c: Expected O, but got Unknown //IL_0079: 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) if (_materials.TryGetValue(key, out var value)) { return value; } Look value2; Look look = (Looks.TryGetValue(key, out value2) ? value2 : Looks["Coat"]); value = (((Object)(object)_shader != (Object)null) ? new Material(_shader) : new Material(Shader.Find("Standard"))); ((Object)value).name = "matPlagueDoctor" + key; value.SetColor("_Color", ((Color)(ref look.Color)).gamma); value.SetFloat("_Smoothness", look.Smoothness); if (look.EmissionPower > 0f) { value.EnableKeyword("_EMISSION"); value.SetColor("_EmColor", ((Color)(ref look.Emission)).gamma); value.SetFloat("_EmPower", look.EmissionPower); } _materials[key] = value; return value; } } internal static class Fx { private sealed class Spec { public int Count = 20; public float Lifetime = 1f; public float Speed = 3f; public float Size = 0.5f; public float Grow = 1f; public Color Color = Toxic; public Color EndColor = ToxicDark; public float Gravity; public float Radius = 0.3f; public bool Ring; public bool Sharp; public float Rate; public float Duration = 0.1f; public Vector3 Rotation = new Vector3(-90f, 0f, 0f); } public static readonly Color Toxic = new Color(0.35f, 1f, 0.2f, 0.85f); public static readonly Color ToxicDark = new Color(0.1f, 0.35f, 0.08f, 0.7f); public static readonly Color SmokePurple = new Color(0.45f, 0.25f, 0.6f, 0.75f); public static readonly Color Glass = new Color(0.8f, 1f, 0.9f, 1f); private static Material _soft; private static Material _sharp; private static Shader _particleShader; private static readonly Dictionary<CharacterBody, (ParticleSystem Bubbles, int Stacks)> _infected = new Dictionary<CharacterBody, (ParticleSystem, int)>(); private static float _nextScan; private static Material Soft => _soft ?? (_soft = MakeMaterial(CircleTexture(64, 1.6f))); private static Material Sharp => _sharp ?? (_sharp = MakeMaterial(CircleTexture(16, 6f))); private static Material MakeMaterial(Texture2D texture) { //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_0012: Expected O, but got Unknown return new Material(ParticleShader()) { mainTexture = (Texture)(object)texture }; } public static Shader ParticleShader() { if ((Object)(object)_particleShader != (Object)null) { return _particleShader; } string[] array = new string[3] { "Sprites/Default", "Legacy Shaders/Particles/Alpha Blended", "UI/Default" }; foreach (string text in array) { try { _particleShader = Shader.Find(text); } catch (Exception) { _particleShader = null; } if ((Object)(object)_particleShader != (Object)null) { return _particleShader; } } _particleShader = GameAssets.Load<Shader>("Assets/RoR2/Base/Shaders/Optimized/Switch/FX/ParticleSimpleAlpha_switch.shader") ?? GameAssets.Load<Shader>("Assets/RoR2/Base/Shaders/Deferred/HGStandard.shader"); return _particleShader; } private static Texture2D CircleTexture(int size, float hardness) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown //IL_0022: 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_0073: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(size, size, (TextureFormat)4, false); for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { float num = Vector2.Distance(new Vector2((float)j + 0.5f, (float)i + 0.5f), new Vector2((float)size / 2f, (float)size / 2f)) / ((float)size / 2f); float num2 = Mathf.Clamp01(1f - Mathf.Pow(num, hardness)); val.SetPixel(j, i, new Color(1f, 1f, 1f, num2)); } } val.Apply(); return val; } private static ParticleSystem Make(Vector3 position, Spec spec, Transform follow = null) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0011: 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_0053: 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_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Expected O, but got Unknown //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("PlagueDoctorFx"); val.transform.position = position; val.transform.rotation = Quaternion.Euler(spec.Rotation); if ((Object)(object)follow != (Object)null) { val.transform.SetParent(follow, true); } ParticleSystem val2 = val.AddComponent<ParticleSystem>(); val2.Stop(true, (ParticleSystemStopBehavior)0); MainModule main = val2.main; ((MainModule)(ref main)).duration = spec.Duration; ((MainModule)(ref main)).loop = spec.Rate > 0f; ((MainModule)(ref main)).playOnAwake = false; ((MainModule)(ref main)).startLifetime = new MinMaxCurve(spec.Lifetime * 0.7f, spec.Lifetime); ((MainModule)(ref main)).startSpeed = new MinMaxCurve(spec.Speed * 0.5f, spec.Speed); ((MainModule)(ref main)).startSize = new MinMaxCurve(spec.Size * 0.6f, spec.Size); ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(spec.Color); ((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(spec.Gravity); ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; ((MainModule)(ref main)).maxParticles = Mathf.Max(spec.Count * 2, 200); EmissionModule emission = val2.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(spec.Rate); if (spec.Count > 0 && spec.Rate <= 0f) { ((EmissionModule)(ref emission)).SetBursts((Burst[])(object)new Burst[1] { new Burst(0f, (short)spec.Count) }); } ShapeModule shape = val2.shape; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)(spec.Ring ? 10 : 0); ((ShapeModule)(ref shape)).radius = spec.Radius; if (spec.Ring) { ((ShapeModule)(ref shape)).radiusThickness = 0f; } ColorOverLifetimeModule colorOverLifetime = val2.colorOverLifetime; ((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true; Gradient val3 = new Gradient(); val3.SetKeys((GradientColorKey[])(object)new GradientColorKey[2] { new GradientColorKey(spec.Color, 0f), new GradientColorKey(spec.EndColor, 1f) }, (GradientAlphaKey[])(object)new GradientAlphaKey[3] { new GradientAlphaKey(spec.Color.a, 0f), new GradientAlphaKey(spec.Color.a * 0.8f, 0.4f), new GradientAlphaKey(0f, 1f) }); ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(val3); SizeOverLifetimeModule sizeOverLifetime = val2.sizeOverLifetime; ((SizeOverLifetimeModule)(ref sizeOverLifetime)).enabled = true; ((SizeOverLifetimeModule)(ref sizeOverLifetime)).size = new MinMaxCurve(1f, AnimationCurve.Linear(0f, 1f, 1f, spec.Grow)); ParticleSystemRenderer component = val.GetComponent<ParticleSystemRenderer>(); ((Renderer)component).sharedMaterial = (spec.Sharp ? Sharp : Soft); component.renderMode = (ParticleSystemRenderMode)0; val2.Play(); if (spec.Rate <= 0f) { Object.Destroy((Object)(object)val, spec.Duration + spec.Lifetime + 0.5f); } return val2; } public static void Splash(Vector3 position) { //IL_0000: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) Make(position, new Spec { Count = 14, Lifetime = 0.45f, Speed = 4f, Size = 0.35f, Grow = 1.8f, Radius = 0.3f }); Make(position, new Spec { Count = 10, Lifetime = 0.35f, Speed = 7f, Size = 0.08f, Grow = 0.3f, Sharp = true, Color = Glass, EndColor = Toxic, Gravity = 1f }); } public static void FlaskBlast(Vector3 position, float radius, bool smoke = false) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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_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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0099: 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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) Color val = (smoke ? SmokePurple : Toxic); Color endColor = (Color)(smoke ? new Color(0.2f, 0.12f, 0.3f, 0.6f) : ToxicDark); Make(position + Vector3.up * 0.5f, new Spec { Count = 35, Lifetime = 1.4f, Speed = radius * 0.9f, Size = radius * 0.35f, Grow = 2.2f, Radius = 0.5f, Color = val, EndColor = endColor, Gravity = -0.05f }); Make(position + Vector3.up * 0.1f, new Spec { Count = 40, Lifetime = 0.6f, Speed = radius * 2.2f, Size = 0.5f, Grow = 2f, Ring = true, Radius = 0.3f, Color = val, EndColor = endColor }); Make(position + Vector3.up * 0.5f, new Spec { Count = 25, Lifetime = 0.8f, Speed = 9f, Size = 0.1f, Grow = 0.4f, Sharp = true, Color = Glass, EndColor = val, Gravity = 1.5f }); } public static void SmokePuff(Vector3 position) { //IL_0000: 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_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) Make(position, new Spec { Count = 4, Lifetime = 1.2f, Speed = 0.8f, Size = 1.2f, Grow = 1.8f, Radius = 0.6f, Color = SmokePurple, EndColor = new Color(0.15f, 0.1f, 0.2f, 0.5f), Gravity = -0.03f }); } public static ParticleSystem Miasma(Transform follow) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return Make(follow.position, new Spec { Count = 0, Rate = 60f, Duration = 1f, Lifetime = 0.9f, Speed = 1.5f, Size = 0.6f, Grow = 1.5f, Radius = 1.2f, Ring = true, Gravity = -0.2f }, follow); } public static void Shockwave(Vector3 position, float radius) { //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_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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: 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_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013b: 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) Make(position + Vector3.up * 0.15f, new Spec { Count = 120, Lifetime = 0.7f, Speed = radius * 2f, Size = 0.9f, Grow = 2.5f, Ring = true, Radius = 0.5f }); Make(position, new Spec { Count = 45, Lifetime = 1.8f, Speed = 6f, Size = 1.5f, Grow = 2.5f, Radius = 1.5f, Gravity = -0.4f, Rotation = new Vector3(-90f, 0f, 0f) }); Make(position + Vector3.up * 0.3f, new Spec { Count = 60, Lifetime = 1f, Speed = 14f, Size = 0.12f, Grow = 0.3f, Sharp = true, Color = Glass, EndColor = Toxic, Gravity = 2f }); } public static void Epidemic(Vector3 position) { //IL_0000: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) Make(position, new Spec { Count = 50, Lifetime = 1.2f, Speed = 7f, Size = 1f, Grow = 2.4f, Radius = 0.6f }); Make(position, new Spec { Count = 30, Lifetime = 0.9f, Speed = 11f, Size = 0.15f, Grow = 0.4f, Sharp = true, Color = Glass, EndColor = Toxic, Gravity = 1.2f }); } public static void Initialize() { RoR2Application.onUpdate += ScanInfected; } private static void ScanInfected() { //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: 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_0164: Unknown result type (might be due to invalid IL or missing references) if (Time.time < _nextScan || (Object)(object)PlagueDoctorContent.PlagueBuff == (Object)null) { return; } _nextScan = Time.time + 0.2f; foreach (CharacterBody readOnlyInstances in CharacterBody.readOnlyInstancesList) { if ((Object)(object)readOnlyInstances == (Object)null) { continue; } int buffCount = readOnlyInstances.GetBuffCount(PlagueDoctorContent.PlagueBuff); (ParticleSystem, int) value; bool flag = _infected.TryGetValue(readOnlyInstances, out value); if (buffCount > 0) { if (!flag || (Object)(object)value.Item1 == (Object)null) { value.Item1 = Make(readOnlyInstances.corePosition, new Spec { Count = 0, Rate = 1f, Duration = 1f, Lifetime = 1.1f, Speed = 0.6f, Size = 0.35f, Grow = 1.6f, Radius = readOnlyInstances.radius * 0.8f, Gravity = -0.15f }, ((Component)readOnlyInstances).transform); } EmissionModule emission = value.Item1.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(3f + (float)buffCount * 6f); _infected[readOnlyInstances] = (value.Item1, buffCount); } else if (flag) { if (value.Item2 >= 4 && (Object)(object)readOnlyInstances.healthComponent != (Object)null) { Epidemic(readOnlyInstances.corePosition); } Stop(value.Item1); _infected.Remove(readOnlyInstances); } } foreach (CharacterBody item in _infected.Keys.Where((CharacterBody b) => (Object)(object)b == (Object)null).ToList()) { Stop(_infected[item].Bubbles); _infected.Remove(item); } } public static void Stop(ParticleSystem ps) { if ((Object)(object)ps != (Object)null) { ((Component)ps).transform.SetParent((Transform)null, true); ps.Stop(true, (ParticleSystemStopBehavior)1); Object.Destroy((Object)(object)((Component)ps).gameObject, 2f); } } } internal sealed class CaneTrail : MonoBehaviour { public TrailRenderer Trail; public static void Attach(GameObject model) { //IL_003a: 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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Expected O, but got Unknown //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Expected O, but got Unknown Transform val = ((IEnumerable<Transform>)model.GetComponentsInChildren<Transform>()).FirstOrDefault((Func<Transform, bool>)((Transform t) => ((Object)t).name == "cane")); if (!((Object)(object)val == (Object)null)) { GameObject val2 = new GameObject("CaneTip"); val2.transform.SetParent(val, false); val2.transform.position = val.position + Vector3.down * 1.08f * model.transform.lossyScale.y; TrailRenderer val3 = val2.AddComponent<TrailRenderer>(); val3.time = 0.18f; val3.minVertexDistance = 0.05f; val3.widthCurve = AnimationCurve.Linear(0f, 0.22f, 1f, 0f); Gradient val4 = new Gradient(); val4.colorKeys = (GradientColorKey[])(object)new GradientColorKey[2] { new GradientColorKey(new Color(0.6f, 1f, 0.4f), 0f), new GradientColorKey(new Color(0.2f, 0.7f, 0.1f), 1f) }; val4.alphaKeys = (GradientAlphaKey[])(object)new GradientAlphaKey[2] { new GradientAlphaKey(0.85f, 0f), new GradientAlphaKey(0f, 1f) }; val3.colorGradient = val4; ((Renderer)val3).sharedMaterial = new Material(Fx.ParticleShader()); val3.emitting = false; model.AddComponent<CaneTrail>().Trail = val3; } } public static void Set(EntityState state, bool on) { object obj; if (!((Object)(object)state.outer != (Object)null)) { obj = null; } else { ModelLocator component = ((Component)state.outer).GetComponent<ModelLocator>(); obj = ((component != null) ? component.modelTransform : null); } Transform val = (Transform)obj; CaneTrail caneTrail = (((Object)(object)val != (Object)null) ? ((Component)val).GetComponent<CaneTrail>() : null); if ((Object)(object)caneTrail != (Object)null && (Object)(object)caneTrail.Trail != (Object)null) { caneTrail.Trail.emitting = on; } } } internal static class Icons { private static readonly Dictionary<string, Texture2D> _textures = new Dictionary<string, Texture2D>(); public static Texture2D Texture(string name) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown if (_textures.TryGetValue(name, out var value)) { return value; } string path = Path.Combine(Plugin.Folder, "icons", name + ".png"); if (File.Exists(path)) { value = new Texture2D(2, 2, (TextureFormat)4, false); ImageConversion.LoadImage(value, File.ReadAllBytes(path)); ((Object)value).name = "texPlagueDoctor_" + name; } _textures[name] = value; return value; } public static Sprite Sprite(string name) { //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) Texture2D val = Texture(name); if (!((Object)(object)val != (Object)null)) { return null; } return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f)); } } internal static class Plague { private sealed class Infection { public GameObject Attacker; public float NextTick; } public const int EpidemicStacks = 5; private const float TickDamage = 0.35f; private const float EpidemicDamage = 3f; private const float EpidemicRadius = 9f; private const float DetonateDamagePerStack = 1.5f; private const float HealRadius = 30f; private const float HealPerEnemy = 0.004f; private static readonly Dictionary<HealthComponent, Infection> _infected = new Dictionary<HealthComponent, Infection>(); private static readonly List<(CharacterBody Victim, GameObject Attacker)> _epidemics = new List<(CharacterBody, GameObject)>(); private static float _nextHeal; public static void Initialize() { GlobalEventManager.onServerDamageDealt += OnDamageDealt; RoR2Application.onFixedUpdate += FixedUpdate; Run.onRunDestroyGlobal += delegate { _infected.Clear(); _epidemics.Clear(); }; } public static DamageTypeCombo Source(DamageSource source, DamageType type = (DamageType)0u) { //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_0009: 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) DamageTypeCombo result = DamageTypeCombo.op_Implicit(type); result.damageSource = source; return result; } private static bool IsDoctor(CharacterBody body) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Invalid comparison between Unknown and I4 //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)body != (Object)null && (int)PlagueDoctorContent.BodyIndex != -1) { return body.bodyIndex == PlagueDoctorContent.BodyIndex; } return false; } private static void OnDamageDealt(DamageReport report) { //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) //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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Invalid comparison between Unknown and I4 //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Invalid comparison between Unknown and I4 //IL_008b: 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_0092: Invalid comparison between Unknown and I4 if (!NetworkServer.active || report?.damageInfo == null || !IsDoctor(report.attackerBody) || (Object)(object)report.victimBody == (Object)null || (Object)(object)report.victim == (Object)null || !report.victim.alive) { return; } DamageTypeCombo damageType = report.damageInfo.damageType; if ((damageType.damageType & 0x4000000) == 0) { if ((int)damageType.damageSource == 8) { Detonate(report.victimBody, report.attackerBody); return; } int stacks = (((int)damageType.damageSource != 2 && (int)damageType.damageSource != 4) ? 1 : 2); AddStacks(report.victimBody, report.attacker, stacks); } } public static void AddStacks(CharacterBody victim, GameObject attacker, int stacks) { if (!((Object)(object)PlagueDoctorContent.PlagueBuff == (Object)null) && !((Object)(object)victim.healthComponent == (Object)null)) { for (int i = 0; i < stacks; i++) { victim.AddBuff(PlagueDoctorContent.PlagueBuff); } if (!_infected.TryGetValue(victim.healthComponent, out var value)) { value = new Infection { NextTick = Time.fixedTime + 0.5f }; _infected[victim.healthComponent] = value; } value.Attacker = attacker; if (victim.GetBuffCount(PlagueDoctorContent.PlagueBuff) >= 5 && !_epidemics.Any(((CharacterBody Victim, GameObject Attacker) e) => (Object)(object)e.Victim == (Object)(object)victim)) { _epidemics.Add((victim, attacker)); } } } private static void FixedUpdate() { //IL_0173: 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_0185: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Expected O, but got Unknown if (!NetworkServer.active || (Object)(object)PlagueDoctorContent.PlagueBuff == (Object)null) { return; } if (_epidemics.Count > 0) { List<(CharacterBody Victim, GameObject Attacker)> list = _epidemics.ToList(); _epidemics.Clear(); foreach (var (victim, attacker) in list) { Epidemic(victim, attacker); } } float fixedTime = Time.fixedTime; foreach (HealthComponent item in _infected.Keys.ToList()) { Infection infection = _infected[item]; CharacterBody val = (((Object)(object)item != (Object)null) ? item.body : null); int num = (((Object)(object)val != (Object)null) ? val.GetBuffCount(PlagueDoctorContent.PlagueBuff) : 0); if ((Object)(object)val == (Object)null || !item.alive || num <= 0) { _infected.Remove(item); } else if (!(fixedTime < infection.NextTick)) { CharacterBody val2 = (((Object)(object)infection.Attacker != (Object)null) ? infection.Attacker.GetComponent<CharacterBody>() : null); float num2 = (((Object)(object)val2 != (Object)null) ? Mathf.Max(1f, val2.attackSpeed) : 1f); infection.NextTick = fixedTime + 1f / num2; if (!((Object)(object)val2 == (Object)null)) { item.TakeDamage(new DamageInfo { attacker = infection.Attacker, inflictor = infection.Attacker, damage = val2.damage * 0.35f * (float)num, position = val.corePosition, damageType = Source((DamageSource)32, (DamageType)67108864), damageColorIndex = (DamageColorIndex)4, procCoefficient = 0f }); } } } if (fixedTime >= _nextHeal) { _nextHeal = fixedTime + 1f; HealDoctors(); } } private static void Epidemic(CharacterBody victim, GameObject attacker) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0077: 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_0085: 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_008f: 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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: 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_00be: 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) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: 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_0053: 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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown if ((Object)(object)victim == (Object)null || (Object)(object)attacker == (Object)null) { return; } CharacterBody component = attacker.GetComponent<CharacterBody>(); victim.SetBuffCount(PlagueDoctorContent.PlagueBuff.buffIndex, 0); if (!((Object)(object)component == (Object)null)) { Vector3 corePosition = victim.corePosition; if ((Object)(object)PlagueDoctorContent.ToxicBlast != (Object)null) { EffectManager.SpawnEffect(PlagueDoctorContent.ToxicBlast, new EffectData { origin = corePosition, scale = 9f }, true); } new BlastAttack { attacker = attacker, inflictor = attacker, teamIndex = component.teamComponent.teamIndex, position = corePosition, radius = 9f, baseDamage = component.damage * 3f, procCoefficient = 0.5f, falloffModel = (FalloffModel)0, attackerFiltering = (AttackerFiltering)2, crit = component.RollCrit(), damageColorIndex = (DamageColorIndex)4, damageType = Source((DamageSource)0, (DamageType)0) }.Fire(); } } private static void Detonate(CharacterBody victim, CharacterBody attacker) { //IL_0025: 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_0072: 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_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_00a1: 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_00b7: 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_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown //IL_0042: 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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown int buffCount = victim.GetBuffCount(PlagueDoctorContent.PlagueBuff); if (buffCount > 0 && !((Object)(object)victim.healthComponent == (Object)null)) { victim.SetBuffCount(PlagueDoctorContent.PlagueBuff.buffIndex, 0); if ((Object)(object)PlagueDoctorContent.ToxicBlast != (Object)null) { EffectManager.SpawnEffect(PlagueDoctorContent.ToxicBlast, new EffectData { origin = victim.corePosition, scale = 3f + (float)buffCount }, true); } victim.healthComponent.TakeDamage(new DamageInfo { attacker = ((Component)attacker).gameObject, inflictor = ((Component)attacker).gameObject, damage = attacker.damage * 1.5f * (float)buffCount, position = victim.corePosition, crit = attacker.RollCrit(), damageType = Source((DamageSource)32, (DamageType)67108864), damageColorIndex = (DamageColorIndex)4, procCoefficient = 1f }); } } private static void HealDoctors() { //IL_0080: 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_008b: 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_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) foreach (CharacterBody readOnlyInstances in CharacterBody.readOnlyInstancesList) { if (!IsDoctor(readOnlyInstances) || (Object)(object)readOnlyInstances.healthComponent == (Object)null || !readOnlyInstances.healthComponent.alive) { continue; } int num = 0; foreach (HealthComponent key in _infected.Keys) { if ((Object)(object)key != (Object)null && (Object)(object)key.body != (Object)null) { Vector3 val = key.body.corePosition - readOnlyInstances.corePosition; if (((Vector3)(ref val)).sqrMagnitude <= 900f) { num++; } } } if (num > 0) { readOnlyInstances.healthComponent.Heal(readOnlyInstances.healthComponent.fullHealth * 0.004f * (float)Mathf.Min(num, 10), default(ProcChainMask), true); } } } } internal sealed class PlagueDoctorContent : IContentPackProvider { public static GameObject BodyPrefab; public static BodyIndex BodyIndex = (BodyIndex)(-1); public static BuffDef PlagueBuff; public static GameObject AcidPool; public static GameObject ToxicBlast; public static GameObject SlamEffect; public static GameObject SmokeEffect; public static GameObject SlashEffect; private readonly ContentPack _pack = new ContentPack(); private static readonly FieldInfo SkillFamilyField = typeof(GenericSkill).GetField("_skillFamily", BindingFlags.Instance | BindingFlags.NonPublic); public string identifier => "local.PlagueDoctor"; public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args) { try { Build(); } catch (Exception ex) { Plugin.Log.LogError((object)("Plague Doctor could not be built: " + ex)); } args.ReportProgress(1f); yield break; } public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args) { ContentPack.Copy(_pack, args.output); args.ReportProgress(1f); yield break; } public IEnumerator FinalizeAsync(FinalizeAsyncArgs args) { args.ReportProgress(1f); yield break; } private void Build() { //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) AcidPool = GameAssets.Load<GameObject>("Assets/RoR2/Base/Characters/Croco/Skills/CrocoLeapAcid.prefab"); ToxicBlast = GameAssets.Load<GameObject>("Assets/RoR2/Base/Characters/Croco/Skills/CrocoLeapExplosion.prefab"); SlamEffect = GameAssets.Load<GameObject>("Assets/RoR2/Base/Characters/Loader/Skills/LoaderGroundSlam.prefab"); SmokeEffect = GameAssets.Load<GameObject>("Assets/RoR2/Base/Characters/Bandit2/Skills/Bandit2SmokeBomb.prefab"); SlashEffect = GameAssets.Load<GameObject>("Assets/RoR2/Base/Common/VFX/Stylized(Omni)/OmniImpactVFXSlash.prefab"); PlagueBuff = ScriptableObject.CreateInstance<BuffDef>(); ((Object)PlagueBuff).name = "bdPlagueDoctorPlague"; PlagueBuff.canStack = true; PlagueBuff.isDebuff = true; PlagueBuff.buffColor = new Color(0.45f, 0.95f, 0.3f); _pack.buffDefs.Add((BuffDef[])(object)new BuffDef[1] { PlagueBuff }); ((ResourceAvailability)(ref BuffCatalog.availability)).CallWhenAvailable((Action)delegate { PlagueBuff.iconSprite = Buffs.Poisoned.iconSprite; }); BodyPrefab = CloneNetworked(GameAssets.Load<GameObject>("Assets/RoR2/Base/Characters/Bandit2/Bandit2Body.prefab"), "PlagueDoctorBody"); SetUpBody(BodyPrefab.GetComponent<CharacterBody>()); CharacterBody component = BodyPrefab.GetComponent<CharacterBody>(); component.preferredPodPrefab = GameAssets.Load<GameObject>("Assets/RoR2/Base/Interactables/Vehicles/SurvivorPod/SurvivorPod.prefab"); component.preferredInitialStateType = new SerializableEntityStateType(typeof(GenericCharacterMain)); SetUpSkills(BodyPrefab.GetComponent<SkillLocator>()); bool flag = DoctorModel.Load(Plugin.Folder); if (flag) { DoctorModel.ReplaceModel(BodyPrefab); } _pack.bodyPrefabs.Add((GameObject[])(object)new GameObject[1] { BodyPrefab }); ((ResourceAvailability)(ref BodyCatalog.availability)).CallWhenAvailable((Action)delegate { //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) BodyIndex = BodyCatalog.FindBodyIndex(BodyPrefab); }); SurvivorDef val = ScriptableObject.CreateInstance<SurvivorDef>(); ((Object)val).name = "PlagueDoctor"; val.bodyPrefab = BodyPrefab; val.displayPrefab = (flag ? DoctorModel.MakeDisplay(BodyPrefab.transform.parent) : GameAssets.Load<GameObject>("Assets/RoR2/Base/Characters/Bandit2/Bandit2Display.prefab")); val.displayNameToken = "PLAGUEDOCTOR_NAME"; val.descriptionToken = "PLAGUEDOCTOR_DESCRIPTION"; val.outroFlavorToken = "PLAGUEDOCTOR_OUTRO"; val.mainEndingEscapeFailureFlavorToken = "PLAGUEDOCTOR_FAIL"; val.primaryColor = new Color(0.45f, 0.95f, 0.3f); val.desiredSortPosition = 100f; _pack.survivorDefs.Add((SurvivorDef[])(object)new SurvivorDef[1] { val }); _pack.entityStateTypes.Add(new Type[6] { typeof(CaneSwing), typeof(FlyingFlask), typeof(SmokeDash), typeof(BlackDeathLeap), typeof(BlackDeathHover), typeof(BlackDeathSlam) }); Plugin.Log.LogInfo((object)"Plague Doctor built."); } private static void SetUpBody(CharacterBody body) { //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_00c6: Unknown result type (might be due to invalid IL or missing references) body.baseNameToken = "PLAGUEDOCTOR_NAME"; body.subtitleNameToken = "PLAGUEDOCTOR_SUBTITLE"; body.bodyColor = new Color(0.45f, 0.95f, 0.3f); body.portraitIcon = (Texture)(object)Icons.Texture("portrait"); body.baseMaxHealth = 130f; body.levelMaxHealth = 39f; body.baseRegen = 1.2f; body.levelRegen = 0.24f; body.baseDamage = 15f; body.levelDamage = 3f; body.baseAttackSpeed = 1f; body.baseCrit = 1f; body.baseArmor = 12f; body.baseMoveSpeed = 7.5f; body.baseJumpPower = 16f; body.sprintingSpeedMultiplier = 1.5f; body.bodyFlags = (BodyFlags)1; } private void SetUpSkills(SkillLocator locator) { //IL_0003: 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) locator.passiveSkill = new PassiveSkill { enabled = true, skillNameToken = "PLAGUEDOCTOR_PASSIVE_NAME", skillDescriptionToken = "PLAGUEDOCTOR_PASSIVE_DESC", icon = Icons.Sprite("passive") }; SteppedSkillDef val = ScriptableObject.CreateInstance<SteppedSkillDef>(); val.stepCount = 3; val.stepGraceDuration = 0.6f; Configure((SkillDef)(object)val, "PRIMARY", typeof(CaneSwing), "Weapon", 0f, 1, (InterruptPriority)0); ((SkillDef)val).requiredStock = 0; ((SkillDef)val).stockToConsume = 0; ((SkillDef)val).mustKeyPress = false; ((SkillDef)val).cancelSprintingOnActivation = true; SkillDef def = Configure(ScriptableObject.CreateInstance<SkillDef>(), "SECONDARY", typeof(FlyingFlask), "Body", 5f, 2, (InterruptPriority)1); SkillDef def2 = Configure(ScriptableObject.CreateInstance<SkillDef>(), "UTILITY", typeof(SmokeDash), "Body", 6f, 1, (InterruptPriority)2); SkillDef val2 = Configure(ScriptableObject.CreateInstance<SkillDef>(), "SPECIAL", typeof(BlackDeathLeap), "Body", 10f, 1, (InterruptPriority)2); val2.beginSkillCooldownOnSkillEnd = true; Assign(locator.primary, (SkillDef)(object)val); Assign(locator.secondary, def); Assign(locator.utility, def2); Assign(locator.special, val2); GenericSkill[] components = ((Component)locator).GetComponents<GenericSkill>(); foreach (GenericSkill val3 in components) { if ((Object)(object)val3 != (Object)(object)locator.primary && (Object)(object)val3 != (Object)(object)locator.secondary && (Object)(object)val3 != (Object)(object)locator.utility && (Object)(object)val3 != (Object)(object)locator.special) { Object.DestroyImmediate((Object)(object)val3); } } } private SkillDef Configure(SkillDef def, string slot, Type state, string machine, float cooldown, int stock, InterruptPriority priority) { //IL_0061: 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_0099: 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) ((Object)def).name = "PlagueDoctor" + slot; def.skillName = "PlagueDoctor" + slot; def.skillNameToken = "PLAGUEDOCTOR_" + slot + "_NAME"; def.skillDescriptionToken = "PLAGUEDOCTOR_" + slot + "_DESC"; def.icon = Icons.Sprite(slot.ToLowerInvariant()); def.activationState = new SerializableEntityStateType(state); def.activationStateMachineName = machine; def.baseRechargeInterval = cooldown; def.baseMaxStock = stock; def.rechargeStock = 1; def.requiredStock = 1; def.stockToConsume = 1; def.interruptPriority = priority; def.isCombatSkill = true; def.mustKeyPress = true; def.canceledFromSprinting = false; def.cancelSprintingOnActivation = false; def.fullRestockOnAssign = true; _pack.skillDefs.Add((SkillDef[])(object)new SkillDef[1] { def }); return def; } private void Assign(GenericSkill slot, SkillDef def) { //IL_0027: 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_0049: Expected O, but got Unknown //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) SkillFamily val = ScriptableObject.CreateInstance<SkillFamily>(); ((Object)val).name = def.skillName + "Family"; Variant[] array = new Variant[1]; Variant val2 = new Variant { skillDef = def }; ((Variant)(ref val2)).viewableNode = new Node(def.skillName, false, (Node)null); array[0] = val2; val.variants = (Variant[])(object)array; SkillFamilyField.SetValue(slot, val); _pack.skillFamilies.Add((SkillFamily[])(object)new SkillFamily[1] { val }); } private static GameObject CloneNetworked(GameObject original, string name) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_008c: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("PlagueDoctorPrefabs"); val.SetActive(false); Object.DontDestroyOnLoad((Object)(object)val); GameObject val2 = Object.Instantiate<GameObject>(original, val.transform); ((Object)val2).name = name; NetworkIdentity component = val2.GetComponent<NetworkIdentity>(); if ((Object)(object)component != (Object)null) { using MD5 mD = MD5.Create(); string text = BitConverter.ToString(mD.ComputeHash(Encoding.UTF8.GetBytes("local.PlagueDoctor" + name))).Replace("-", ""); typeof(NetworkIdentity).GetField("m_AssetId", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(component, NetworkHash128.Parse(text)); } return val2; } } internal static class GameAssets { private static Dictionary<string, IResourceLocation> _locations; public static T Load<T>(string path) where T : Object { //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) if (_locations == null) { _locations = new Dictionary<string, IResourceLocation>(StringComparer.OrdinalIgnoreCase); IList<IResourceLocation> list = default(IList<IResourceLocation>); foreach (IResourceLocator resourceLocator in Addressables.ResourceLocators) { foreach (object key in resourceLocator.Keys) { if (!(key is string) || !resourceLocator.Locate(key, (Type)null, ref list)) { continue; } foreach (IResourceLocation item in list) { if (item.InternalId != null && item.InternalId.StartsWith("Assets/") && !_locations.ContainsKey(item.InternalId)) { _locations[item.InternalId] = item; } } } } } if (_locations.TryGetValue(path, out var value)) { return Addressables.LoadAssetAsync<T>(value).WaitForCompletion(); } Plugin.Log.LogWarning((object)("Game asset not found: " + path)); return default(T); } } [BepInPlugin("local.PlagueDoctor", "Plague Doctor", "1.1.0")] public sealed class Plugin : BaseUnityPlugin { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static CollectContentPackProvidersDelegate <>9__3_0; internal void <Awake>b__3_0(AddContentPackProviderDelegate add) { add.Invoke((IContentPackProvider)(object)new PlagueDoctorContent()); } } public const string Guid = "local.PlagueDoctor"; internal static ManualLogSource Log; internal static string Folder; private void Awake() { //IL_0049: 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_003f: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; Folder = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); object obj = <>c.<>9__3_0; if (obj == null) { CollectContentPackProvidersDelegate val = delegate(AddContentPackProviderDelegate add) { add.Invoke((IContentPackProvider)(object)new PlagueDoctorContent()); }; <>c.<>9__3_0 = val; obj = (object)val; } ContentManager.collectContentPackProviders += (CollectContentPackProvidersDelegate)obj; new Harmony("local.PlagueDoctor").PatchAll(typeof(Tokens)); Plague.Initialize(); Fx.Initialize(); Voice.Initialize(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location)); } } [HarmonyPatch] internal static class Tokens { [HarmonyPatch(typeof(Language), "GetLocalizedStringByToken")] [HarmonyPrefix] private static bool GetLocalizedStringByToken(Language __instance, string token, ref string __result) { if (token == null || !token.StartsWith("PLAGUEDOCTOR_")) { return true; } if (((__instance != null && __instance.name == "ru") ? Texts.Ru : Texts.En).TryGetValue(token, out var value) || Texts.En.TryGetValue(token, out value)) { __result = value; return false; } return true; } } internal static class Texts { public static readonly Dictionary<string, string> Ru = new Dictionary<string, string> { ["PLAGUEDOCTOR_NAME"] = "Чумной доктор", ["PLAGUEDOCTOR_SUBTITLE"] = "Лекарь Чёрной смерти", ["PLAGUEDOCTOR_DESCRIPTION"] = "Чумной доктор — стремительный боец ближнего боя, который заражает всё вокруг и летает по полю боя на взрывах своих колб.<color=#CCD3E0>\n\n< ! > Чем выше скорость атаки, тем больше эхо-ударов наносит трость и тем быстрее тикает чума.\n\n< ! > «Летучая колба» — твой главный способ передвижения: целься туда, куда хочешь улететь.\n\n< ! > Набери на врагах побольше чумы и обрушься «Чёрной смертью» — она взорвёт все стаки разом.</color>", ["PLAGUEDOCTOR_OUTRO"] = "...и он ушёл, оставив за собой лишь запах трав и тишину.", ["PLAGUEDOCTOR_FAIL"] = "...и стал ещё одной жертвой чумы, которую лечил.", ["PLAGUEDOCTOR_PASSIVE_NAME"] = "Чума", ["PLAGUEDOCTOR_PASSIVE_DESC"] = "Все атаки накладывают <style=cIsHealing>чуму</style>: <style=cIsDamage>35% урона</style> в секунду за стак, тикает быстрее от <style=cIsDamage>скорости атаки</style>. На <style=cIsDamage>5 стаках</style> начинается <style=cIsDamage>эпидемия</style>: враг взрывается на <style=cIsDamage>300% урона</style> и заражает всех вокруг. Ты <style=cIsHealing>лечишься</style> за каждого заражённого врага рядом.", ["PLAGUEDOCTOR_PRIMARY_NAME"] = "Трость лекаря", ["PLAGUEDOCTOR_PRIMARY_DESC"] = "Комбо тростью: <style=cIsDamage>320%</style>, <style=cIsDamage>320%</style> и выпад с подбросом на <style=cIsDamage>600% урона</style>. За каждые <style=cIsDamage>100% скорости атаки</style> сверх базовой удар бьёт ещё раз эхом на <style=cIsDamage>50%</style> (до 3 эхо).", ["PLAGUEDOCTOR_SECONDARY_NAME"] = "Летучая колба", ["PLAGUEDOCTOR_SECONDARY_DESC"] = "Разбей колбу под ногами: <style=cIsDamage>400% урона</style>, <style=cIsHealing>2 стака чумы</style> и ядовитая лужа. Взрыв <style=cIsUtility>швыряет тебя туда, куда ты смотришь</style>. <style=cIsUtility>2 заряда</style>.", ["PLAGUEDOCTOR_UTILITY_NAME"] = "Дымовая завеса", ["PLAGUEDOCTOR_UTILITY_DESC"] = "Разбей дымовую колбу и <style=cIsUtility>рвани сквозь врагов</style>, становясь <style=cIsUtility>невидимым</style>. Все, через кого ты прошёл, получают <style=cIsDamage>150% урона</style> и <style=cIsHealing>2 стака чумы</style>.", ["PLAGUEDOCTOR_SPECIAL_NAME"] = "Чёрная смерть", ["PLAGUEDOCTOR_SPECIAL_DESC"] = "Взлети на колбе, зависни и <style=cIsDamage>обрушься тростью</style> туда, куда смотришь: <style=cIsDamage>1200% урона</style> вокруг. Удар <style=cIsDamage>взрывает все стаки чумы</style> на врагах: <style=cIsDamage>150% урона за стак</style>." }; public static readonly Dictionary<string, string> En = new Dictionary<string, string> { ["PLAGUEDOCTOR_NAME"] = "Plague Doctor", ["PLAGUEDOCTOR_SUBTITLE"] = "Physician of the Black Death", ["PLAGUEDOCTOR_DESCRIPTION"] = "The Plague Doctor is a fast melee fighter who infects everything around him and flies across the battlefield on the blasts of his flasks.<color=#CCD3E0>\n\n< ! > More attack speed means more echo strikes from the cane and faster plague ticks.\n\n< ! > Flying Flask is your main way to move: aim where you want to fly.\n\n< ! > Stack plague on enemies, then crash down with Black Death to detonate it all.</color>", ["PLAGUEDOCTOR_OUTRO"] = "...and so he left, leaving only the smell of herbs and silence.", ["PLAGUEDOCTOR_FAIL"] = "...and so he became another victim of the plague he treated.", ["PLAGUEDOCTOR_PASSIVE_NAME"] = "Plague", ["PLAGUEDOCTOR_PASSIVE_DESC"] = "All attacks apply <style=cIsHealing>plague</style>: <style=cIsDamage>35% damage</style> per second per stack, ticking faster with <style=cIsDamage>attack speed</style>. At <style=cIsDamage>5 stacks</style> an <style=cIsDamage>epidemic</style> breaks out: the enemy bursts for <style=cIsDamage>300% damage</style> and infects everyone nearby. <style=cIsHealing>Heal</style> for every infected enemy near you.", ["PLAGUEDOCTOR_PRIMARY_NAME"] = "Physician's Cane", ["PLAGUEDOCTOR_PRIMARY_DESC"] = "Cane combo: <style=cIsDamage>320%</style>, <style=cIsDamage>320%</style> and a launching lunge for <style=cIsDamage>600% damage</style>. Every <style=cIsDamage>100% bonus attack speed</style> adds an echo strike for <style=cIsDamage>50%</style> (up to 3).", ["PLAGUEDOCTOR_SECONDARY_NAME"] = "Flying Flask", ["PLAGUEDOCTOR_SECONDARY_DESC"] = "Smash a flask at your feet: <style=cIsDamage>400% damage</style>, <style=cIsHealing>2 plague stacks</style> and a toxic pool. The blast <style=cIsUtility>launches you where you aim</style>. <style=cIsUtility>2 charges</style>.", ["PLAGUEDOCTOR_UTILITY_NAME"] = "Smoke Screen", ["PLAGUEDOCTOR_UTILITY_DESC"] = "Smash a smoke flask and <style=cIsUtility>dash through enemies</style>, turning <style=cIsUtility>invisible</style>. Everyone you pass takes <style=cIsDamage>150% damage</style> and <style=cIsHealing>2 plague stacks</style>.", ["PLAGUEDOCTOR_SPECIAL_NAME"] = "Black Death", ["PLAGUEDOCTOR_SPECIAL_DESC"] = "Launch on a flask, hover and <style=cIsDamage>crash down</style> where you aim for <style=cIsDamage>1200% damage</style>. The impact <style=cIsDamage>detonates all plague</style> on enemies for <style=cIsDamage>150% damage per stack</style>." }; } internal static class Voice { public const string Spawn = "spawn"; public const string Kill = "kill"; public const string Special = "special"; public const string LowHealth = "lowhp"; public const string Teleporter = "teleporter"; public const string Death = "death"; private const float Cooldown = 4f; private const float KillChance = 0.35f; private const float HearingDistance = 45f; private static readonly Dictionary<string, List<GCHandle>> _lines = new Dictionary<string, List<GCHandle>>(); private static readonly Dictionary<CharacterBody, float> _nextLine = new Dictionary<CharacterBody, float>(); private static readonly HashSet<CharacterBody> _lowHealth = new HashSet<CharacterBody>(); private const uint SND_ASYNC = 1u; private const uint SND_NODEFAULT = 2u; private const uint SND_MEMORY = 4u; [DllImport("winmm.dll", SetLastError = true)] private static extern bool PlaySound(IntPtr sound, IntPtr module, uint flags); public static void Initialize(string pluginFolder) { string path = Path.Combine(pluginFolder, "voice"); if (!Directory.Exists(path)) { Plugin.Log.LogInfo((object)"No voice folder, the doctor stays silent."); return; } string[] files = Directory.GetFiles(path, "*.wav"); foreach (string path2 in files) { string text = Path.GetFileNameWithoutExtension(path2).ToLowerInvariant(); int num = text.LastIndexOf('_'); string key = ((num > 0) ? text.Substring(0, num) : text); if (!_lines.TryGetValue(key, out var value)) { value = (_lines[key] = new List<GCHandle>()); } value.Add(GCHandle.Alloc(File.ReadAllBytes(path2), GCHandleType.Pinned)); } Plugin.Log.LogInfo((object)("Voice lines: " + string.Join(", ", _lines.Select((KeyValuePair<string, List<GCHandle>> l) => $"{l.Key} ×{l.Value.Count}")))); CharacterBody.onBodyStartGlobal += delegate(CharacterBody body) { if (IsDoctor(body)) { _nextLine[body] = Time.time + 1.5f; Delayed(body, "spawn", 1.5f); } }; GlobalEventManager.onClientDamageNotified += OnDamage; TeleporterInteraction.onTeleporterBeginChargingGlobal += delegate { CharacterBody val = ((IEnumerable<CharacterBody>)CharacterBody.readOnlyInstancesList).FirstOrDefault((Func<CharacterBody, bool>)IsDoctor); if ((Object)(object)val != (Object)null) { Say(val, "teleporter", force: true); } }; RoR2Application.onUpdate += CheckHealth; } private static bool IsDoctor(CharacterBody body) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Invalid comparison between Unknown and I4 //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)body != (Object)null && (int)PlagueDoctorContent.BodyIndex != -1) { return body.bodyIndex == PlagueDoctorContent.BodyIndex; } return false; } public static void Say(CharacterBody body, string line, bool force = false) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) if (!_lines.TryGetValue(line, out var value) || value.Count == 0 || (Object)(object)body == (Object)null || (!force && _nextLine.TryGetValue(body, out var value2) && Time.time < value2)) { return; } CharacterBody val = LocalBody(); if ((Object)(object)val != (Object)null && (Object)(object)val != (Object)(object)body) { Vector3 val2 = val.corePosition - body.corePosition; if (((Vector3)(ref val2)).sqrMagnitude > 2025f) { return; } } _nextLine[body] = Time.time + 4f; PlaySound(value[Random.Range(0, value.Count)].AddrOfPinnedObject(), IntPtr.Zero, 7u); } private static void Delayed(CharacterBody body, string line, float delay) { float at = Time.time + delay; RoR2Application.onUpdate += Wait; void Wait() { if (!(Time.time < at)) { RoR2Application.onUpdate -= Wait; Say(body, line, force: true); } } } private static CharacterBody LocalBody() { LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser(); if (firstLocalUser == null) { return null; } return firstLocalUser.cachedBody; } private static void OnDamage(DamageDealtMessage message) { if ((Object)(object)message?.victim == (Object)null) { return; } HealthComponent component = message.victim.GetComponent<HealthComponent>(); if (!((Object)(object)component == (Object)null) && !component.alive) { CharacterBody body = (((Object)(object)message.attacker != (Object)null) ? message.attacker.GetComponent<CharacterBody>() : null); if (IsDoctor(component.body)) { Say(component.body, "death", force: true); } else if (IsDoctor(body) && Random.value < 0.35f) { Say(body, "kill"); } } } private static void CheckHealth() { foreach (CharacterBody readOnlyInstances in CharacterBody.readOnlyInstancesList) { if (IsDoctor(readOnlyInstances) && !((Object)(object)readOnlyInstances.healthComponent == (Object)null)) { bool flag = readOnlyInstances.healthComponent.alive && readOnlyInstances.healthComponent.combinedHealthFraction < 0.25f; if (flag && _lowHealth.Add(readOnlyInstances)) { Say(readOnlyInstances, "lowhp"); } else if (!flag) { _lowHealth.Remove(readOnlyInstances); } } } _lowHealth.RemoveWhere((CharacterBody b) => (Object)(object)b == (Object)null); } } } namespace PlagueDoctor.States { internal static class Anim { private static readonly int AttackRate = Animator.StringToHash("attackRate"); public static void Play(EntityState state, string layer, params string[] names) { Play(state, layer, 1f, names); } public static void Play(EntityState state, string layer, float rate, params string[] names) { object obj; if (!((Object)(object)state.outer != (Object)null)) { obj = null; } else { ModelLocator component = ((Component)state.outer).GetComponent<ModelLocator>(); if (component == null) { obj = null; } else { Transform modelTransform = component.modelTransform; obj = ((modelTransform != null) ? ((Component)modelTransform).GetComponent<Animator>() : null); } } Animator val = (Animator)obj; if ((Object)(object)val == (Object)null) { return; } val.SetFloat(AttackRate, rate); string[] array = new string[4] { layer, "Gesture, Override", "Gesture, Additive", "FullBody, Override" }; foreach (string text in array) { int layerIndex = val.GetLayerIndex(text); if (layerIndex < 0) { continue; } foreach (string text2 in names) { if (val.HasState(layerIndex, Animator.StringToHash(text2))) { val.Play(text2, layerIndex, 0f); val.SetLayerWeight(layerIndex, 1f); return; } } } } public static void Stop(EntityState state, string layer) { object obj; if (!((Object)(object)state.outer != (Object)null)) { obj = null; } else { ModelLocator component = ((Component)state.outer).GetComponent<ModelLocator>(); if (component == null) { obj = null; } else { Transform modelTransform = component.modelTransform; obj = ((modelTransform != null) ? ((Component)modelTransform).GetComponent<Animator>() : null); } } Animator val = (Animator)obj; int num = (((Object)(object)val != (Object)null) ? val.GetLayerIndex(layer) : (-1)); if (num >= 0 && val.HasState(num, Animator.StringToHash("Empty"))) { val.CrossFadeInFixedTime("Empty", 0.1f, num); } } } public sealed class LayerFader : MonoBehaviour { private const float FadeTime = 0.15f; private static readonly int EmptyHash = Animator.StringToHash("Empty"); private Animator _animator; private void Awake() { _animator = ((Component)this).GetComponent<Animator>(); } private void LateUpdate() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_animator == (Object)null) { return; } for (int i = 1; i < _animator.layerCount; i++) { AnimatorStateInfo currentAnimatorStateInfo = _animator.GetCurrentAnimatorStateInfo(i); bool num = ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).shortNameHash == EmptyHash && !_animator.IsInTransition(i); float layerWeight = _animator.GetLayerWeight(i); float num2 = (num ? 0f : 1f); if (layerWeight != num2) { _animator.SetLayerWeight(i, Mathf.MoveTowards(layerWeight, num2, Time.deltaTime / 0.15f)); } } } } public sealed class SelectIntro : MonoBehaviour { private void OnEnable() { Animator component = ((Component)this).GetComponent<Animator>(); if ((Object)(object)component != (Object)null && component.HasState(0, Animator.StringToHash("SelectFlask"))) { component.Play("SelectFlask", 0, 0f); } } } public class CaneSwing : BaseSkillState, IStepSetter { private static readonly float[] DamageCoefficients = new float[3] { 3.2f, 3.2f, 6f }; private static readonly float[] BaseDurations = new float[3] { 0.5f, 0.5f, 0.75f }; private static readonly float[] StrikeFrames = new float[3] { 8f, 8f, 11f }; private const float EchoDamage = 0.5f; private const float ReachCenter = 1.3f; private const int MaxEchoes = 3; private int _step; private float _duration; private float _hitTime; private bool _fired; public void SetStep(int i) { _step = Mathf.Clamp(i, 0, 2); } public override void OnEnter() { //IL_00dc: 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_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) ((BaseState)this).OnEnter(); _duration = BaseDurations[_step] / ((BaseState)this).attackSpeedStat; _hitTime = _duration * ((_step == 2) ? 0.45f : 0.35f); ((BaseState)this).StartAimMode(2f, false); float num = StrikeFrames[_step] / 30f; Anim.Play((EntityState)(object)this, "Gesture, Override", num / _hitTime, "Swing" + (_step + 1), "SlashBlade"); Util.PlayAttackSpeedSound("Play_merc_sword_swing", ((EntityState)this).gameObject, ((BaseState)this).attackSpeedStat); CaneTrail.Set((EntityState)(object)this, on: true); if (_step == 2 && ((EntityState)this).isAuthority && (Object)(object)((EntityState)this).characterMotor != (Object)null) { Ray aimRay = ((BaseState)this).GetAimRay(); Vector3 direction = ((Ray)(ref aimRay)).direction; direction.y = 0f; CharacterMotor characterMotor = ((EntityState)this).characterMotor; characterMotor.velocity += ((Vector3)(ref direction)).normalized * 16f; } } public override void FixedUpdate() { ((EntityState)this).FixedUpdate(); if (!_fired && ((EntityState)this).fixedAge >= _hitTime) { _fired = true; Strike(); } if (((EntityState)this).fixedAge >= _duration && ((EntityState)this).isAuthority) { ((EntityState)this).outer.SetNextStateToMain(); } } private void Strike() { //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_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: 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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: 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_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: 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) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) Ray aimRay = ((BaseState)this).GetAimRay(); Vector3 val = ((EntityState)this).characterBody.corePosition + ((Ray)(ref aimRay)).direction * 1.3f; float num = ((_step == 2) ? 1.9f : 1.5f); if ((Object)(object)PlagueDoctorContent.SlashEffect != (Object)null) { EffectManager.SpawnEffect(PlagueDoctorContent.SlashEffect, new EffectData { origin = val, scale = num }, false); } Fx.Splash(val); if (((EntityState)this).isAuthority) { int num2 = Mathf.Clamp(Mathf.FloorToInt(((BaseState)this).attackSpeedStat - 1f), 0, 3); bool crit = ((BaseState)this).RollCrit(); for (int i = 0; i <= num2; i++) { new BlastAttack { attacker = ((EntityState)this).gameObject, inflictor = ((EntityState)this).gameObject, teamIndex = ((BaseState)this).GetTeam(), position = val, radius = num, baseDamage = ((BaseState)this).damageStat * DamageCoefficients[_step] * ((i == 0) ? 1f : 0.5f), baseForce = ((i == 0) ? 600f : 0f), bonusForce = ((_step == 2 && i == 0) ? (Vector3.up * 1800f) : Vector3.zero), procCoefficient = ((i == 0) ? 1f : 0.5f), falloffModel = (FalloffModel)0, attackerFiltering = (AttackerFiltering)2, crit = crit, damageType = Plague.Source((DamageSource)1, (DamageType)0) }.Fire(); } if ((Object)(object)((EntityState)this).characterMotor != (Object)null && !((EntityState)this).characterMotor.isGrounded) { ((BaseState)this).SmallHop(((EntityState)this).characterMotor, 4f); } } } public override void OnExit() { CaneTrail.Set((EntityState)(object)this, on: false); ((EntityState)this).OnExit(); } public override InterruptPriority GetMinimumInterruptPriority() { return (InterruptPriority)1; } public override void OnSerialize(NetworkWriter writer) { ((BaseSkillState)this).OnSerialize(writer); writer.Write((byte)_step); } public override void OnDeserialize(NetworkReader reader) { ((BaseSkillState)this).OnDeserialize(reader); _step = reader.ReadByte(); } } public class FlyingFlask : BaseSkillState { private const float Duration = 0.25f; private const float Radius = 7f; public override void OnEnter() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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_005a: Expected O, but got Unknown //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_0099: 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) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0100: 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_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0114: 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_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0126: 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_015d: Unknown result type (might be due to invalid IL or missing references) ((BaseState)this).OnEnter(); Anim.Play((EntityState)(object)this, "Gesture, Override", "ThrowFlask"); Vector3 footPosition = ((EntityState)this).characterBody.footPosition; if ((Object)(object)PlagueDoctorContent.ToxicBlast != (Object)null) { EffectManager.SpawnEffect(PlagueDoctorContent.ToxicBlast, new EffectData { origin = footPosition, scale = 7f }, false); } Fx.FlaskBlast(footPosition, 7f); if (((EntityState)this).isAuthority) { new BlastAttack { attacker = ((EntityState)this).gameObject, inflictor = ((EntityState)this).gameObject, teamIndex = ((BaseState)this).GetTeam(), position = footPosition, radius = 7f, baseDamage = ((BaseState)this).damageStat * 4f, baseForce = 1200f, procCoefficient = 1f, falloffModel = (FalloffModel)0, attackerFiltering = (AttackerFiltering)2, crit = ((BaseState)this).RollCrit(), damageType = Plague.Source((DamageSource)2, (DamageType)0) }.Fire(); FirePool(footPosition, 0.5f); Ray aimRay = ((BaseState)this).GetAimRay(); Vector3 val = ((Ray)(ref aimRay)).direction * 30f; val.y = Mathf.Max(val.y, 0f) + 13f; ((BaseCharacterController)((EntityState)this).characterMotor).Motor.ForceUnground(0.1f); ((EntityState)this).characterMotor.velocity = val; } } private void FirePool(Vector3 position, float coefficient) { //IL_0015: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)PlagueDoctorContent.AcidPool == (Object)null)) { ProjectileManager.instance.FireProjectile(new FireProjectileInfo { projectilePrefab = PlagueDoctorContent.AcidPool, position = position, rotation = Quaternion.identity, owner = ((EntityState)this).gameObject, damage = ((BaseState)this).damageStat * coefficient, crit = ((BaseState)this).RollCrit() }); } } public override void FixedUpdate() { ((EntityState)this).FixedUpdate(); if (((EntityState)this).fixedAge >= 0.25f && ((EntityState)this).isAuthority) { ((EntityState)this).outer.SetNextStateToMain(); } } public override InterruptPriority GetMinimumInterruptPriority() { return (InterruptPriority)2; } } public class SmokeDash : BaseSkillState { private const float Duration = 0.32f; private const float SpeedCoefficient = 7f; private const float HitInterval = 0.08f; private Vector3 _direction; private float _nextHit; private float _nextPuff; public override void OnEnter() { //IL_003c: 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_007b: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) ((BaseState)this).OnEnter(); Anim.Play((EntityState)(object)this, "FullBody, Override", "SmokeDash"); Util.PlaySound("Play_bandit2_shift_enter", ((EntityState)this).gameObject); Smoke(); Fx.FlaskBlast(((EntityState)this).characterBody.footPosition, 3f, smoke: true); Vector3 direction; if (!((Object)(object)((EntityState)this).inputBank != (Object)null) || !(((Vector3)(ref ((EntityState)this).inputBank.moveVector)).sqrMagnitude > 0.01f)) { Ray aimRay = ((BaseState)this).GetAimRay(); direction = ((Ray)(ref aimRay)).direction; } else { direction = ((EntityState)this).inputBank.moveVector; } _direction = direction; _direction.y = 0f; ((Vector3)(ref _direction)).Normalize(); if (NetworkServer.active) { ((EntityState)this).characterBody.AddTimedBuff(Buffs.Cloak, 2f); ((EntityState)this).characterBody.AddTimedBuff(Buffs.CloakSpeed, 2f); ((EntityState)this).characterBody.AddTimedBuff(Buffs.HiddenInvincibility, 0.42f); } } private void Smoke() { //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) if ((Object)(object)PlagueDoctorContent.SmokeEffect != (Object)null && (Object)(object)((EntityState)this).characterBody != (Object)null) { EffectManager.SimpleEffect(PlagueDoctorContent.SmokeEffect, ((EntityState)this).characterBody.footPosition, Quaternion.identity, false); } } public override void FixedUpdate() { //IL_002c: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown res