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 GreydwarfDanceParty v2.1.0
GreydwarfDanceParty.dll
Decompiled a month agousing System; using System.Collections; using System.Collections.Generic; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: AssemblyVersion("0.0.0.0")] namespace GreydwarfDanceParty; [BepInPlugin("greydwarf.danceparty", "GreydwarfDanceParty", "2.0.0")] public class DancePartyPlugin : BaseUnityPlugin { public const string PluginGuid = "greydwarf.danceparty"; public const string PluginName = "GreydwarfDanceParty"; public const string PluginVersion = "2.0.0"; public static DancePartyPlugin Instance; public static ConfigEntry<bool> Enabled; public static ConfigEntry<bool> FreezeInPlace; public static ConfigEntry<float> DanceSpeed; public static ConfigEntry<float> DanceIntensity; public static ConfigEntry<bool> KissingEnabled; public static ConfigEntry<float> KissDistance; public static ConfigEntry<float> KissInterval; public static ConfigEntry<float> KissDuration; public static ConfigEntry<bool> Hearts; public static ConfigEntry<bool> InteractEnabled; public static ConfigEntry<bool> OncePerDwarf; public static ConfigEntry<bool> DanceWithThem; public static ConfigEntry<bool> BuffEnabled; public static ConfigEntry<float> BuffSecondsPerKiss; public static ConfigEntry<float> BuffMaxSeconds; public static ConfigEntry<float> BuffHealthRegen; public static ConfigEntry<float> BuffStaminaRegen; private static volatile bool s_configDirty; private FileSystemWatcher m_watcher; private float m_reloadAt; private void Awake() { //IL_024f: Unknown result type (might be due to invalid IL or missing references) Instance = this; Enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Make Greydwarfs dance instead of fighting."); FreezeInPlace = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "FreezeInPlace", true, "Greydwarfs stop chasing and attacking while dancing. Turn this off if you want them to still hunt you - they will dance while they do it."); DanceSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("General", "DanceSpeed", 1f, "Tempo of the dance."); DanceIntensity = ((BaseUnityPlugin)this).Config.Bind<float>("General", "DanceIntensity", 1f, "How wild the moves are."); KissingEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Kissing", "Enabled", true, "Greydwarfs standing near each other occasionally turn and smooch."); KissDistance = ((BaseUnityPlugin)this).Config.Bind<float>("Kissing", "Distance", 6f, "How close two Greydwarfs must be to pair up (meters)."); KissInterval = ((BaseUnityPlugin)this).Config.Bind<float>("Kissing", "Interval", 5f, "Average seconds between smooch attempts."); KissDuration = ((BaseUnityPlugin)this).Config.Bind<float>("Kissing", "Duration", 2.5f, "How long a smooch lasts (seconds)."); Hearts = ((BaseUnityPlugin)this).Config.Bind<bool>("Kissing", "Hearts", true, "Pop a floating pink heart above each happy couple."); InteractEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Interaction", "Enabled", true, "Walk up to a dancing Greydwarf and press your Use key to kiss it."); OncePerDwarf = ((BaseUnityPlugin)this).Config.Bind<bool>("Interaction", "OncePerDwarf", true, "Each Greydwarf can only be kissed once, so you cannot farm the buff off one dwarf."); DanceWithThem = ((BaseUnityPlugin)this).Config.Bind<bool>("Interaction", "DanceWithThem", true, "After the kiss your character dances along with them."); BuffEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Buff", "Enabled", true, "Grant the 'Greydwarf Love' buff when you kiss a Greydwarf."); BuffSecondsPerKiss = ((BaseUnityPlugin)this).Config.Bind<float>("Buff", "SecondsPerKiss", 60f, "Seconds of buff granted per Greydwarf kissed. Kissing more dwarfs extends the timer."); BuffMaxSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Buff", "MaxSeconds", 600f, "Maximum total buff duration you can stack up (seconds)."); BuffHealthRegen = ((BaseUnityPlugin)this).Config.Bind<float>("Buff", "HealthRegenMultiplier", 1.5f, "Health regeneration multiplier while buffed (1.0 = normal)."); BuffStaminaRegen = ((BaseUnityPlugin)this).Config.Bind<float>("Buff", "StaminaRegenMultiplier", 1.5f, "Stamina regeneration multiplier while buffed (1.0 = normal)."); new Harmony("greydwarf.danceparty").PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"GreydwarfDanceParty loaded. The forest is about to get weird."); WatchConfigFile(); } private void WatchConfigFile() { try { string configFilePath = ((BaseUnityPlugin)this).Config.ConfigFilePath; m_watcher = new FileSystemWatcher(Path.GetDirectoryName(configFilePath), Path.GetFileName(configFilePath)); m_watcher.NotifyFilter = NotifyFilters.FileName | NotifyFilters.Size | NotifyFilters.LastWrite; FileSystemEventHandler value = delegate { s_configDirty = true; }; m_watcher.Changed += value; m_watcher.Created += value; m_watcher.Renamed += delegate { s_configDirty = true; }; m_watcher.EnableRaisingEvents = true; } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Live config reload unavailable: " + ex.Message)); } } private void Update() { if (s_configDirty && m_reloadAt <= 0f) { m_reloadAt = Time.time + 0.4f; } if (m_reloadAt <= 0f || Time.time < m_reloadAt) { return; } s_configDirty = false; m_reloadAt = 0f; try { ((BaseUnityPlugin)this).Config.Reload(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Config reloaded - new settings are live."); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Config reload failed, will retry: " + ex.Message)); s_configDirty = true; } } public void Run(IEnumerator routine) { ((MonoBehaviour)this).StartCoroutine(routine); } public static bool IsHeadless() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Invalid comparison between Unknown and I4 if ((int)SystemInfo.graphicsDeviceType == 4) { return true; } try { if ((Object)(object)ZNet.instance != (Object)null && ZNet.instance.IsDedicated()) { return true; } } catch (Exception) { } return false; } } [HarmonyPatch(typeof(Character), "Awake")] public static class Character_Awake_Patch { private static void Postfix(Character __instance) { try { if (!DancePartyPlugin.IsHeadless() && !((Object)(object)__instance == (Object)null) && ((Object)((Component)__instance).gameObject).name.StartsWith("Greydwarf", StringComparison.OrdinalIgnoreCase)) { ((Component)__instance).gameObject.AddComponent<DwarfDancer>().m_character = __instance; ((Component)__instance).gameObject.AddComponent<DwarfKissable>(); } } catch (Exception ex) { Debug.LogWarning((object)("[GreydwarfDanceParty] Failed to start the party: " + ex)); } } } [HarmonyPatch(typeof(MonsterAI), "UpdateAI")] public static class MonsterAI_UpdateAI_Patch { private static bool Prefix(MonsterAI __instance, ref bool __result) { if (!DancePartyPlugin.Enabled.Value || !DancePartyPlugin.FreezeInPlace.Value) { return true; } DwarfDancer component = ((Component)__instance).GetComponent<DwarfDancer>(); if ((Object)(object)component == (Object)null || !component.IsDancing()) { return true; } ZNetView value = Traverse.Create((object)__instance).Field("m_nview").GetValue<ZNetView>(); if ((Object)(object)value == (Object)null || !value.IsValid() || !value.IsOwner()) { return true; } try { Traverse.Create((object)__instance).Method("StopMoving", new object[0]).GetValue(); } catch (Exception) { } __result = true; return false; } } [HarmonyPatch(typeof(Character), "GetHoverText")] public static class Character_GetHoverText_Patch { private static void Postfix(Character __instance, ref string __result) { try { if (DancePartyPlugin.InteractEnabled.Value && DancePartyPlugin.Enabled.Value) { DwarfKissable component = ((Component)__instance).GetComponent<DwarfKissable>(); if (!((Object)(object)component == (Object)null) && component.CanKiss()) { string text = (component.WasKissed() ? "Already smooched" : "[<color=yellow><b>$KEY_Use</b></color>] Kiss"); __result = Localization.instance.Localize(text); } } } catch (Exception) { } } } public class DwarfKissable : MonoBehaviour, Interactable { private bool m_kissed; private float m_busyUntil; public bool WasKissed() { if (m_kissed) { return DancePartyPlugin.OncePerDwarf.Value; } return false; } public bool CanKiss() { DwarfDancer component = ((Component)this).GetComponent<DwarfDancer>(); if ((Object)(object)component != (Object)null) { return component.IsDancing(); } return false; } public bool Interact(Humanoid user, bool hold, bool alt) { //IL_0097: 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) //IL_00a7: 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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) if (hold || !DancePartyPlugin.Enabled.Value || !DancePartyPlugin.InteractEnabled.Value) { return false; } Player val = (Player)(object)((user is Player) ? user : null); if ((Object)(object)val == (Object)null || !CanKiss()) { return false; } if (WasKissed()) { ((Character)val).Message((MessageType)2, "This one has already been smooched", 0, (Sprite)null, false); return true; } if (Time.time < m_busyUntil) { return false; } m_kissed = true; m_busyUntil = Time.time + 1f; DwarfDancer component = ((Component)this).GetComponent<DwarfDancer>(); component.KissThePlayer(val); if (DancePartyPlugin.Hearts.Value) { try { Vector3 val2 = (((Component)this).transform.position + ((Component)val).transform.position) * 0.5f; Heart.Spawn(val2 + Vector3.up * 1.4f, DancePartyPlugin.KissDuration.Value, (Renderer)(object)((Component)this).GetComponentInChildren<SkinnedMeshRenderer>()); } catch (Exception ex) { Debug.LogWarning((object)("[GreydwarfDanceParty] Heart failed: " + ex.Message)); } } GreydwarfLove.Grant(val); if ((Object)(object)DancePartyPlugin.Instance != (Object)null) { DancePartyPlugin.Instance.Run(PlayerRoutine(val)); } return true; } private IEnumerator PlayerRoutine(Player player) { player.StartEmote("blowkiss", true); yield return (object)new WaitForSeconds(1.3f); if (DancePartyPlugin.DanceWithThem.Value && (Object)(object)player != (Object)null) { player.StartEmote("dance", false); } } public bool UseItem(Humanoid user, ItemData item) { return false; } } public static class GreydwarfLove { public const string EffectName = "Greydwarf Love"; private static int s_nameHash; private static Sprite s_icon; public static void Grant(Player player) { if (!DancePartyPlugin.BuffEnabled.Value || (Object)(object)player == (Object)null) { return; } try { SEMan sEMan = ((Character)player).GetSEMan(); if (sEMan != null) { float value = DancePartyPlugin.BuffSecondsPerKiss.Value; float value2 = DancePartyPlugin.BuffMaxSeconds.Value; if (s_nameHash == 0) { s_nameHash = ((StatusEffect)Build(value)).NameHash(); } StatusEffect statusEffect = sEMan.GetStatusEffect(s_nameHash); if ((Object)(object)statusEffect != (Object)null) { statusEffect.m_ttl = Mathf.Min(statusEffect.m_ttl + value, value2); ((Character)player).Message((MessageType)1, "Greydwarf Love +" + Mathf.RoundToInt(value) + "s", 0, (Sprite)null, false); } else { SE_Stats val = Build(Mathf.Min(value, value2)); sEMan.AddStatusEffect((StatusEffect)(object)val, true, 0, 0f, (short)0); } } } catch (Exception ex) { Debug.LogWarning((object)("[GreydwarfDanceParty] Could not grant the buff: " + ex)); } } private static SE_Stats Build(float ttl) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) SE_Stats val = ScriptableObject.CreateInstance<SE_Stats>(); ((Object)val).name = "SE_GreydwarfLove"; ((StatusEffect)val).m_name = "Greydwarf Love"; ((StatusEffect)val).m_tooltip = "The forest loves you back.\nHealth and stamina recover faster."; ((StatusEffect)val).m_ttl = ttl; ((StatusEffect)val).m_icon = GetIcon(); ((StatusEffect)val).m_startMessage = "The Greydwarfs adore you"; ((StatusEffect)val).m_startMessageType = (MessageType)2; ((StatusEffect)val).m_stopMessage = "The love fades"; ((StatusEffect)val).m_stopMessageType = (MessageType)1; val.m_healthRegenMultiplier = DancePartyPlugin.BuffHealthRegen.Value; val.m_staminaRegenMultiplier = DancePartyPlugin.BuffStaminaRegen.Value; return val; } private static Sprite GetIcon() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_0108: 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_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)s_icon != (Object)null) { return s_icon; } Texture2D val = new Texture2D(64, 64, (TextureFormat)4, false); Color val2 = default(Color); ((Color)(ref val2))..ctor(1f, 0.35f, 0.55f, 1f); Color val3 = default(Color); ((Color)(ref val3))..ctor(0f, 0f, 0f, 0f); for (int i = 0; i < 64; i++) { for (int j = 0; j < 64; j++) { float num = (float)j / 63f * 2.4f - 1.2f; float num2 = 1.25f - (float)i / 63f * 2.4f; float num3 = num * num + num2 * num2 - 0.85f; bool flag = num3 * num3 * num3 - num * num * num2 * num2 * num2 <= 0f; val.SetPixel(j, i, flag ? val2 : val3); } } val.Apply(); s_icon = Sprite.Create(val, new Rect(0f, 0f, 64f, 64f), new Vector2(0.5f, 0.5f)); return s_icon; } } public class DwarfDancer : MonoBehaviour { public static readonly List<DwarfDancer> All = new List<DwarfDancer>(); public Character m_character; private Transform m_visual; private Vector3 m_basePos; private Quaternion m_baseRot; private float m_phase; private DwarfDancer m_partner; private Transform m_kissTarget; private float m_kissEndsAt; private float m_nextKissCheck; private void Start() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) GameObject value = Traverse.Create((object)m_character).Field("m_visual").GetValue<GameObject>(); if ((Object)(object)value == (Object)null) { ((Behaviour)this).enabled = false; return; } m_visual = value.transform; m_basePos = m_visual.localPosition; m_baseRot = m_visual.localRotation; m_phase = Random.Range(0f, 10f); m_nextKissCheck = Time.time + Random.Range(1f, DancePartyPlugin.KissInterval.Value); All.Add(this); } private void OnDestroy() { All.Remove(this); } public bool IsDancing() { if (DancePartyPlugin.Enabled.Value && (Object)(object)m_character != (Object)null) { return !m_character.IsDead(); } return false; } public void KissThePlayer(Player player) { ReleasePartner(); m_kissTarget = ((Component)player).transform; m_kissEndsAt = Time.time + DancePartyPlugin.KissDuration.Value; } private void ReleasePartner() { if ((Object)(object)m_partner != (Object)null) { m_partner.m_partner = null; m_partner.m_kissTarget = null; m_partner = null; } } private void LateUpdate() { //IL_001e: 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) if ((Object)(object)m_visual == (Object)null) { return; } if (!IsDancing()) { m_visual.localPosition = m_basePos; m_visual.localRotation = m_baseRot; return; } if (DancePartyPlugin.KissingEnabled.Value) { UpdateKissing(); } if ((Object)(object)m_kissTarget != (Object)null && Time.time < m_kissEndsAt) { PoseKiss(); } else { PoseDance(); } } private void PoseDance() { //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: 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) float num = Time.time * DancePartyPlugin.DanceSpeed.Value + m_phase; float value = DancePartyPlugin.DanceIntensity.Value; float num2 = Mathf.Abs(Mathf.Sin(num * 3f)) * 0.22f * value; float num3 = Mathf.Sin(num * 1.5f) * 0.14f * value; float num4 = Mathf.Sin(num * 1.5f) * 32f * value; float num5 = Mathf.Sin(num * 3f + 0.7f) * 16f * value; m_visual.localPosition = m_basePos + new Vector3(num3, num2, 0f); m_visual.localRotation = m_baseRot * Quaternion.Euler(0f, num4, num5); } private void PoseKiss() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: 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_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: 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_010d: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) Vector3 val = m_kissTarget.position - ((Component)this).transform.position; val.y = 0f; if (!(((Vector3)(ref val)).sqrMagnitude < 0.0001f)) { Vector3 normalized = ((Vector3)(ref val)).normalized; float num = Vector3.SignedAngle(((Component)this).transform.forward, normalized, Vector3.up); float num2 = Mathf.Sin((Time.time - (m_kissEndsAt - DancePartyPlugin.KissDuration.Value)) * 3f) * 8f + 26f; Vector3 val2 = ((Component)this).transform.InverseTransformDirection(normalized) * 0.45f; Vector3 val3 = m_basePos + new Vector3(val2.x, 0.08f, val2.z); m_visual.localPosition = Vector3.Lerp(m_visual.localPosition, val3, Time.deltaTime * 6f); m_visual.localRotation = Quaternion.Slerp(m_visual.localRotation, m_baseRot * Quaternion.Euler(num2, num, 0f), Time.deltaTime * 6f); } } private void UpdateKissing() { //IL_0149: 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_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)m_kissTarget != (Object)null) { if (Time.time >= m_kissEndsAt) { ReleasePartner(); m_kissTarget = null; } } else { if (Time.time < m_nextKissCheck) { return; } m_nextKissCheck = Time.time + Random.Range(DancePartyPlugin.KissInterval.Value * 0.5f, DancePartyPlugin.KissInterval.Value * 1.5f); float num = DancePartyPlugin.KissDistance.Value; DwarfDancer dwarfDancer = null; for (int i = 0; i < All.Count; i++) { DwarfDancer dwarfDancer2 = All[i]; if (!((Object)(object)dwarfDancer2 == (Object)(object)this) && !((Object)(object)dwarfDancer2 == (Object)null) && !((Object)(object)dwarfDancer2.m_kissTarget != (Object)null) && dwarfDancer2.IsDancing()) { float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)dwarfDancer2).transform.position); if (num2 < num) { num = num2; dwarfDancer = dwarfDancer2; } } } if ((Object)(object)dwarfDancer == (Object)null) { return; } float kissEndsAt = Time.time + DancePartyPlugin.KissDuration.Value; m_partner = dwarfDancer; m_kissTarget = ((Component)dwarfDancer).transform; m_kissEndsAt = kissEndsAt; dwarfDancer.m_partner = this; dwarfDancer.m_kissTarget = ((Component)this).transform; dwarfDancer.m_kissEndsAt = kissEndsAt; if (DancePartyPlugin.Hearts.Value) { try { Vector3 val = (((Component)this).transform.position + ((Component)dwarfDancer).transform.position) * 0.5f; Heart.Spawn(val + Vector3.up * 1.4f, DancePartyPlugin.KissDuration.Value, (Renderer)(object)((Component)this).GetComponentInChildren<SkinnedMeshRenderer>()); } catch (Exception ex) { Debug.LogWarning((object)("[GreydwarfDanceParty] Heart failed: " + ex.Message)); } } } } } public class Heart : MonoBehaviour { private float m_dieAt; private static Material s_mat; private static Material GetMaterial(Renderer fallbackSource) { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Expected O, but got Unknown //IL_00a0: 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_0127: Expected O, but got Unknown //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Expected O, but got Unknown //IL_0134: 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_00cd: 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) if ((Object)(object)s_mat != (Object)null) { return s_mat; } Color val = default(Color); ((Color)(ref val))..ctor(1f, 0.25f, 0.45f, 1f); string[] array = new string[6] { "Particles/Standard Unlit", "Sprites/Default", "Unlit/Color", "Legacy Shaders/Diffuse", "UI/Default", "Standard" }; for (int i = 0; i < array.Length; i++) { Shader val2 = Shader.Find(array[i]); if (!((Object)(object)val2 == (Object)null)) { Material val3 = new Material(val2); if (val3.HasProperty("_Color")) { val3.color = val; } if (val3.HasProperty("_EmissionColor")) { val3.EnableKeyword("_EMISSION"); val3.SetColor("_EmissionColor", val * 1.6f); } Debug.Log((object)("[GreydwarfDanceParty] Heart shader: " + array[i])); s_mat = val3; return s_mat; } } if ((Object)(object)fallbackSource != (Object)null && (Object)(object)fallbackSource.sharedMaterial != (Object)null) { Material val4 = new Material(fallbackSource.sharedMaterial); Texture2D val5 = new Texture2D(1, 1); val5.SetPixel(0, 0, val); val5.Apply(); val4.mainTexture = (Texture)(object)val5; if (val4.HasProperty("_Color")) { val4.color = val; } Debug.Log((object)"[GreydwarfDanceParty] Heart shader: cloned from creature material"); s_mat = val4; } return s_mat; } public static void Spawn(Vector3 pos, float life, Renderer fallbackSource) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0022: 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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0079: 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_008b: 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_00b3: Unknown result type (might be due to invalid IL or missing references) Material material = GetMaterial(fallbackSource); if (!((Object)(object)material == (Object)null)) { GameObject val = new GameObject("gdp_heart"); val.transform.position = pos; AddPiece(val, material, (PrimitiveType)0, new Vector3(-0.17f, 0.14f, 0f), Vector3.one * 0.34f, Quaternion.identity); AddPiece(val, material, (PrimitiveType)0, new Vector3(0.17f, 0.14f, 0f), Vector3.one * 0.34f, Quaternion.identity); AddPiece(val, material, (PrimitiveType)3, Vector3.zero, new Vector3(0.34f, 0.34f, 0.24f), Quaternion.Euler(0f, 0f, 45f)); Heart heart = val.AddComponent<Heart>(); heart.m_dieAt = Time.time + life + 1f; } } private static void AddPiece(GameObject root, Material mat, PrimitiveType type, Vector3 pos, Vector3 scale, Quaternion rot) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.CreatePrimitive(type); Collider component = val.GetComponent<Collider>(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } val.transform.SetParent(root.transform, false); val.transform.localPosition = pos; val.transform.localScale = scale; val.transform.localRotation = rot; val.GetComponent<Renderer>().sharedMaterial = mat; } private void LateUpdate() { //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_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) Transform transform = ((Component)this).transform; transform.position += Vector3.up * Time.deltaTime * 0.6f; Camera main = Camera.main; if ((Object)(object)main != (Object)null) { ((Component)this).transform.rotation = ((Component)main).transform.rotation; } float num = m_dieAt - Time.time; if (num <= 0f) { Object.Destroy((Object)(object)((Component)this).gameObject); } else if (num < 0.5f) { ((Component)this).transform.localScale = Vector3.one * (num / 0.5f); } } }