D:\ValheimDev\Dumps\Old\assembly_valheim\AnimationEffect.cs D:\ValheimDev\Dumps\Latest\assembly_valheim\AnimationEffect.cs
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
   
public class AnimationEffect : MonoBehaviour public class AnimationEffect : MonoBehaviour
{ {
    private void Start()     private void Start()
    {     {
        this.m_animator = base.GetComponent<Animator>();         this.m_animator = base.GetComponent<Animator>();
    }     }
   
    public void Effect(AnimationEvent e)     public void Effect(AnimationEvent e)
    {     {
        string stringParameter = e.stringParameter;         string stringParameter = e.stringParameter;
        GameObject gameObject = e.objectReferenceParameter as GameObject;         GameObject gameObject = e.objectReferenceParameter as GameObject;
        if (gameObject == null)         if (gameObject == null)
        {         {
            return;             return;
        }         }
        Transform transform = null;         Transform transform = null;
        if (stringParameter.Length > 0)         if (stringParameter.Length > 0)
        {         {
            transform = Utils.FindChild(base.transform, stringParameter, Utils.IterativeSearchType.DepthFirst);             transform = Utils.FindChild(base.transform, stringParameter, Utils.IterativeSearchType.DepthFirst);
        }         }
        if (transform == null)         if (transform == null)
        {         {
            transform = (this.m_effectRoot ? this.m_effectRoot : base.transform);             transform = (this.m_effectRoot ? this.m_effectRoot : base.transform);
        }         }
        UnityEngine.Object.Instantiate<GameObject>(gameObject, transform.position, transform.rotation);         UnityEngine.Object.Instantiate<GameObject>(gameObject, transform.position, transform.rotation);
    }     }
   
    public void Attach(AnimationEvent e)     public void Attach(AnimationEvent e)
    {     {
        string stringParameter = e.stringParameter;         string stringParameter = e.stringParameter;
        GameObject gameObject = e.objectReferenceParameter as GameObject;         GameObject gameObject = e.objectReferenceParameter as GameObject;
.          bool flag = e.intParameter < 0;
          int intParameter = e.intParameter;
          bool flag2 = intParameter == 10 || intParameter == -10;
        if (gameObject == null)         if (gameObject == null)
        {         {
            return;             return;
        }         }
.          if (stringParameter == "")
          {
              ZLog.LogWarning("No joint name specified for Attach in animation " + e.animatorClipInfo.clip.name);
              return;
          }
        Transform transform = Utils.FindChild(base.transform, stringParameter, Utils.IterativeSearchType.DepthFirst);         Transform transform = Utils.FindChild(base.transform, stringParameter, Utils.IterativeSearchType.DepthFirst);
        if (transform == null)         if (transform == null)
        {         {
.            ZLog.LogWarning("Failed to find attach joint " + stringParameter);             ZLog.LogWarning("Failed to find attach joint " + stringParameter + " for animation " + e.animatorClipInfo.clip.name);
            return;             return;
        }         }
        this.ClearAttachment(transform);         this.ClearAttachment(transform);
        GameObject gameObject2 = UnityEngine.Object.Instantiate<GameObject>(gameObject, transform.position, transform.rotation);         GameObject gameObject2 = UnityEngine.Object.Instantiate<GameObject>(gameObject, transform.position, transform.rotation);
.          Vector3 localScale = gameObject2.transform.localScale;
        gameObject2.transform.SetParent(transform, true);         gameObject2.transform.SetParent(transform, true);
.          if (flag2)
          {
              gameObject2.transform.localScale = localScale;
          }
          if (flag)
          {
              return;
          }
        if (this.m_attachments == null)         if (this.m_attachments == null)
        {         {
            this.m_attachments = new List<GameObject>();             this.m_attachments = new List<GameObject>();
        }         }
        this.m_attachments.Add(gameObject2);         this.m_attachments.Add(gameObject2);
        this.m_attachStateHash = e.animatorStateInfo.fullPathHash;         this.m_attachStateHash = e.animatorStateInfo.fullPathHash;
        base.CancelInvoke("UpdateAttachments");         base.CancelInvoke("UpdateAttachments");
        base.InvokeRepeating("UpdateAttachments", 0.1f, 0.1f);         base.InvokeRepeating("UpdateAttachments", 0.1f, 0.1f);
    }     }
   
    private void ClearAttachment(Transform parent)     private void ClearAttachment(Transform parent)
    {     {
        if (this.m_attachments == null)         if (this.m_attachments == null)
        {         {
            return;             return;
        }         }
        foreach (GameObject gameObject in this.m_attachments)         foreach (GameObject gameObject in this.m_attachments)
        {         {
            if (gameObject && gameObject.transform.parent == parent)             if (gameObject && gameObject.transform.parent == parent)
            {             {
                this.m_attachments.Remove(gameObject);                 this.m_attachments.Remove(gameObject);
                UnityEngine.Object.Destroy(gameObject);                 UnityEngine.Object.Destroy(gameObject);
                break;                 break;
            }             }
        }         }
    }     }
   
    public void RemoveAttachments()     public void RemoveAttachments()
    {     {
        if (this.m_attachments == null)         if (this.m_attachments == null)
        {         {
            return;             return;
        }         }
        foreach (GameObject gameObject in this.m_attachments)         foreach (GameObject gameObject in this.m_attachments)
        {         {
            UnityEngine.Object.Destroy(gameObject);             UnityEngine.Object.Destroy(gameObject);
        }         }
        this.m_attachments.Clear();         this.m_attachments.Clear();
    }     }
   
    private void UpdateAttachments()     private void UpdateAttachments()
    {     {
        if (this.m_attachments != null && this.m_attachments.Count > 0)         if (this.m_attachments != null && this.m_attachments.Count > 0)
        {         {
            if (this.m_attachStateHash != this.m_animator.GetCurrentAnimatorStateInfo(0).fullPathHash && this.m_attachStateHash != this.m_animator.GetNextAnimatorStateInfo(0).fullPathHash)             if (this.m_attachStateHash != this.m_animator.GetCurrentAnimatorStateInfo(0).fullPathHash && this.m_attachStateHash != this.m_animator.GetNextAnimatorStateInfo(0).fullPathHash)
            {             {
                this.RemoveAttachments();                 this.RemoveAttachments();
                return;                 return;
            }             }
        }         }
        else         else
        {         {
            base.CancelInvoke("UpdateAttachments");             base.CancelInvoke("UpdateAttachments");
        }         }
    }     }
   
    public Transform m_effectRoot;     public Transform m_effectRoot;
   
    private Animator m_animator;     private Animator m_animator;
   
    private List<GameObject> m_attachments;     private List<GameObject> m_attachments;
   
    private int m_attachStateHash;     private int m_attachStateHash;
} }