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 HatterWeaponsPack v1.0.0
HatterWeaponsPack.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.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Photon.Pun; using REPOLib.Modules; using UnityEngine; using UnityEngine.Events; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")] [assembly: AssemblyCompany("HatterWeaponsPack")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("HatterWeaponsPack")] [assembly: AssemblyTitle("HatterWeaponsPack")] [assembly: AssemblyVersion("1.0.0.0")] namespace HatterWeaponsPack; public abstract class ChargedWand : MonoBehaviour { public GameObject tipCrystal; protected ItemGun gun; private PhysGrabObject physGrabObject; protected PhotonView photonView; private ItemEquippable equippable; private int idCounter; private readonly Dictionary<int, GameObject> inFlight = new Dictionary<int, GameObject>(); private bool charging; private float chargeTimer; private bool hostCharging; private bool hostFreeCast; private float hostChargeTimer; private Light tipLight; private SoftGlow tipHalo; private Renderer tipRenderer; private Material tipMaterial; private float tipGlow = -1f; private static readonly FieldInfo StateField = AccessTools.Field(typeof(ItemGun), "stateCurrent"); private static readonly FieldInfo HeldByLocalField = AccessTools.Field(typeof(PhysGrabObject), "heldByLocalPlayer"); private static readonly FieldInfo BatteryIntField = AccessTools.Field(typeof(ItemBattery), "batteryLifeInt"); private static readonly FieldInfo EquippedField = AccessTools.Field(typeof(ItemEquippable), "isEquipped"); protected abstract Color TipColor { get; } protected abstract Color TipDarkColor { get; } protected abstract float ChargeSeconds { get; } protected abstract string ChargeLines { get; } protected abstract Vector3 TipLocalPosition { get; } protected virtual float ReadyGlow => 1f; internal bool Releasing { get; private set; } internal PhysGrabObject PhysGrabObject => physGrabObject; protected Transform Tip { get { if (!((Object)(object)gun != (Object)null) || !((Object)(object)gun.gunMuzzle != (Object)null)) { return ((Component)this).transform; } return gun.gunMuzzle; } } protected bool IsHost => SemiFunc.IsMasterClientOrSingleplayer(); protected PlayerAvatar Holder => ProjectileHits.Holder(physGrabObject); protected Transform HolderView { get { PlayerAvatar holder = Holder; if ((Object)(object)holder == (Object)null || (Object)(object)holder.localCamera == (Object)null) { return null; } try { return holder.localCamera.GetOverrideTransform(); } catch { return null; } } } protected float HolderPitch { get { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) Transform holderView = HolderView; float num = (((Object)(object)holderView != (Object)null) ? holderView.eulerAngles.x : Tip.eulerAngles.x); if (!(num > 180f)) { return num; } return num - 360f; } } protected int GunState { get { if (!((Object)(object)gun != (Object)null) || !(StateField != null)) { return 0; } return Convert.ToInt32(StateField.GetValue(gun)); } } protected bool HeldByLocal { get { if (HeldByLocalField != null && (Object)(object)physGrabObject != (Object)null) { return (bool)HeldByLocalField.GetValue(physGrabObject); } return false; } } protected virtual float[] HostChargeData() { return new float[0]; } protected virtual bool CastUsesBattery(float[] data) { return true; } protected abstract void ChargeBegin(float[] data); protected abstract void ChargeTick(float progress, float elapsed); protected abstract void ChargeEnd(); protected abstract void Launch(); protected abstract void ImpactEffect(Vector3 position); protected virtual void Awake() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) gun = ((Component)this).GetComponent<ItemGun>(); physGrabObject = ((Component)this).GetComponent<PhysGrabObject>(); photonView = ((Component)this).GetComponent<PhotonView>(); equippable = ((Component)this).GetComponent<ItemEquippable>(); GameObject val = new GameObject("Tip Light"); val.transform.SetParent(((Component)this).transform, false); val.transform.localPosition = TipLocalPosition; tipLight = val.AddComponent<Light>(); tipLight.type = (LightType)2; tipLight.color = TipColor; tipLight.range = 0.35f; tipLight.intensity = 0.6f; tipHalo = SoftGlow.Create(((Component)this).transform, TipLocalPosition, "Tip Halo"); if ((Object)(object)tipCrystal != (Object)null) { tipRenderer = tipCrystal.GetComponent<Renderer>(); } if ((Object)(object)tipRenderer != (Object)null) { tipMaterial = tipRenderer.material; } } internal bool HostTriggerPulled() { if (hostCharging) { return true; } ItemBattery component = ((Component)this).GetComponent<ItemBattery>(); if ((Object)(object)component != (Object)null && BatteryIntField != null && Convert.ToInt32(BatteryIntField.GetValue(component)) <= 0) { return false; } if (GunState != 0) { return true; } float[] array = HostChargeData(); if (array == null) { return true; } hostCharging = true; hostFreeCast = !CastUsesBattery(array); hostChargeTimer = 0f; SendCharge(start: true, array); return true; } protected virtual void Update() { if (!hostCharging) { return; } if (!IsHost) { hostCharging = false; return; } if ((Object)(object)equippable != (Object)null && EquippedField != null && (bool)EquippedField.GetValue(equippable)) { hostCharging = false; SendCharge(start: false, new float[0]); return; } hostChargeTimer += Time.deltaTime; if (hostChargeTimer < ChargeSeconds) { return; } hostCharging = false; if (hostFreeCast) { if (SemiFunc.IsMultiplayer()) { photonView.RPC("HWPWandFreeShotRPC", (RpcTarget)0, Array.Empty<object>()); } else { OnShot(); } return; } Releasing = true; try { gun.Shoot(); } catch (Exception arg) { Plugin.Log.LogWarning((object)$"Wand shot failed: {arg}"); } finally { Releasing = false; } } [PunRPC] public void HWPWandFreeShotRPC(PhotonMessageInfo info) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.MasterOnlyRPC(info)) { OnShot(); } } private void SendCharge(bool start, float[] data) { if (SemiFunc.IsMultiplayer()) { photonView.RPC("HWPWandChargeRPC", (RpcTarget)0, new object[2] { start, data }); } else { ChargeVisual(start, data); } } [PunRPC] public void HWPWandChargeRPC(bool start, float[] data, PhotonMessageInfo info) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.MasterOnlyRPC(info)) { ChargeVisual(start, data); } } private void ChargeVisual(bool start, float[] data) { StopCharge(); if (start) { charging = true; chargeTimer = 0f; try { ChargeBegin(data ?? new float[0]); } catch (Exception arg) { Plugin.Log.LogWarning((object)$"Wand charge visuals failed: {arg}"); } if (HeldByLocal) { SayChargeLine(); } } } private void StopCharge() { if (!charging) { return; } charging = false; try { ChargeEnd(); } catch (Exception arg) { Plugin.Log.LogWarning((object)$"Wand charge cleanup failed: {arg}"); } } protected virtual void LateUpdate() { if (charging) { chargeTimer += Time.deltaTime; try { ChargeTick(Mathf.Clamp01(chargeTimer / Mathf.Max(0.05f, ChargeSeconds)), chargeTimer); } catch (Exception arg) { Plugin.Log.LogWarning((object)$"Wand charge update failed: {arg}"); StopCharge(); } } SetTipGlow(charging ? 1.6f : ((GunState == 0) ? ReadyGlow : 0f)); } private void SetTipGlow(float glow) { //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_0132: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_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_0137: 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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) if (Mathf.Abs(glow - tipGlow) < 0.01f) { return; } tipGlow = glow; float num = ((glow > 0f) ? glow : 0f); tipLight.intensity = 0.6f + 0.8f * num; tipLight.range = 0.35f + 0.2f * num; if ((Object)(object)tipHalo != (Object)null) { float num2 = ((glow > 0f) ? Mathf.Clamp01(0.5f + 0.15f * num) : 0.3f); tipHalo.SetSize((glow > 0f) ? (0.05f + 0.015f * num) : 0.035f); tipHalo.SetColor(new Color(TipColor.r, TipColor.g, TipColor.b, num2)); } if (!((Object)(object)tipMaterial == (Object)null)) { Color val = ((glow > 0f) ? Color.Lerp(TipColor, Color.white, Mathf.Clamp01(0.15f + 0.15f * num)) : Color.Lerp(TipDarkColor, TipColor, 0.5f)); val.a = 1f; if (tipMaterial.HasProperty("_Color")) { tipMaterial.SetColor("_Color", val); } if (tipMaterial.HasProperty("_BaseColor")) { tipMaterial.SetColor("_BaseColor", val); } } } private void SayChargeLine() { try { string chargeLines = ChargeLines; if (string.IsNullOrWhiteSpace(chargeLines)) { return; } List<string> list = new List<string>(); string[] array = chargeLines.Split('|'); for (int i = 0; i < array.Length; i++) { string text = array[i].Trim(); if (text.Length > 0 && !text.StartsWith("/")) { list.Add(text); } } if (list.Count != 0) { PlayerAvatar val = SemiFunc.PlayerAvatarLocal(); if ((Object)(object)val != (Object)null) { val.ChatMessageSend(list[Random.Range(0, list.Count)], (string)null); } } } catch (Exception arg) { Plugin.Log.LogWarning((object)$"Wand speech failed: {arg}"); } } internal void OnShot() { try { Launch(); } catch (Exception arg) { Plugin.Log.LogWarning((object)$"Wand launch failed: {arg}"); } StopCharge(); } protected Sound MakeSound(string file, float volume = 0.7f) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown AudioClip val = SoundLibrary.Get(file); if ((Object)(object)val == (Object)null || (Object)(object)gun == (Object)null || gun.soundShoot == null) { return null; } Sound val2 = new Sound(); Sound.CopySound(gun.soundShoot, val2); val2.Sounds = (AudioClip[])(object)new AudioClip[1] { val }; val2.Volume = volume; val2.VolumeRandom = 0f; val2.Pitch = 1f; val2.PitchRandom = 0f; return val2; } protected static void PlayAt(Sound s, Transform follow, Vector3 position) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) if (s == null) { return; } try { if ((Object)(object)follow != (Object)null) { s.Play(follow, 1f, 1f, 1f, 1f); } else { s.Play(position, 1f, 1f, 1f, 1f); } } catch (Exception arg) { Plugin.Log.LogWarning((object)$"Wand sound failed: {arg}"); } } protected int NextId() { return ++idCounter; } protected void Track(int id, GameObject projectile) { if ((Object)(object)projectile != (Object)null) { inFlight[id] = projectile; } } internal void Forget(int id) { inFlight.Remove(id); } internal void HostImpact(int id, Vector3 position) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.IsMultiplayer()) { photonView.RPC("HWPWandImpactRPC", (RpcTarget)0, new object[2] { id, position }); } else { Impact(id, position); } } [PunRPC] public void HWPWandImpactRPC(int id, Vector3 position, PhotonMessageInfo info) { //IL_0000: 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) if (SemiFunc.MasterOnlyRPC(info)) { Impact(id, position); } } private void Impact(int id, Vector3 position) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) if (inFlight.TryGetValue(id, out var value)) { inFlight.Remove(id); if ((Object)(object)value != (Object)null) { Object.Destroy((Object)(object)value); } } try { ImpactEffect(position); } catch (Exception arg) { Plugin.Log.LogWarning((object)$"Wand impact effect failed: {arg}"); } } protected virtual void OnDestroy() { if ((Object)(object)tipMaterial != (Object)null) { Object.Destroy((Object)(object)tipMaterial); } StopCharge(); foreach (GameObject value in inFlight.Values) { if ((Object)(object)value != (Object)null) { Object.Destroy((Object)(object)value); } } inFlight.Clear(); } } public class EmberWand : ChargedWand { private static readonly Color Red = new Color(1f, 0.04f, 0.02f); private FireballFx growing; protected override Color TipColor => Red; protected override Color TipDarkColor => new Color(0.25f, 0.02f, 0.02f); protected override float ChargeSeconds => Settings.EmberChargeSeconds.Value; protected override string ChargeLines => Settings.EmberChargeLines.Value; protected override Vector3 TipLocalPosition => WandBuilder.TipPosition; protected override void ChargeBegin(float[] data) { //IL_000c: 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) growing = FireballFx.Create("HWP Fireball (charging)", base.Tip.position, base.Tip.rotation, flying: false); growing.Size = 0.04f; } protected override void ChargeTick(float progress, float elapsed) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0062: 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_0072: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)growing == (Object)null)) { growing.Size = Mathf.Lerp(0.04f, 1f, progress); ((Component)growing).transform.SetPositionAndRotation(base.Tip.position + base.Tip.forward * (0.1f * growing.Size * 0.9f), base.Tip.rotation); } } protected override void ChargeEnd() { if ((Object)(object)growing != (Object)null) { Object.Destroy((Object)(object)((Component)growing).gameObject); } growing = null; } protected override void Launch() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002f: 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) int id = NextId(); Vector3 position = base.Tip.position + base.Tip.forward * 0.089999996f; Fireball fireball = Fireball.Spawn(this, id, position, base.Tip.rotation, base.IsHost); if ((Object)(object)fireball != (Object)null) { Track(id, ((Component)fireball).gameObject); } } protected override void ImpactEffect(Vector3 position) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) Fireball.Explode(position); } } public class Fireball : MonoBehaviour { private const float HitRadius = 0.08f; private EmberWand wand; private int id; private bool authority; private float age; private bool done; private PlayerAvatar caster; internal static int DirectDamage => Settings.EmberDirectDamage.Value; internal static float Speed => Settings.EmberFireballSpeed.Value; private static float Lifetime => Settings.EmberFireballLifetime.Value; internal static Fireball Spawn(EmberWand wand, int id, Vector3 position, Quaternion rotation, bool authority) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) Fireball fireball = ((Component)FireballFx.Create("HWP Fireball " + id, position, rotation, flying: true)).gameObject.AddComponent<Fireball>(); fireball.wand = wand; fireball.id = id; fireball.authority = authority; fireball.caster = ProjectileHits.Holder(((Object)(object)wand != (Object)null) ? wand.PhysGrabObject : null); return fireball; } private void FixedUpdate() { //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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_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_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017a: 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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008c: 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_00b9: 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_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_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_012d: Unknown result type (might be due to invalid IL or missing references) if (done) { return; } float fixedDeltaTime = Time.fixedDeltaTime; age += fixedDeltaTime; Vector3 position = ((Component)this).transform.position; Vector3 val = ((Component)this).transform.forward * Speed * fixedDeltaTime; if (authority) { PhysGrabObject self = (((Object)(object)wand != (Object)null) ? wand.PhysGrabObject : null); RaycastHit best; bool flag = ProjectileHits.World(position, val, 0.08f, self, out best); float maxDistance = (flag ? Vector3.Distance(position, ((RaycastHit)(ref best)).point) : float.MaxValue); if (ProjectileHits.Player(position, val, 0.08f, maxDistance, caster, out var hitPlayer, out var point)) { ProjectileHits.HurtPlayer(hitPlayer, DirectDamage, point); Burst(point - ((Vector3)(ref val)).normalized * 0.1f); return; } if (flag) { ProjectileHits.HurtEnemy(((RaycastHit)(ref best)).collider, DirectDamage, ((Vector3)(ref val)).normalized); Burst(((RaycastHit)(ref best)).point + ((RaycastHit)(ref best)).normal * 0.1f); return; } if (age >= Lifetime) { Burst(position); return; } } else if (age >= Lifetime + 1.5f) { if ((Object)(object)wand != (Object)null) { wand.Forget(id); } Object.Destroy((Object)(object)((Component)this).gameObject); return; } ((Component)this).transform.position = position + val; } private void Burst(Vector3 position) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) done = true; if ((Object)(object)wand != (Object)null) { wand.HostImpact(id, position); return; } Explode(position); Object.Destroy((Object)(object)((Component)this).gameObject); } internal static void Explode(Vector3 position) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) float value = Settings.EmberSplashRadius.Value; RocketExplosion.SpawnSmall(position, Mathf.Clamp(value * 0.6f, 0.3f, 3f), value, Settings.EmberSplashDamage.Value, Settings.EmberKnockback.Value); } } internal class FireballFx : MonoBehaviour { internal const float FullRadius = 0.1f; private static readonly Color Core = new Color(1f, 0.93f, 0.6f, 1f); private static readonly Color Mid = new Color(1f, 0.45f, 0.05f, 0.85f); private static readonly Color Outer = new Color(0.95f, 0.12f, 0.02f, 0.45f); private static readonly Color Ember = new Color(1f, 0.55f, 0.1f, 1f); private static Material material; private Transform core; private Transform mid; private Transform outer; private Transform[] tongues; private Light glowLight; private float size = 1f; private float seed; internal static Material Glow { get { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown if ((Object)(object)material == (Object)null) { Shader val = Shader.Find("Sprites/Default"); if ((Object)(object)val != (Object)null) { material = new Material(val) { name = "HWP Fireball" }; Object.DontDestroyOnLoad((Object)(object)material); } } return material; } } internal float Size { get { return size; } set { size = Mathf.Clamp01(value); } } internal static FireballFx Create(string name, Vector3 position, Quaternion rotation, bool flying) { //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_000c: 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) GameObject val = new GameObject(name); val.transform.SetPositionAndRotation(position, rotation); FireballFx fireballFx = val.AddComponent<FireballFx>(); fireballFx.Build(flying); return fireballFx; } private Transform Layer(string name, Color color) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown //IL_0063: Unknown result type (might be due to invalid IL or missing references) GameObject obj = GameObject.CreatePrimitive((PrimitiveType)0); ((Object)obj).name = name; Object.DestroyImmediate((Object)(object)obj.GetComponent<Collider>()); obj.transform.SetParent(((Component)this).transform, false); MeshRenderer component = obj.GetComponent<MeshRenderer>(); if ((Object)(object)Glow != (Object)null) { ((Renderer)component).sharedMaterial = Glow; } ((Renderer)component).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)component).receiveShadows = false; MaterialPropertyBlock val = new MaterialPropertyBlock(); val.SetColor("_Color", color); ((Renderer)component).SetPropertyBlock(val); return obj.transform; } private void Build(bool flying) { //IL_0018: 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_0044: 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_007f: 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_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Expected O, but got Unknown //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0179: 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_0194: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: 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_0208: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Expected O, but got Unknown //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Expected O, but got Unknown //IL_0302: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_0368: Unknown result type (might be due to invalid IL or missing references) //IL_0376: Unknown result type (might be due to invalid IL or missing references) seed = Random.value * 100f; outer = Layer("Outer", Outer); mid = Layer("Body", Mid); core = Layer("Core", Core); tongues = (Transform[])(object)new Transform[4]; for (int i = 0; i < tongues.Length; i++) { tongues[i] = Layer("Tongue", (i % 2 == 0) ? Mid : Outer); } glowLight = ((Component)this).gameObject.AddComponent<Light>(); glowLight.type = (LightType)2; glowLight.color = new Color(1f, 0.45f, 0.15f); if (flying) { TrailRenderer val = ((Component)this).gameObject.AddComponent<TrailRenderer>(); val.time = 0.25f; val.startWidth = 0.16f; val.endWidth = 0f; val.minVertexDistance = 0.04f; if ((Object)(object)Glow != (Object)null) { ((Renderer)val).sharedMaterial = Glow; } Gradient val2 = new Gradient(); val2.SetKeys((GradientColorKey[])(object)new GradientColorKey[3] { new GradientColorKey(new Color(1f, 0.6f, 0.1f), 0f), new GradientColorKey(new Color(0.9f, 0.15f, 0.02f), 0.5f), new GradientColorKey(new Color(0.2f, 0.05f, 0.02f), 1f) }, (GradientAlphaKey[])(object)new GradientAlphaKey[3] { new GradientAlphaKey(0.8f, 0f), new GradientAlphaKey(0.5f, 0.5f), new GradientAlphaKey(0f, 1f) }); val.colorGradient = val2; ((Renderer)val).shadowCastingMode = (ShadowCastingMode)0; GameObject val3 = new GameObject("Embers"); val3.transform.SetParent(((Component)this).transform, false); ParticleSystem val4 = val3.AddComponent<ParticleSystem>(); val4.Stop(true, (ParticleSystemStopBehavior)0); MainModule main = val4.main; ((MainModule)(ref main)).startLifetime = new MinMaxCurve(0.3f, 0.7f); ((MainModule)(ref main)).startSpeed = new MinMaxCurve(0.2f, 0.8f); ((MainModule)(ref main)).startSize = new MinMaxCurve(0.012f, 0.028f); ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(Ember); ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; ((MainModule)(ref main)).maxParticles = 60; ((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(-0.05f); EmissionModule emission = val4.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(45f); ShapeModule shape = val4.shape; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)0; ((ShapeModule)(ref shape)).radius = 0.06f; ColorOverLifetimeModule colorOverLifetime = val4.colorOverLifetime; ((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true; Gradient val5 = new Gradient(); val5.SetKeys((GradientColorKey[])(object)new GradientColorKey[2] { new GradientColorKey(Ember, 0f), new GradientColorKey(new Color(0.8f, 0.1f, 0.02f), 1f) }, (GradientAlphaKey[])(object)new GradientAlphaKey[2] { new GradientAlphaKey(1f, 0f), new GradientAlphaKey(0f, 1f) }); ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(val5); ParticleSystemRenderer component = val3.GetComponent<ParticleSystemRenderer>(); if ((Object)(object)Glow != (Object)null) { ((Renderer)component).sharedMaterial = Glow; } ((Renderer)component).shadowCastingMode = (ShadowCastingMode)0; val4.Play(); } } private void LateUpdate() { //IL_0061: 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_006d: 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: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00de: 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) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) float num = Time.time * 9f + seed; float num2 = 1f + 0.08f * Mathf.Sin(num) + 0.05f * Mathf.Sin(num * 2.3f + 1f); float num3 = 0.1f * size; core.localScale = new Vector3(0.9f, 0.9f, 0.95f) * num3 * num2; mid.localScale = new Vector3(1.5f, 1.5f, 1.85f) * num3 * (2f - num2); mid.localPosition = new Vector3(0f, 0f, -0.12f * num3); outer.localScale = new Vector3(2f, 2f, 2.9f) * num3 * num2; outer.localPosition = new Vector3(0f, 0f, -0.3f * num3); for (int i = 0; i < tongues.Length; i++) { float num4 = (float)i * MathF.PI * 0.5f + 0.4f * Mathf.Sin(num * 0.7f + (float)i); float num5 = 1f + 0.2f * Mathf.Sin(num * 1.3f + (float)i * 2f); tongues[i].localPosition = new Vector3(Mathf.Cos(num4) * 0.35f * num3, Mathf.Sin(num4) * 0.35f * num3, -1.4f * num3 * num5); tongues[i].localScale = new Vector3(0.75f, 0.75f, 2.6f * num5) * num3; } glowLight.range = 0.5f + 3.5f * size; glowLight.intensity = (1f + 2f * size) * num2; } } public class FrostWand : ChargedWand { private static readonly Color Cyan = new Color(0.1f, 0.85f, 1f); private const float GrowSeconds = 0.25f; private readonly List<Transform> forming = new List<Transform>(); private readonly List<Vector2> offsets = new List<Vector2>(); private readonly List<bool> sounded = new List<bool>(); private static readonly string[] ConjureFiles = new string[3] { "ice_conjure_1.pcm", "ice_conjure_2.pcm", "ice_conjure_3.pcm" }; private Sound[] conjureSounds; protected override Color TipColor => Cyan; protected override Color TipDarkColor => new Color(0.03f, 0.15f, 0.2f); protected override float ChargeSeconds => Settings.FrostChargeSeconds.Value; protected override string ChargeLines => Settings.FrostChargeLines.Value; protected override Vector3 TipLocalPosition => WandBuilder.TipPosition; protected override void Awake() { base.Awake(); conjureSounds = (Sound[])(object)new Sound[ConjureFiles.Length]; for (int i = 0; i < ConjureFiles.Length; i++) { conjureSounds[i] = MakeSound(ConjureFiles[i], 0.6f); } } protected override float[] HostChargeData() { int num = Mathf.Max(1, Settings.FrostIcicleCount.Value); float value = Settings.FrostSpawnDistanceMin.Value; float num2 = Mathf.Max(value, Settings.FrostSpawnDistanceMax.Value); float[] array = new float[num * 2]; for (int i = 0; i < num; i++) { array[2 * i] = Random.Range(0f, MathF.PI * 2f); array[2 * i + 1] = Random.Range(value, num2); } return array; } protected override void ChargeBegin(float[] data) { //IL_0018: 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) ChargeEnd(); for (int i = 0; i + 1 < data.Length; i += 2) { offsets.Add(new Vector2(data[i], data[i + 1])); sounded.Add(item: false); GameObject val = Icicle.CreateVisual("HWP Icicle (forming)"); val.transform.localScale = Vector3.zero; forming.Add(val.transform); } } private Vector3 SpotFor(int i) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_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) //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) Vector2 val = offsets[i]; Transform tip = base.Tip; return tip.position + tip.forward * Settings.FrostSpawnForwardOffset.Value + (tip.right * Mathf.Cos(val.x) + tip.up * Mathf.Sin(val.x)) * val.y; } protected override void ChargeTick(float progress, float elapsed) { //IL_00e1: 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_0104: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) int count = forming.Count; if (count == 0) { return; } float num = ChargeSeconds / (float)count; for (int i = 0; i < count; i++) { if ((Object)(object)forming[i] == (Object)null) { continue; } float num2 = Mathf.Clamp01((elapsed - (float)i * num) / 0.25f); if (num2 > 0f && !sounded[i]) { sounded[i] = true; if (conjureSounds != null && conjureSounds.Length != 0) { ChargedWand.PlayAt(conjureSounds[Random.Range(0, conjureSounds.Length)], null, forming[i].position); } } float num3 = num2 * num2 * (3f - 2f * num2); forming[i].localScale = new Vector3(num3, num3, Mathf.Lerp(0.3f, 1f, num3) * num3); forming[i].SetPositionAndRotation(SpotFor(i), base.Tip.rotation); } } protected override void ChargeEnd() { foreach (Transform item in forming) { if ((Object)(object)item != (Object)null) { Object.Destroy((Object)(object)((Component)item).gameObject); } } forming.Clear(); offsets.Clear(); sounded.Clear(); } protected override void Launch() { //IL_004d: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) int num = ((offsets.Count > 0) ? offsets.Count : Mathf.Max(1, Settings.FrostIcicleCount.Value)); for (int i = 0; i < num; i++) { Vector3 position = ((i < offsets.Count) ? SpotFor(i) : base.Tip.position); int id = NextId(); Icicle icicle = Icicle.Spawn(this, id, position, base.Tip.rotation, base.IsHost); if ((Object)(object)icicle != (Object)null) { Track(id, ((Component)icicle).gameObject); } } } protected override void ImpactEffect(Vector3 position) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) IceShatter.Spawn(position); IcicleStun.Apply(position); } } internal static class HealEffects { private static GameObject orbSphere; private static bool orbLooked; internal static Vector3 Chest(PlayerAvatar p) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)p.PlayerVisionTarget != (Object)null && (Object)(object)p.PlayerVisionTarget.VisionTransform != (Object)null) { return p.PlayerVisionTarget.VisionTransform.position - Vector3.up * 0.3f; } return ((Component)p).transform.position + Vector3.up * 1f; } internal static void Heal(PlayerAvatar p, int amount) { if ((Object)(object)p == (Object)null || (Object)(object)p.playerHealth == (Object)null || amount <= 0) { return; } try { p.playerHealth.HealOther(amount, true); Plugin.Log.LogInfo((object)$"Healing Wand: +{amount} health to {((Object)p).name}."); } catch (Exception arg) { Plugin.Log.LogWarning((object)$"Heal failed: {arg}"); } } internal static void SpawnBeam(HealingWand wand, Transform tip, PlayerAvatar target, bool authority) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) new GameObject("HWP Heal Beam").AddComponent<HealBeam>().Setup(tip, target, authority); } internal static void SpawnMissBeam(Transform tip, Vector3 end) { //IL_0005: 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) new GameObject("HWP Heal Beam (miss)").AddComponent<HealBeam>().SetupMiss(tip, end); } internal static void SpawnArea(Vector3 centre, bool authority) { //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_0010: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("HWP Heal Orb"); val.transform.position = centre; val.AddComponent<HealArea>().Setup(authority); } internal static GameObject OrbSphere(Transform parent, float radius) { //IL_00d5: 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_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: 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_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017a: 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_018d: 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_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) if (!orbLooked) { orbLooked = true; GameObject val = Resources.Load<GameObject>("Items/Item Orb Zero Gravity"); Transform val2 = (((Object)(object)val != (Object)null) ? val.transform.Find("sphere effect") : null); if ((Object)(object)val2 != (Object)null) { orbSphere = ((Component)val2).gameObject; } else { Plugin.Log.LogWarning((object)"Zero-gravity orb sphere not found; the healing orb uses a plain bubble."); } } if ((Object)(object)orbSphere == (Object)null) { return null; } GameObject val3 = Object.Instantiate<GameObject>(orbSphere, parent); ((Object)val3).name = "Heal Sphere"; MonoBehaviour[] componentsInChildren = val3.GetComponentsInChildren<MonoBehaviour>(true); for (int i = 0; i < componentsInChildren.Length; i++) { Object.Destroy((Object)(object)componentsInChildren[i]); } Collider[] componentsInChildren2 = val3.GetComponentsInChildren<Collider>(true); for (int i = 0; i < componentsInChildren2.Length; i++) { Object.Destroy((Object)(object)componentsInChildren2[i]); } val3.transform.localPosition = Vector3.zero; val3.transform.localRotation = Quaternion.identity; val3.transform.localScale = Vector3.one; val3.SetActive(true); Transform[] componentsInChildren3 = val3.GetComponentsInChildren<Transform>(true); for (int i = 0; i < componentsInChildren3.Length; i++) { ((Component)componentsInChildren3[i]).gameObject.SetActive(true); } Renderer[] componentsInChildren4 = val3.GetComponentsInChildren<Renderer>(true); float num = 0f; Renderer[] array = componentsInChildren4; foreach (Renderer val4 in array) { float[] obj = new float[4] { num, 0f, 0f, 0f }; Bounds bounds = val4.bounds; obj[1] = ((Bounds)(ref bounds)).extents.x; bounds = val4.bounds; obj[2] = ((Bounds)(ref bounds)).extents.y; bounds = val4.bounds; obj[3] = ((Bounds)(ref bounds)).extents.z; num = Mathf.Max(obj); } val3.transform.localScale = Vector3.one * ((num > 0.001f) ? (radius / num) : (radius * 2f)); array = componentsInChildren4; for (int i = 0; i < array.Length; i++) { Material[] materials = array[i].materials; foreach (Material val5 in materials) { if (val5.HasProperty("_Color")) { Color color = val5.GetColor("_Color"); val5.SetColor("_Color", new Color(HealingWand.Lime.r, HealingWand.Lime.g, HealingWand.Lime.b, color.a)); } if (val5.HasProperty("_EmissionColor")) { val5.SetColor("_EmissionColor", HealingWand.Lime * 1.5f); } if (val5.HasProperty("_TintColor")) { Color color2 = val5.GetColor("_TintColor"); val5.SetColor("_TintColor", new Color(HealingWand.Lime.r, HealingWand.Lime.g, HealingWand.Lime.b, color2.a)); } } } return val3; } internal static ParticleSystem Sparkles(Transform parent, float radius, float rate, Vector3 velocity) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: 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_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0102: 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_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Expected O, but got Unknown //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015f: 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) //IL_017b: 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_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: 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_01ba: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Sparkles"); val.transform.SetParent(parent, false); ParticleSystem val2 = val.AddComponent<ParticleSystem>(); val2.Stop(true, (ParticleSystemStopBehavior)0); MainModule main = val2.main; ((MainModule)(ref main)).startLifetime = new MinMaxCurve(0.6f, 1.2f); ((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(0f); ((MainModule)(ref main)).startSize = new MinMaxCurve(0.02f, 0.05f); ((MainModule)(ref main)).startColor = new MinMaxGradient(new Color(0.75f, 1f, 0.5f), HealingWand.Lime); ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; ((MainModule)(ref main)).maxParticles = 200; EmissionModule emission = val2.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(rate); ShapeModule shape = val2.shape; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)0; ((ShapeModule)(ref shape)).radius = radius; VelocityOverLifetimeModule velocityOverLifetime = val2.velocityOverLifetime; ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).enabled = true; ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).space = (ParticleSystemSimulationSpace)1; ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).x = MinMaxCurve.op_Implicit(velocity.x); ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).y = MinMaxCurve.op_Implicit(velocity.y); ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).z = MinMaxCurve.op_Implicit(velocity.z); ColorOverLifetimeModule colorOverLifetime = val2.colorOverLifetime; ((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true; Gradient val3 = new Gradient(); val3.SetKeys((GradientColorKey[])(object)new GradientColorKey[2] { new GradientColorKey(Color.white, 0f), new GradientColorKey(HealingWand.Lime, 1f) }, (GradientAlphaKey[])(object)new GradientAlphaKey[3] { new GradientAlphaKey(0f, 0f), new GradientAlphaKey(1f, 0.2f), new GradientAlphaKey(0f, 1f) }); ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(val3); ParticleSystemRenderer component = val.GetComponent<ParticleSystemRenderer>(); if ((Object)(object)FireballFx.Glow != (Object)null) { ((Renderer)component).sharedMaterial = FireballFx.Glow; } ((Renderer)component).shadowCastingMode = (ShadowCastingMode)0; val2.Play(); return val2; } } internal class HealBeam : MonoBehaviour { private const int Points = 14; private Transform tip; private PlayerAvatar target; private bool authority; private float age; private float duration; private float nextTick = 1f; private int healPerTick; private LineRenderer outer; private LineRenderer core; private Light startLight; private Light endLight; private Transform targetFx; private Vector3 lastTip; private bool miss; private Vector3 missEnd; internal void SetupMiss(Transform tip, Vector3 end) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) miss = true; missEnd = end; Build(tip, null, authority: false, 0.45f, 0); } internal void Setup(Transform tip, PlayerAvatar target, bool authority) { Build(tip, target, authority, Settings.HealBeamSeconds.Value, Settings.HealBeamPerSecond.Value); } private void Build(Transform tip, PlayerAvatar target, bool authority, float duration, int healPerTick) { //IL_003d: 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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0121: 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) this.tip = tip; this.target = target; this.authority = authority; this.duration = duration; this.healPerTick = healPerTick; lastTip = (((Object)(object)tip != (Object)null) ? tip.position : ((Component)this).transform.position); outer = Line("Beam", 0.07f, new Color(HealingWand.Lime.r, HealingWand.Lime.g, HealingWand.Lime.b, 0.45f)); core = Line("Core", 0.025f, new Color(0.85f, 1f, 0.7f, 0.95f)); startLight = LightAt("Tip Light", 1.5f, 2f); endLight = LightAt("Target Light", 2.5f, 3f); targetFx = new GameObject("Target Sparkles").transform; targetFx.SetParent(((Component)this).transform, false); HealEffects.Sparkles(targetFx, 0.35f, 40f, Vector3.up * 0.6f); LateUpdate(); } private LineRenderer Line(string name, float width, Color color) { //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_0054: 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) GameObject val = new GameObject(name); val.transform.SetParent(((Component)this).transform, false); LineRenderer val2 = val.AddComponent<LineRenderer>(); val2.positionCount = 14; val2.useWorldSpace = true; val2.widthMultiplier = width; val2.numCapVertices = 4; if ((Object)(object)FireballFx.Glow != (Object)null) { ((Renderer)val2).sharedMaterial = FireballFx.Glow; } val2.startColor = color; val2.endColor = color; ((Renderer)val2).shadowCastingMode = (ShadowCastingMode)0; return val2; } private Light LightAt(string name, float range, float intensity) { //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_0025: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name); val.transform.SetParent(((Component)this).transform, false); Light obj = val.AddComponent<Light>(); obj.type = (LightType)2; obj.color = HealingWand.Lime; obj.range = range; obj.intensity = intensity; return obj; } private void LateUpdate() { //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_00bb: 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_00e2: 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_00e7: 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_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0155: 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_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: 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_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0213: 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_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_022f: 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_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) age += Time.deltaTime; bool flag = !miss && (Object)(object)target == (Object)null; if (age >= duration + 0.3f || flag) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } if (!miss && authority && age >= nextTick && nextTick <= duration + 0.01f) { HealEffects.Heal(target, healPerTick); nextTick += 1f; } if ((Object)(object)tip != (Object)null) { lastTip = tip.position; } Vector3 val = lastTip; Vector3 val2 = (miss ? missEnd : HealEffects.Chest(target)); float num = Mathf.Clamp01(age / 0.15f) * Mathf.Clamp01((duration + 0.3f - age) / 0.3f); Vector3 val3 = val2 - val; Vector3 val4 = Vector3.Cross(((Vector3)(ref val3)).normalized, Vector3.up); if (((Vector3)(ref val4)).sqrMagnitude < 0.01f) { val4 = Vector3.right; } ((Vector3)(ref val4)).Normalize(); Vector3 val5 = Vector3.Cross(val4, ((Vector3)(ref val3)).normalized); for (int i = 0; i < 14; i++) { float num2 = (float)i / 13f; float num3 = Mathf.Sin(num2 * MathF.PI); float num4 = Mathf.Sin(num2 * 9f - age * 14f) * 0.05f * num3; float num5 = Mathf.Cos(num2 * 7f - age * 11f) * 0.05f * num3; Vector3 val6 = val + val3 * num2; outer.SetPosition(i, val6 + val4 * num4 + val5 * num5); core.SetPosition(i, val6 + val4 * num4 * 0.4f + val5 * num5 * 0.4f); } outer.widthMultiplier = 0.07f * num * (1f + 0.15f * Mathf.Sin(age * 20f)); core.widthMultiplier = 0.025f * num; ((Component)startLight).transform.position = val; startLight.intensity = 2f * num; ((Component)endLight).transform.position = val2; endLight.intensity = 3f * num; targetFx.position = val2; } } internal class HealArea : MonoBehaviour { private bool authority; private float age; private float duration; private float radius; private float nextTick = 1f; private int healPerTick; private Transform sphere; private Light glow; private ParticleSystem sparkles; private MeshRenderer fallback; private MaterialPropertyBlock block; private Vector3 fullScale; internal void Setup(bool authority) { //IL_00fe: 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_0151: 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_0087: 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_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Expected O, but got Unknown this.authority = authority; duration = Settings.HealAreaSeconds.Value; radius = Settings.HealAreaRadius.Value; healPerTick = Settings.HealAreaPerSecond.Value; GameObject val = HealEffects.OrbSphere(((Component)this).transform, radius); if ((Object)(object)val == (Object)null) { val = GameObject.CreatePrimitive((PrimitiveType)0); Object.DestroyImmediate((Object)(object)val.GetComponent<Collider>()); val.transform.SetParent(((Component)this).transform, false); val.transform.localScale = Vector3.one * radius * 2f; fallback = val.GetComponent<MeshRenderer>(); if ((Object)(object)FireballFx.Glow != (Object)null) { ((Renderer)fallback).sharedMaterial = FireballFx.Glow; } block = new MaterialPropertyBlock(); } sphere = val.transform; glow = ((Component)this).gameObject.AddComponent<Light>(); glow.type = (LightType)2; glow.color = HealingWand.Lime; glow.range = radius * 2.5f; glow.intensity = 0f; sparkles = HealEffects.Sparkles(((Component)this).transform, radius * 0.9f, 60f, Vector3.up * 0.4f); LateUpdate(); } private void LateUpdate() { //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: 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_0179: 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_018f: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_0286: 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) age += Time.deltaTime; if (age >= duration + 0.5f) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } if (authority && age >= nextTick && nextTick <= duration + 0.01f) { foreach (PlayerAvatar item in SemiFunc.PlayerGetList()) { if (!((Object)(object)item == (Object)null) && !((Object)(object)item.playerHealth == (Object)null) && Vector3.Distance(HealEffects.Chest(item), ((Component)this).transform.position) <= radius) { HealEffects.Heal(item, healPerTick); } } nextTick += 1f; } float num = Mathf.SmoothStep(0f, 1f, Mathf.Clamp01(age / 0.35f)); float num2 = Mathf.SmoothStep(0f, 1f, Mathf.Clamp01((duration + 0.5f - age) / 0.5f)); float num3 = 1f + 0.03f * Mathf.Sin(age * 4f); float num4 = num * num2; if ((Object)(object)fallback != (Object)null) { sphere.localScale = Vector3.one * radius * 2f * num4 * num3; block.SetColor("_Color", new Color(HealingWand.Lime.r, HealingWand.Lime.g, HealingWand.Lime.b, 0.18f * num4)); ((Renderer)fallback).SetPropertyBlock(block); } else { if (fullScale == Vector3.zero) { fullScale = sphere.localScale; } sphere.localScale = fullScale * Mathf.Max(0.001f, num4 * num3); } sphere.Rotate(0f, 20f * Time.deltaTime, 0f, (Space)0); glow.intensity = 2.5f * num4; if (age > duration && (Object)(object)sparkles != (Object)null) { EmissionModule emission = sparkles.emission; ((EmissionModule)(ref emission)).enabled = false; } } } public class HealingWand : ChargedWand { internal static readonly Color Lime = new Color(0.45f, 1f, 0.15f); private const float CastSeconds = 0.15f; private const float AimConeDegrees = 12f; private float[] cast; private Sound beamSound; private Sound areaSound; private Transform aura; private ParticleSystem auraSparkles; private SoftGlow auraHalo; private float auraAmount; private float[] reportedAim; private float reportedAt = -10f; private float nextReport; private const float ReportInterval = 0.1f; private const float ReportMaxAge = 0.6f; private static readonly FieldInfo HealthField = AccessTools.Field(typeof(PlayerHealth), "health"); private static readonly FieldInfo MaxHealthField = AccessTools.Field(typeof(PlayerHealth), "maxHealth"); internal const string BeamChimeFile = "heal_chime_1.pcm"; internal const string AreaChimeFile = "heal_chime_2.pcm"; protected override Color TipColor => Lime; protected override Color TipDarkColor => Lime * 0.35f; protected override float ChargeSeconds => 0.15f; protected override string ChargeLines => Settings.HealChargeLines.Value; protected override Vector3 TipLocalPosition => WandBuilder.TipPosition; private float LocalLookUp => Mathf.InverseLerp(0f, 0f - Settings.HealLookUpAngle.Value, base.HolderPitch); private float LookUp { get { if ((Object)(object)base.Holder == (Object)null) { return 0f; } if (base.HeldByLocal) { return LocalLookUp; } if (!ReportFresh || reportedAim.Length < 5) { return 0f; } return reportedAim[4]; } } private bool ReportFresh { get { if (reportedAim != null) { return Time.time - reportedAt <= 0.6f; } return false; } } protected override float ReadyGlow => 1f + 1.2f * LookUp + ((LookUp >= 1f) ? 0.8f : 0f); protected override float[] HostChargeData() { //IL_00ba: 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_00d1: 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) PlayerAvatar holder = base.Holder; if ((Object)(object)holder == (Object)null) { return null; } bool flag = !base.HeldByLocal && ReportFresh; float[] array = (flag ? reportedAim : Aim()); if (array == null || array.Length < 4) { Plugin.Log.LogInfo((object)"Healing Wand: no aim to cast with."); return null; } if (array[0] < 0.5f) { PlayerAvatar val = SemiFunc.PlayerAvatarGetFromPhotonID(Mathf.RoundToInt(array[1])); if ((Object)(object)val == (Object)null) { Plugin.Log.LogInfo((object)$"Healing Wand: target {array[1]} not found."); return null; } if (IsFullHealth(val)) { Plugin.Log.LogInfo((object)("Healing Wand: " + Name(val) + " is at full health (free beam).")); Vector3 val2 = HealEffects.Chest(val); return new float[4] { 2f, val2.x, val2.y, val2.z }; } Plugin.Log.LogInfo((object)("Healing Wand: " + Name(holder) + " beams " + Name(val) + " (aim from " + (flag ? "caster's report" : "host") + ").")); return new float[2] { 0f, array[1] }; } Plugin.Log.LogInfo((object)((array[0] < 1.5f) ? ("Healing Wand: " + Name(holder) + " casts the healing orb.") : ("Healing Wand: " + Name(holder) + " aimed at nobody (free beam)."))); return new float[4] { array[0], array[1], array[2], array[3] }; } private static string Name(PlayerAvatar p) { try { return SemiFunc.PlayerGetName(p); } catch { return ((Object)(object)p != (Object)null) ? ((Object)p).name : "?"; } } private static bool IsFullHealth(PlayerAvatar p) { if ((Object)(object)p.playerHealth == (Object)null || HealthField == null || MaxHealthField == null) { return false; } int num = Convert.ToInt32(HealthField.GetValue(p.playerHealth)); int num2 = Convert.ToInt32(MaxHealthField.GetValue(p.playerHealth)); if (num2 > 0) { return num >= num2; } return false; } private float[] Aim() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) PlayerAvatar holder = base.Holder; if ((Object)(object)holder == (Object)null) { return null; } float localLookUp = LocalLookUp; if (base.HolderPitch <= 0f - Settings.HealLookUpAngle.Value) { Vector3 val = ((Component)holder).transform.position + Vector3.up * 0.9f; return new float[5] { 1f, val.x, val.y, val.z, localLookUp }; } PlayerAvatar val2 = FindAimedPlayer(holder); if ((Object)(object)val2 == (Object)null || (Object)(object)val2.photonView == (Object)null) { Vector3 val3 = MissPoint(); return new float[5] { 2f, val3.x, val3.y, val3.z, localLookUp }; } return new float[5] { 0f, val2.photonView.ViewID, 0f, 0f, localLookUp }; } protected override void Update() { base.Update(); if (!base.HeldByLocal || !SemiFunc.IsMultiplayer() || Time.time < nextReport) { return; } nextReport = Time.time + 0.1f; float[] array = Aim(); if (array == null) { return; } try { photonView.RPC("HWPHealAimRPC", (RpcTarget)1, new object[1] { array }); } catch (Exception arg) { Plugin.Log.LogWarning((object)$"Healing Wand aim report failed: {arg}"); nextReport = Time.time + 2f; } } [PunRPC] public void HWPHealAimRPC(float[] aim, PhotonMessageInfo info) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) PlayerAvatar val = SemiFunc.PlayerAvatarGetFromPhotonPlayer(info.Sender); if (!((Object)(object)val == (Object)null) && !((Object)(object)val != (Object)(object)base.Holder) && aim != null && aim.Length >= 5) { reportedAim = aim; reportedAt = Time.time; } } protected override bool CastUsesBattery(float[] data) { if (data != null && data.Length != 0) { return data[0] < 1.5f; } return true; } private Vector3 MissPoint() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0023: 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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: 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_00dd: Unknown result type (might be due to invalid IL or missing references) Transform holderView = base.HolderView; Vector3 val = (((Object)(object)holderView != (Object)null) ? holderView.position : base.Tip.position); Vector3 val2 = (((Object)(object)holderView != (Object)null) ? holderView.forward : base.Tip.forward); float num = Settings.HealBeamRange.Value; float num2 = num; LayerMask val3 = SemiFunc.LayerMaskGetVisionObstruct(); RaycastHit[] array = Physics.RaycastAll(val, val2, num2, ((LayerMask)(ref val3)).value, (QueryTriggerInteraction)1); for (int i = 0; i < array.Length; i++) { RaycastHit val4 = array[i]; if (!((Object)(object)((Component)((RaycastHit)(ref val4)).collider).GetComponentInParent<PhysGrabObject>() == (Object)(object)base.PhysGrabObject) && (!((Object)(object)base.Holder != (Object)null) || !((Object)(object)((Component)((RaycastHit)(ref val4)).collider).GetComponentInParent<PlayerAvatar>() == (Object)(object)base.Holder)) && ((RaycastHit)(ref val4)).distance < num) { num = ((RaycastHit)(ref val4)).distance; } } return val + val2 * num; } private PlayerAvatar FindAimedPlayer(PlayerAvatar caster) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0023: 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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: 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_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) Transform holderView = base.HolderView; Vector3 val = (((Object)(object)holderView != (Object)null) ? holderView.position : base.Tip.position); Vector3 val2 = (((Object)(object)holderView != (Object)null) ? holderView.forward : base.Tip.forward); float value = Settings.HealBeamRange.Value; LayerMask val3 = SemiFunc.LayerMaskGetVisionObstruct(); int value2 = ((LayerMask)(ref val3)).value; PlayerAvatar result = null; float num = 12f; RaycastHit val6 = default(RaycastHit); foreach (PlayerAvatar item in SemiFunc.PlayerGetList()) { if ((Object)(object)item == (Object)null || (Object)(object)item == (Object)(object)caster || (Object)(object)item.playerHealth == (Object)null) { continue; } Vector3 val4 = HealEffects.Chest(item); Vector3 val5 = val4 - val; if (!(((Vector3)(ref val5)).magnitude > value)) { float num2 = Vector3.Angle(val2, val5); if (!(num2 > num) && (!Physics.Linecast(val, val4, ref val6, value2, (QueryTriggerInteraction)1) || !((Object)(object)((Component)((RaycastHit)(ref val6)).collider).GetComponentInParent<PlayerAvatar>() != (Object)(object)item) || !((Object)(object)((Component)((RaycastHit)(ref val6)).collider).GetComponentInParent<PhysGrabObject>() != (Object)(object)base.PhysGrabObject))) { result = item; num = num2; } } } return result; } protected override void Awake() { base.Awake(); beamSound = MakeSound("heal_chime_1.pcm"); areaSound = MakeSound("heal_chime_2.pcm"); } protected override void ChargeBegin(float[] data) { cast = data; } protected override void ChargeTick(float progress, float elapsed) { } protected override void ChargeEnd() { } protected override void Launch() { //IL_0037: 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_00d4: 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_0091: Unknown result type (might be due to invalid IL or missing references) float[] array = cast; cast = null; if (array == null || array.Length < 2) { return; } if (array[0] >= 1.5f && array.Length >= 4) { HealEffects.SpawnMissBeam(base.Tip, new Vector3(array[1], array[2], array[3])); ChargedWand.PlayAt(beamSound, base.Tip, base.Tip.position); return; } if (array[0] >= 1f && array.Length >= 4) { Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(array[1], array[2], array[3]); HealEffects.SpawnArea(val, base.IsHost); ChargedWand.PlayAt(areaSound, null, val); return; } PlayerAvatar val2 = SemiFunc.PlayerAvatarGetFromPhotonID(Mathf.RoundToInt(array[1])); if ((Object)(object)val2 != (Object)null) { HealEffects.SpawnBeam(this, base.Tip, val2, base.IsHost); } ChargedWand.PlayAt(beamSound, base.Tip, base.Tip.position); } protected override void ImpactEffect(Vector3 position) { } protected override void LateUpdate() { //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) base.LateUpdate(); bool flag = base.GunState == 0 && (Object)(object)base.Holder != (Object)null && LookUp >= 1f; auraAmount = Mathf.MoveTowards(auraAmount, flag ? 1f : 0f, Time.deltaTime * 4f); if (!(auraAmount <= 0f) || !((Object)(object)aura == (Object)null)) { if ((Object)(object)aura == (Object)null) { BuildAura(); } aura.position = base.Tip.position; float num = 1f + 0.15f * Mathf.Sin(Time.time * 6f); auraHalo.SetSize(0.12f * auraAmount * num); auraHalo.SetColor(new Color(Lime.r, Lime.g, Lime.b, 0.6f * auraAmount)); EmissionModule emission = auraSparkles.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(40f * auraAmount); } } private void BuildAura() { //IL_0006: 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_0053: 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) aura = new GameObject("Heal Aura").transform; aura.SetParent(((Component)this).transform, false); auraHalo = SoftGlow.Create(aura, Vector3.zero, "Aura Glow"); auraSparkles = HealEffects.Sparkles(aura, 0.06f, 0f, Vector3.up * 0.4f); } protected override void OnDestroy() { base.OnDestroy(); if ((Object)(object)aura != (Object)null) { Object.Destroy((Object)(object)((Component)aura).gameObject); } } } public class Icicle : MonoBehaviour { private const float HitRadius = 0.05f; private static readonly Color Cyan = new Color(0.4f, 0.85f, 1f); private FrostWand wand; private int id; private bool authority; private float age; private bool done; private PlayerAvatar caster; private static int Damage => Settings.FrostIcicleDamage.Value; private static float Speed => Settings.FrostIcicleSpeed.Value; private static float Lifetime => Settings.FrostIcicleLifetime.Value; internal static GameObject CreateVisual(string name) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0023: 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_004f: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name); MeshLibrary.Model icicleModel = WandBuilder.IcicleModel; if (icicleModel != null) { MeshLibrary.Attach(icicleModel, val.transform, "Mesh", WandBuilder.MaterialTemplate); } else { Plugin.Log.LogWarning((object)"Icicle model not loaded; icicles have no visuals."); } Light obj = val.AddComponent<Light>(); obj.type = (LightType)2; obj.color = Cyan; obj.range = 1.2f; obj.intensity = 0.8f; return val; } internal static Icicle Spawn(FrostWand wand, int id, Vector3 position, Quaternion rotation, bool authority) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) GameObject obj = CreateVisual("HWP Icicle " + id); obj.transform.SetPositionAndRotation(position, rotation); TrailRenderer val = obj.AddComponent<TrailRenderer>(); val.time = 0.12f; val.startWidth = 0.05f; val.endWidth = 0f; val.minVertexDistance = 0.05f; if ((Object)(object)FireballFx.Glow != (Object)null) { ((Renderer)val).sharedMaterial = FireballFx.Glow; } val.startColor = new Color(0.75f, 0.95f, 1f, 0.6f); val.endColor = new Color(0.4f, 0.85f, 1f, 0f); ((Renderer)val).shadowCastingMode = (ShadowCastingMode)0; Icicle icicle = obj.AddComponent<Icicle>(); icicle.wand = wand; icicle.id = id; icicle.authority = authority; icicle.caster = ProjectileHits.Holder(((Object)(object)wand != (Object)null) ? wand.PhysGrabObject : null); return icicle; } private void FixedUpdate() { //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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_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_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0164: 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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008c: 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_00b9: 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_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: 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_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) if (done) { return; } float fixedDeltaTime = Time.fixedDeltaTime; age += fixedDeltaTime; Vector3 position = ((Component)this).transform.position; Vector3 val = ((Component)this).transform.forward * Speed * fixedDeltaTime; if (authority) { PhysGrabObject self = (((Object)(object)wand != (Object)null) ? wand.PhysGrabObject : null); RaycastHit best; bool flag = ProjectileHits.World(position, val, 0.05f, self, out best); float maxDistance = (flag ? Vector3.Distance(position, ((RaycastHit)(ref best)).point) : float.MaxValue); if (ProjectileHits.Player(position, val, 0.05f, maxDistance, caster, out var hitPlayer, out var point)) { ProjectileHits.HurtPlayer(hitPlayer, Damage, point); Finish(point); return; } if (flag) { ProjectileHits.HurtEnemy(((RaycastHit)(ref best)).collider, Damage, ((Vector3)(ref val)).normalized); Finish(((RaycastHit)(ref best)).point + ((RaycastHit)(ref best)).normal * 0.03f); return; } if (age >= Lifetime) { Finish(position); return; } } else if (age >= Lifetime + 1.5f) { if ((Object)(object)wand != (Object)null) { wand.Forget(id); } Object.Destroy((Object)(object)((Component)this).gameObject); return; } ((Component)this).transform.position = position + val; } private void Finish(Vector3 position) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) done = true; if ((Object)(object)wand != (Object)null) { wand.HostImpact(id, position); return; } IceShatter.Spawn(position); IcicleStun.Apply(position); Object.Destroy((Object)(object)((Component)this).gameObject); } } internal static class IcicleStun { private const float Radius = 0.3f; private static GameObject template; internal static void Init() { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_00ae: Unknown result type (might be due to invalid IL or missing references) GameObject val = Resources.Load<GameObject>("Items/Item Melee Sledge Hammer") ?? Resources.Load<GameObject>("Items/Item Melee Sledgehammer"); HurtCollider val2 = (((Object)(object)val != (Object)null) ? val.GetComponentInChildren<HurtCollider>(true) : null); if ((Object)(object)val2 == (Object)null) { Plugin.Log.LogWarning((object)"Sledgehammer not found; icicles won't stun."); return; } GameObject val3 = new GameObject("HatterWeaponsPack.IcicleStunTemplate"); val3.SetActive(false); Object.DontDestroyOnLoad((Object)(object)val3); ((Object)val3).hideFlags = (HideFlags)61; template = Object.Instantiate<GameObject>(((Component)val2).gameObject, val3.transform); ((Object)template).name = "HWP Icicle Stun"; template.SetActive(false); foreach (Transform item in template.transform) { Object.Destroy((Object)(object)((Component)item).gameObject); } Plugin.Log.LogInfo((object)($"Icicle stun copied from the sledgehammer: enemy stun {val2.enemyStun} ({val2.enemyStunTime}s), " + $"player tumble {val2.playerTumbleTime}s, stun {val2.playerStunTime}s.")); } internal static void Apply(Vector3 position) { //IL_0013: 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_0025: 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_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_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Expected O, but got Unknown //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Expected O, but got Unknown //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Expected O, but got Unknown //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Expected O, but got Unknown if ((Object)(object)template == (Object)null) { return; } GameObject val = Object.Instantiate<GameObject>(template, position, Quaternion.identity); val.transform.localScale = Vector3.one; Collider[] components = val.GetComponents<Collider>(); foreach (Collider val2 in components) { val2.isTrigger = true; SphereCollider val3 = (SphereCollider)(object)((val2 is SphereCollider) ? val2 : null); if (val3 != null) { val3.center = Vector3.zero; val3.radius = 0.3f; continue; } BoxCollider val4 = (BoxCollider)(object)((val2 is BoxCollider) ? val2 : null); if (val4 != null) { val4.center = Vector3.zero; val4.size = Vector3.one * 0.3f * 2f; continue; } CapsuleCollider val5 = (CapsuleCollider)(object)((val2 is CapsuleCollider) ? val2 : null); if (val5 != null) { val5.center = Vector3.zero; val5.radius = 0.3f; val5.height = 0.6f; } } HurtCollider component = val.GetComponent<HurtCollider>(); if ((Object)(object)component == (Object)null) { Object.Destroy((Object)(object)val); return; } component.enemyDamage = 0; component.playerDamage = 0; component.playerKill = false; component.enemyKill = false; component.deathPit = false; component.enemyHost = null; if (component.ignoreObjects != null) { component.ignoreObjects.Clear(); } if (component.ignorePlayers != null) { component.ignorePlayers.Clear(); } component.onImpactAny = new UnityEvent(); component.onImpactEnemy = new UnityEvent(); component.onImpactPlayer = new UnityEvent(); component.onImpactPhysObject = new UnityEvent(); component.hasTimer = true; component.timer = 0.15f; component.destroyOnTimerEnd = true; val.SetActive(true); Object.Destroy((Object)(object)val, 1f); } } internal class IceShatter : MonoBehaviour { private const float Duration = 0.6f; private float t; private Light flash; internal static void Spawn(Vector3 position) { //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_0010: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("HWP Ice Shatter"); val.transform.position = position; val.AddComponent<IceShatter>(); } private void Awake() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0153: 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) flash = ((Component)this).gameObject.AddComponent<Light>(); flash.type = (LightType)2; flash.color = new Color(0.5f, 0.9f, 1f); flash.range = 2f; flash.intensity = 3f; ParticleSystem val = ((Component)this).gameObject.AddComponent<ParticleSystem>(); val.Stop(true, (ParticleSystemStopBehavior)0); MainModule main = val.main; ((MainModule)(ref main)).duration = 0.1f; ((MainModule)(ref main)).loop = false; ((MainModule)(ref main)).startLifetime = new MinMaxCurve(0.25f, 0.5f); ((MainModule)(ref main)).startSpeed = new MinMaxCurve(1.5f, 4f); ((MainModule)(ref main)).startSize = new MinMaxCurve(0.015f, 0.04f); ((MainModule)(ref main)).startColor = new MinMaxGradient(new Color(0.85f, 0.97f, 1f), new Color(0.4f, 0.85f, 1f)); ((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(1f); ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; EmissionModule emission = val.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(0f); ((EmissionModule)(ref emission)).SetBursts((Burst[])(object)new Burst[1] { new Burst(0f, (short)18) }); ShapeModule shape = val.shape; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)0; ((ShapeModule)(ref shape)).radius = 0.03f; ParticleSystemRenderer component = ((Component)this).GetComponent<ParticleSystemRenderer>(); if ((Object)(object)FireballFx.Glow != (Object)null) { ((Renderer)component).sharedMaterial = FireballFx.Glow; } ((Renderer)component).shadowCastingMode = (ShadowCastingMode)0; val.Play(); } private void Update() { t += Time.deltaTime; flash.intensity = 3f * Mathf.Clamp01(1f - t / 0.15f); if (t >= 0.6f) { Object.Destroy((Object)(object)((Component)this).gameObject); } } } internal static class MeshLibrary { internal class Part { public string MaterialName; public Color Color; public float Smoothness; public float Metallic; } internal class Model { public string Name; public Mesh Mesh; public List<Part> Parts = new List<Part>(); } private static readonly Dictionary<string, Dictionary<string, Model>> cache = new Dictionary<string, Dictionary<string, Model>>(); private static readonly Dictionary<string, Material> materialCache = new Dictionary<string, Material>(); private static Dictionary<string, float> SelfLit => new Dictionary<string, float> { { "PR Body", Settings.PlasmaBodyGlow.Value }, { "Ice Crystal", 0.5f } }; internal static Model Get(string file, string objectName) { if (!cache.TryGetValue(file, out var value)) { value = (cache[file] = Load(file)); } if (value == null || !value.TryGetValue(objectName, out var value2)) { return null; } return value2; } private static Dictionary<string, Model> Load(string file) { //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Expected O, but got Unknown //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) string text = "HatterWeaponsPack.Assets." + file; using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(text); if (stream == null) { Plugin.Log.LogError((object)("Embedded model '" + text + "' is missing.")); return null; } using BinaryReader binaryReader = new BinaryReader(stream); if (Encoding.ASCII.GetString(binaryReader.ReadBytes(4)) != "HWM1") { Plugin.Log.LogError((object)("'" + file + "' is not a HWM1 model.")); return null; } Dictionary<string, Model> dictionary = new