using UnityEngine;
        using System.Collections.Generic;
        using System.Text;
        using W.o.N_Stats;

        public enum Rarity
        {
            None,
            Common,
            Uncommon,
            Rare,
            Epic,
            Legendary,
            Mystical
        }
        public enum AttackType
        {
            None,
            Physical,
            Magic,
            Range,
            Dual
        }

        public enum EquipmentType
        {
            None,
            Head,
            Chest,
            Legs,
            Feet,
            SmallNecklace,
            LargeNecklace,
            LeftHandRing,
            RightHandRing,
            OneHanded,
            TwoHanded,
            DualWield,
            Bow,
            Staff,
            TwoHandedStaff,
            Shield,
        }

        [CreateAssetMenu(menuName = "World Of Normies/Game Items/Equippable Item")]
            public class EquippableItem : Item
            {
                [Header("Stat Information")]
                [SerializeField] protected internal string statID; // Stat ID field to uniquely identify the stat set
                public string StatID { get { return statID; } }


                [Header("Equipment Sprites ")] 
                [Tooltip("Upper Body Parts")]
                public Sprite HeadSprite;
                public Sprite ChestSprite;
                [Tooltip("Legs Body Parts")]
                public Sprite UpperLeftLegSprite;
                public Sprite LowerLeftLegSprite;
                public Sprite UpperRightLegSprite;
                public Sprite LowerRightLegSprite;
                [Tooltip("Feet Body Parts")]
                public Sprite LeftFootSprite;
                public Sprite RightFootSprite;
                [Tooltip("Hands Body Parts")]
                public Sprite LeftHandSprite;
                public Sprite RightHandSprite;
                [Tooltip("Equipment Body Parts")]
                public Sprite RightWeaponSprite;
                public Sprite LeftWeaponSprite;


            [Header("Projectile Settings")] 
            public GameObject projectilePrefab; // Define the projectilePrefab field
            public int manaCost = 0;

            public float ProjectileLifeSpan =3f;
            public float minProjectileLifeSpan = 0.0f; // Minimum projectile life span in seconds
            public float maxProjectileLifeSpan = 1.0f; // Maximum projectile life span in seconds

            public float projectileSpeed = 10f; // Speed of the projectile
            public bool hasDetectionRadius = false;
             public float DetectionRadius = 1.0f;

            [Header("Random Item Generation")]
            public string[] possibleNames; // Array of possible names for the item
             private bool nameAssigned = false; // Flag to check if name is already assigned


             [HideInInspector]
            public string selectedName;
            [Header("Random Rarity Generation")]
            public Rarity rarity;
             [Space]
            [Header("Equipment Type")]
            public AttackType AttackType; // Add this line
            public List<EquipmentType> EquipmentTypes; // Allow multiple equipment types

            // Add the EquipmentType property
            public EquipmentType EquipmentType
            {
                get { return EquipmentTypes.Count > 0 ? EquipmentTypes[0] : EquipmentType.None; }
            }

            [Space]
            [Header("All Equippable Integer Stats")]
            [Space]
            [Header("Health Stats Bonus")]
            public int HealthBonus;
            public int MinHealthBonus = 0;
            public int MaxHealthBonus = 0;
            [Space]
            [Range(0f, 1f)]
                public float HealthPercentBonus;
                public float MinHealthPercentBonus = 0f;
                public float MaxHealthPercentBonus = 0f;
            [Space]
            [Header("Mana Stats Bonus")]
            public int ManaBonus;
            public int MinManaBonus = 0;
            public int MaxManaBonus = 0;
            [Space]
            [Range(0f, 1f)]
                public float ManaPercentBonus;
                public float MinManaPercentBonus = 0f;
                public float MaxManaPercentBonus = 0f;
            [Space]
             [Header("Defence Stats Bonus")]
            public int DefenceBonus;
            public int MinDefenceBonus = 0;
            public int MaxDefenceBonus = 0;
            [Space]
            [Range(0f, 1f)]
                public float DefencePercentBonus;
                public float MinDefencePercentBonus = 0f;
                public float MaxDefencePercentBonus = 0f;
            [Space]
            [Header("Attack Stats Bonus")]
            public int AttackBonus;
            public int MinAttackBonus = 0;
            public int MaxAttackBonus = 0;
            [Space]
            [Range(0f, 1f)]
                public float AttackPercentBonus;
                public float MinAttackPercentBonus = 0f;
                public float MaxAttackPercentBonus = 0f;
            [Space] 
            [Header("Attack Speed Stats Bonus")]
            public int AttackSpeedBonus;
            public int MinAttackSpeedBonus = 0;
            public int MaxAttackSpeedBonus = 0;
            [Space]
            [Range(0f, 1f)]
                public float AttackSpeedPercentBonus;
                public float MinAttackSpeedPercentBonus = 0f;
                public float MaxAttackSpeedPercentBonus = 0f;
            [Space]
           
            [Header("Critical Stats Bonus")]
            public int CriticalBonus;
            public int MinCriticalBonus = 0;
            public int MaxCriticalBonus = 0;
            [Space]
            [Range(0f, 1f)]
                public float CriticalPercentBonus;
                public float MinCriticalPercentBonus = 0f;
                public float MaxCriticalPercentBonus = 0f;
            [Space]
            [Header("Life Steal Stats Bonus")]
            public int LifeStealBonus;
            public int MinLifeStealBonus = 0;
            public int MaxLifeStealBonus = 0;
            [Space]
            [Range(0f, 1f)]
                public float LifeStealPercentBonus;
                public float MinLifeStealPercentBonus = 0f;
                public float MaxLifeStealPercentBonus = 0f;
                [Space]

            [Header("Range Stats Bonus")]
            public int RangeBonus;
            public int MinRangeBonus = 0;
            public int MaxRangeBonus = 0;

            [Space]
            [Range(0f, 1f)]
                public float RangePercentBonus;
                public float MinRangePercentBonus = 0f;
                public float MaxRangePercentBonus = 0f;
            [Space]

            [Header("Elemental Mastery Stats Bonus")]
            public int ElementalMasteryBonus;
            public int MinElementalMasteryBonus = 0;
            public int MaxElementalMasteryBonus = 0;

            [Space]
            [Range(0f, 1f)]
                public float ElementalMasteryPercentBonus;
                public float MinElementalMasteryPercentBonus = 0f;
                public float MaxElementalMasteryPercentBonus = 0f;

            [Space]
            [Header("Speed Stats Bonus")]
            public int SpeedBonus;
            public int MinSpeedBonus = 0;
            public int MaxSpeedBonus = 0;
            [Space]
            [Range(0f, 1f)]
                public float SpeedPercentBonus;
                public float MinSpeedPercentBonus = 0f;
                public float MaxSpeedPercentBonus = 0f;
            [Space]

            [Header("Cooldown Stats Bonus")]
            public int CooldownBonus;
            public int MinCooldownBonus = 0;
            public int MaxCooldownBonus = 0;

            [Space]
            [Range(0f, 1f)]
                public float CooldownPercentBonus;
                public float MinCooldownPercentBonus = 0f;
                public float MaxCooldownPercentBonus = 0f;

            [Space]
            [Header("Knockback Stats Bonus")]
            public int KnockbackBonus;
            public int MinKnockbackBonus = 0;
            public int MaxKnockbackBonus = 0;

            [Space]
            [Range(0f, 1f)]
                public float KnockbackPercentBonus;
                public float MinKnockbackPercentBonus = 0f;
                public float MaxKnockbackPercentBonus = 0f;

            [Space]
            [Header("Recovery Stats Bonus")]
            public int RecoveryBonus;
            public int MinRecoveryBonus = 0;
            public int MaxRecoveryBonus = 0;
            [Space]
            [Range(0f, 1f)]
                public float RecoveryPercentBonus;
                public float MinRecoveryPercentBonus = 0f;
                public float MaxRecoveryPercentBonus = 0f;
            [Space]
            [Header("Evade Stats Bonus")]
            public int EvadeBonus;
            public int MinEvadeBonus = 0;
            public int MaxEvadeBonus = 0;
            [Space]
            [Range(0f, 1f)]
                public float EvadePercentBonus;
                public float MinEvadePercentBonus = 0f;
                public float MaxEvadePercentBonus = 0f;
            [Space]
            [Header("Fortune Stats Bonus")]
            public int FortuneBonus;
            public int MinFortuneBonus = 0;
            public int MaxFortuneBonus = 0;

            [Space]
            [Range(0f, 1f)]
                public float FortunePercentBonus;
                public float MinFortunePercentBonus = 0f;
                public float MaxFortunePercentBonus = 0f;
            [Space]

            [Header("Random Rarity Generation")]
            public int rarityNoneChance = 90;
            public int rarityCommonChance = 40;
            public int rarityUncommonChance = 28;
            public int rarityRareChance = 12;
            public int rarityEpicChance = 8;
            public int rarityLegendaryChance = 2;
            public int rarityMysticalChance = 1;
     
        // Equipment stats
    public int TotalHealthBonus { get; set; }
    public float TotalHealthPercentBonus { get; set; }

    public int TotalManaBonus { get; set; }
    public float TotalManaPercentBonus { get; set; }

    public int TotalDefenceBonus { get; set; }
    public float TotalDefencePercentBonus { get; set; }

    public int TotalAttackBonus { get; set; }
    public float TotalAttackPercentBonus { get; set; }

    public int TotalAttackSpeedBonus { get; set; }
    public float TotalAttackSpeedPercentBonus { get; set; }

    public int TotalCriticalBonus { get; set; }
    public float TotalCriticalPercentBonus { get; set; }

    public int TotalLifeStealBonus { get; set; }
    public float TotalLifeStealPercentBonus { get; set; }

    public int TotalRangeBonus { get; set; }
    public float TotalRangePercentBonus { get; set; }

    public int TotalElementalMasteryBonus { get; set; }
    public float TotalElementalMasteryPercentBonus { get; set; }

    public int TotalSpeedBonus { get; set; }
    public float TotalSpeedPercentBonus { get; set; }

    public int TotalCooldownBonus { get; set; }
    public float TotalCooldownPercentBonus { get; set; }

    public int TotalKnockbackBonus { get; set; }
    public float TotalKnockbackPercentBonus { get; set; }

    public int TotalRecoveryBonus { get; set; }
    public float TotalRecoveryPercentBonus { get; set; }

    public int TotalEvadeBonus { get; set; }
    public float TotalEvadePercentBonus { get; set; }

    public int TotalFortuneBonus { get; set; }
    public float TotalFortunePercentBonus { get; set; }

/// <summary>

// Add the missing GetStats method
   public int[] GetStats()
{
    return new int[]
    {
        TotalHealthBonus,
        (int)TotalHealthPercentBonus,
        TotalManaBonus,
        (int)TotalManaPercentBonus,
        TotalDefenceBonus,
        (int)TotalDefencePercentBonus,
        TotalAttackBonus,
        (int)TotalAttackPercentBonus,
        TotalAttackSpeedBonus,
        (int)TotalAttackSpeedPercentBonus,
        TotalCriticalBonus,
        (int)TotalCriticalPercentBonus,
        TotalLifeStealBonus,
        (int)TotalLifeStealPercentBonus,
        TotalRangeBonus,
        (int)TotalRangePercentBonus,
        TotalElementalMasteryBonus,
        (int)TotalElementalMasteryPercentBonus,
        TotalSpeedBonus,
        (int)TotalSpeedPercentBonus,
        TotalCooldownBonus,
        (int)TotalCooldownPercentBonus,
        TotalKnockbackBonus,
        (int)TotalKnockbackPercentBonus,
        TotalRecoveryBonus,
        (int)TotalRecoveryPercentBonus,
        TotalEvadeBonus,
        (int)TotalEvadePercentBonus,
        TotalFortuneBonus,
        (int)TotalFortunePercentBonus
    };
}

public void SetStats(int[] stats)
{
    if (stats.Length >= 30) // Ensure we have the correct number of stats
    {
        TotalHealthBonus = stats[0];
        TotalHealthPercentBonus = stats[1];
        TotalManaBonus = stats[2];
        TotalManaPercentBonus = stats[3];
        TotalDefenceBonus = stats[4];
        TotalDefencePercentBonus = stats[5];
        TotalAttackBonus = stats[6];
        TotalAttackPercentBonus = stats[7];
        TotalAttackSpeedBonus = stats[8];
        TotalAttackSpeedPercentBonus = stats[9];
        TotalCriticalBonus = stats[10];
        TotalCriticalPercentBonus = stats[11];
        TotalLifeStealBonus = stats[12];
        TotalLifeStealPercentBonus = stats[13];
        TotalRangeBonus = stats[14];
        TotalRangePercentBonus = stats[15];
        TotalElementalMasteryBonus = stats[16];
        TotalElementalMasteryPercentBonus = stats[17];
        TotalSpeedBonus = stats[18];
        TotalSpeedPercentBonus = stats[19];
        TotalCooldownBonus = stats[20];
        TotalCooldownPercentBonus = stats[21];
        TotalKnockbackBonus = stats[22];
        TotalKnockbackPercentBonus = stats[23];
        TotalRecoveryBonus = stats[24];
        TotalRecoveryPercentBonus = stats[25];
        TotalEvadeBonus = stats[26];
        TotalEvadePercentBonus = stats[27];
        TotalFortuneBonus = stats[28];
        TotalFortunePercentBonus = stats[29];
    }
}

    protected override void OnValidate()
    {
        base.OnValidate();

        // Generate a random statID if it's not set
        if (string.IsNullOrEmpty(statID))
        {
            statID = GenerateRandomStatID();
            AssignRandomStatValues(); // Generate random stats only if statID was not set
        }
    }

    private string GenerateRandomStatID()
    {
        const string chars = "0123456789abcdefghijklmnopqrstuvwxyz";
        System.Text.StringBuilder sb = new System.Text.StringBuilder();
        System.Random random = new System.Random();
        for (int i = 0; i < 25; i++)
        {
            sb.Append(chars[random.Next(chars.Length)]);
        }
        return sb.ToString();
    }





/// </summary>

             private bool statsAssigned = false;

            public interface IEquippable
            {
                EquipmentType EquipmentType { get; }
            }


            private float GetRarityMultiplier()
            {
                switch (rarity)
                {
                    case Rarity.None: return 1f;
                    case Rarity.Common: return 1.2f;
                    case Rarity.Uncommon: return 1.5f;
                    case Rarity.Rare: return 1.8f;
                    case Rarity.Epic: return 2f;
                    case Rarity.Legendary: return 3.2f;
                    case Rarity.Mystical: return 4.3f;
                    default: return 1f;
                }
            }
    
         public override Item GetCopy()
        {
            EquippableItem newItem = Instantiate(this);

            if (!newItem.nameAssigned && possibleNames != null && possibleNames.Length > 0)
            {
                newItem.ItemName = possibleNames[Random.Range(0, possibleNames.Length)];
                newItem.nameAssigned = true;
            }

            newItem.AssignRandomRarity();
            newItem.AssignRandomStatValues();
            return newItem;
        }

    private void AssignRandomStatValues()
    {
        if (!statsAssigned)
        {
            TotalHealthBonus = Random.Range(MinHealthBonus, MaxHealthBonus + 1);
            TotalHealthPercentBonus = HealthPercentBonus + Random.Range(MinHealthPercentBonus, MaxHealthPercentBonus);

            TotalManaBonus = Random.Range(MinManaBonus, MaxManaBonus + 1);
            TotalManaPercentBonus = ManaPercentBonus + Random.Range(MinManaPercentBonus, MaxManaPercentBonus);

            TotalDefenceBonus = Random.Range(MinDefenceBonus, MaxDefenceBonus + 1);
            TotalDefencePercentBonus = DefencePercentBonus + Random.Range(MinDefencePercentBonus, MaxDefencePercentBonus);

            TotalAttackBonus = Random.Range(MinAttackBonus, MaxAttackBonus + 1);
            TotalAttackPercentBonus = AttackPercentBonus + Random.Range(MinAttackPercentBonus, MaxAttackPercentBonus);

            TotalAttackSpeedBonus = Random.Range(MinAttackSpeedBonus, MaxAttackSpeedBonus + 1);
            TotalAttackSpeedPercentBonus = AttackSpeedPercentBonus + Random.Range(MinAttackSpeedPercentBonus, MaxAttackSpeedPercentBonus);

            TotalCriticalBonus = Random.Range(MinCriticalBonus, MaxCriticalBonus + 1);
            TotalCriticalPercentBonus = CriticalPercentBonus + Random.Range(MinCriticalPercentBonus, MaxCriticalPercentBonus);

            TotalLifeStealBonus = Random.Range(MinLifeStealBonus, MaxLifeStealBonus + 1);
            TotalLifeStealPercentBonus = LifeStealPercentBonus + Random.Range(MinLifeStealPercentBonus, MaxLifeStealPercentBonus);

            TotalRangeBonus = Random.Range(MinRangeBonus, MaxRangeBonus + 1);
            TotalRangePercentBonus = RangePercentBonus + Random.Range(MinRangePercentBonus, MaxRangePercentBonus);

            TotalElementalMasteryBonus = Random.Range(MinElementalMasteryBonus, MaxElementalMasteryBonus + 1);
            TotalElementalMasteryPercentBonus = ElementalMasteryPercentBonus + Random.Range(MinElementalMasteryPercentBonus, MaxElementalMasteryPercentBonus);

            TotalSpeedBonus = Random.Range(MinSpeedBonus, MaxSpeedBonus + 1);
            TotalSpeedPercentBonus = SpeedPercentBonus + Random.Range(MinSpeedPercentBonus, MaxSpeedPercentBonus);

            TotalCooldownBonus = Random.Range(MinCooldownBonus, MaxCooldownBonus + 1);
            TotalCooldownPercentBonus = CooldownPercentBonus + Random.Range(MinCooldownPercentBonus, MaxCooldownPercentBonus);

            TotalKnockbackBonus = Random.Range(MinKnockbackBonus, MaxKnockbackBonus + 1);
            TotalKnockbackPercentBonus = KnockbackPercentBonus + Random.Range(MinKnockbackPercentBonus, MaxKnockbackPercentBonus);

            TotalRecoveryBonus = Random.Range(MinRecoveryBonus, MaxRecoveryBonus + 1);
            TotalRecoveryPercentBonus = RecoveryPercentBonus + Random.Range(MinRecoveryPercentBonus, MaxRecoveryPercentBonus);

            TotalEvadeBonus = Random.Range(MinEvadeBonus, MaxEvadeBonus + 1);
            TotalEvadePercentBonus = EvadePercentBonus + Random.Range(MinEvadePercentBonus, MaxEvadePercentBonus);

            TotalFortuneBonus = Random.Range(MinFortuneBonus, MaxFortuneBonus + 1);
            TotalFortunePercentBonus = FortunePercentBonus + Random.Range(MinFortunePercentBonus, MaxFortunePercentBonus);

            // Assign random values for ProjectileLifeSpan
            ProjectileLifeSpan = Mathf.Lerp(minProjectileLifeSpan, maxProjectileLifeSpan, Random.value);

            statsAssigned = true;
        }
    }

            private void AssignRandomRarity()
            {
                float randomValue = Random.Range(0f, 100f);

                if (randomValue <= rarityNoneChance)
                    rarity = Rarity.None;
                else if (randomValue <= rarityNoneChance + rarityCommonChance)
                    rarity = Rarity.Common;
                else if (randomValue <= rarityNoneChance + rarityCommonChance + rarityUncommonChance)
                    rarity = Rarity.Uncommon;
                else if (randomValue <= rarityNoneChance + rarityCommonChance + rarityUncommonChance + rarityRareChance)
                    rarity = Rarity.Rare;
                else if (randomValue <= rarityNoneChance + rarityCommonChance + rarityUncommonChance + rarityRareChance + rarityEpicChance)
                    rarity = Rarity.Epic;
                else if (randomValue <= rarityNoneChance + rarityCommonChance + rarityUncommonChance + rarityRareChance + rarityEpicChance + rarityLegendaryChance)
                    rarity = Rarity.Legendary;
                else
                    rarity = Rarity.Mystical;
            }

            public override void Destroy()
            {
                Destroy(this);
            }

    public void Equip(Character c)
    {
        if (c == null)
        {
            Debug.LogError("Character is null. Cannot equip item.");
            return;
        }

        c.Health.AddModifier(new StatModifier(TotalHealthBonus, StatModType.Flat, this));
        c.Health.AddModifier(new StatModifier(TotalHealthPercentBonus, StatModType.PercentAdd, this));

        c.Mana.AddModifier(new StatModifier(TotalManaBonus, StatModType.Flat, this));
        c.Mana.AddModifier(new StatModifier(TotalManaPercentBonus, StatModType.PercentAdd, this));

        c.Defence.AddModifier(new StatModifier(TotalDefenceBonus, StatModType.Flat, this));
        c.Defence.AddModifier(new StatModifier(TotalDefencePercentBonus, StatModType.PercentAdd, this));

        c.Attack.AddModifier(new StatModifier(TotalAttackBonus, StatModType.Flat, this));
        c.Attack.AddModifier(new StatModifier(TotalAttackPercentBonus, StatModType.PercentAdd, this));

        c.AttackSpeed.AddModifier(new StatModifier(TotalAttackSpeedBonus, StatModType.Flat, this));
        c.AttackSpeed.AddModifier(new StatModifier(TotalAttackSpeedPercentBonus, StatModType.PercentAdd, this));

        c.Critical.AddModifier(new StatModifier(TotalCriticalBonus, StatModType.Flat, this));
        c.Critical.AddModifier(new StatModifier(TotalCriticalPercentBonus, StatModType.PercentAdd, this));

        c.LifeSteal.AddModifier(new StatModifier(TotalLifeStealBonus, StatModType.Flat, this));
        c.LifeSteal.AddModifier(new StatModifier(TotalLifeStealPercentBonus, StatModType.PercentAdd, this));

        c.Range.AddModifier(new StatModifier(TotalRangeBonus, StatModType.Flat, this));
        c.Range.AddModifier(new StatModifier(TotalRangePercentBonus, StatModType.PercentAdd, this));

        c.ElementalMastery.AddModifier(new StatModifier(TotalElementalMasteryBonus, StatModType.Flat, this));
        c.ElementalMastery.AddModifier(new StatModifier(TotalElementalMasteryPercentBonus, StatModType.PercentAdd, this));

        c.Speed.AddModifier(new StatModifier(TotalSpeedBonus, StatModType.Flat, this));
        c.Speed.AddModifier(new StatModifier(TotalSpeedPercentBonus, StatModType.PercentAdd, this));

        c.Cooldown.AddModifier(new StatModifier(TotalCooldownBonus, StatModType.Flat, this));
        c.Cooldown.AddModifier(new StatModifier(TotalCooldownPercentBonus, StatModType.PercentAdd, this));

        c.Knockback.AddModifier(new StatModifier(TotalKnockbackBonus, StatModType.Flat, this));
        c.Knockback.AddModifier(new StatModifier(TotalKnockbackPercentBonus, StatModType.PercentAdd, this));

        c.Recovery.AddModifier(new StatModifier(TotalRecoveryBonus, StatModType.Flat, this));
        c.Recovery.AddModifier(new StatModifier(TotalRecoveryPercentBonus, StatModType.PercentAdd, this));

        c.Evade.AddModifier(new StatModifier(TotalEvadeBonus, StatModType.Flat, this));
        c.Evade.AddModifier(new StatModifier(TotalEvadePercentBonus, StatModType.PercentAdd, this));

        c.Fortune.AddModifier(new StatModifier(TotalFortuneBonus, StatModType.Flat, this));
        c.Fortune.AddModifier(new StatModifier(TotalFortunePercentBonus, StatModType.PercentAdd, this));
    }



    public void Unequip(Character c)
    {
        if (c != null)
        {
            c.Health.RemoveAllModifiersFromSource(this);
            c.Mana.RemoveAllModifiersFromSource(this);
            c.Defence.RemoveAllModifiersFromSource(this);
            c.Attack.RemoveAllModifiersFromSource(this);
            c.AttackSpeed.RemoveAllModifiersFromSource(this);
            c.Critical.RemoveAllModifiersFromSource(this);
            c.LifeSteal.RemoveAllModifiersFromSource(this);
            c.Range.RemoveAllModifiersFromSource(this);
            c.ElementalMastery.RemoveAllModifiersFromSource(this);
            c.Speed.RemoveAllModifiersFromSource(this);
            c.Cooldown.RemoveAllModifiersFromSource(this);
            c.Knockback.RemoveAllModifiersFromSource(this);
            c.Recovery.RemoveAllModifiersFromSource(this);
            c.Evade.RemoveAllModifiersFromSource(this);
            c.Fortune.RemoveAllModifiersFromSource(this);
        }
        else
        {
            Debug.LogError("Character reference is null when trying to unequip an item.");
        }
    }
        public float GetProjectileSpeed()
    {
        return projectileSpeed;
    }

            public override string GetItemType()
            {
                // Check if there are any equipment types
                if (EquipmentTypes != null && EquipmentTypes.Count > 0)
                {
                    // Randomly choose one equipment type
                    int randomIndex = Random.Range(0, EquipmentTypes.Count);
                    return EquipmentTypes[randomIndex].ToString();
                }
                else
                {
                    // Return a default value or handle the case where no equipment types are specified
                    return "No Equipment Type";
                }
            }

    public override string GetDescription()
    {
        sb.Length = 0;
        sb.AppendLine();  // Add a blank line
        sb.AppendLine($"<b>Rarity</b>: {rarity}");
        sb.AppendLine();  // Add a blank line

        DisplayStatWithGeneratedValue("<b>Health</b>", TotalHealthBonus * 2, TotalHealthPercentBonus * 2, true);
        DisplayStatWithGeneratedValue("<b>Mana</b>", TotalManaBonus * 2, TotalManaPercentBonus * 2, true);
        DisplayStatWithGeneratedValue("<b>Defence</b>", TotalDefenceBonus * 2, TotalDefencePercentBonus * 2, true);
        DisplayStatWithGeneratedValue("<b>Attack</b>", TotalAttackBonus * 2, TotalAttackPercentBonus * 2, true);
        DisplayStatWithGeneratedValue("<b>Attack Speed</b>", TotalAttackSpeedBonus * 2, TotalAttackSpeedPercentBonus * 2, true);
        DisplayStatWithGeneratedValue("<b>Critical</b>", TotalCriticalBonus * 2, TotalCriticalPercentBonus * 2, true);
        DisplayStatWithGeneratedValue("<b>Life Steal</b>", TotalLifeStealBonus * 2, TotalLifeStealPercentBonus * 2, true);
        DisplayStatWithGeneratedValue("<b>Range</b>", TotalRangeBonus * 2, TotalRangePercentBonus * 2, true);
        DisplayStatWithGeneratedValue("<b>Elemental Mastery</b>", TotalElementalMasteryBonus * 2, TotalElementalMasteryPercentBonus * 2, true);
        DisplayStatWithGeneratedValue("<b>Speed</b>", TotalSpeedBonus * 2, TotalSpeedPercentBonus * 2, true);
        DisplayStatWithGeneratedValue("<b>Cooldown</b>", TotalCooldownBonus * 2, TotalCooldownPercentBonus * 2, true);
        DisplayStatWithGeneratedValue("<b>Knockback</b>", TotalKnockbackBonus * 2, TotalKnockbackPercentBonus * 2, true);
        DisplayStatWithGeneratedValue("<b>Recovery</b>", TotalRecoveryBonus * 2, TotalRecoveryPercentBonus * 2, true);
        DisplayStatWithGeneratedValue("<b>Evade</b>", TotalEvadeBonus * 2, TotalEvadePercentBonus * 2, true);
        DisplayStatWithGeneratedValue("<b>Fortune</b>", TotalFortuneBonus * 2, TotalFortunePercentBonus * 2, true);

        sb.AppendLine();  // Add a blank line
        sb.AppendLine($"<color=white><b>Sell:</b></color> " +
                    $"<color=yellow>{SellPriceGold}g</color> " +
                    $"<color=lightgrey>{SellPriceSilver}s</color> " +
                    $"<color=orange>{SellPriceCopper}c</color>");

        return sb.ToString();
    }

            private void DisplayStatWithGeneratedValue(string statName, int baseValue, float percentBaseValue, bool isPercentage = false, EquippableItem otherItem = null)
        {
            // Round the percentBaseValue to three decimal places
            string formattedPercentValue = percentBaseValue.ToString("0.###");

            if (baseValue != 0 || percentBaseValue != 0)
            {
                // Set the default color to white
                string colorCode = "white";

                // Compare the stat with the compared value and change the color to red if it's less
                if (otherItem != null && CompareTo(otherItem) < 0)
                {
                    colorCode = "red";
                }

                // Use rich text to set the color of the displayed stat
                sb.AppendLine($"<color={colorCode}>{statName}: {baseValue} + {formattedPercentValue}{(isPercentage ? "%" : "")}</color>");
            }
    }

           public int CompareTo(EquippableItem other)
{
    // Compare based on the stats of the items
    int result = 0;

    // Compare HealthBonus
    result = this.TotalHealthBonus.CompareTo(other.TotalHealthBonus);
    if (result != 0) return result;

    // Compare ManaBonus
    result = this.TotalManaBonus.CompareTo(other.TotalManaBonus);
    if (result != 0) return result;

    // Compare DefenceBonus
    result = this.TotalDefenceBonus.CompareTo(other.TotalDefenceBonus);
    if (result != 0) return result;

    // Compare AttackBonus
    result = this.TotalAttackBonus.CompareTo(other.TotalAttackBonus);
    if (result != 0) return result;

    // Compare AttackSpeedBonus
    result = this.TotalAttackSpeedBonus.CompareTo(other.TotalAttackSpeedBonus);
    if (result != 0) return result;

    // Compare CriticalBonus
    result = this.TotalCriticalBonus.CompareTo(other.TotalCriticalBonus);
    if (result != 0) return result;

    // Compare LifeStealBonus
    result = this.TotalLifeStealBonus.CompareTo(other.TotalLifeStealBonus);
    if (result != 0) return result;

    // Compare RangeBonus
    result = this.TotalRangeBonus.CompareTo(other.TotalRangeBonus);
    if (result != 0) return result;

    // Compare ElementalMasteryBonus
    result = this.TotalElementalMasteryBonus.CompareTo(other.TotalElementalMasteryBonus);
    if (result != 0) return result;

    // Compare SpeedBonus
    result = this.TotalSpeedBonus.CompareTo(other.TotalSpeedBonus);
    if (result != 0) return result;

    // Compare CooldownBonus
    result = this.TotalCooldownBonus.CompareTo(other.TotalCooldownBonus);
    if (result != 0) return result;

    // Compare KnockbackBonus
    result = this.TotalKnockbackBonus.CompareTo(other.TotalKnockbackBonus);
    if (result != 0) return result;

    // Compare RecoveryBonus
    result = this.TotalRecoveryBonus.CompareTo(other.TotalRecoveryBonus);
    if (result != 0) return result;

    // Compare EvadeBonus
    result = this.TotalEvadeBonus.CompareTo(other.TotalEvadeBonus);
    if (result != 0) return result;

    // Compare FortuneBonus
    result = this.TotalFortuneBonus.CompareTo(other.TotalFortuneBonus);
    if (result != 0) return result;

    // If all stats are equal, compare based on percentages
    result = ComparePercentBonuses(other);

    return result;
}

private int ComparePercentBonuses(EquippableItem other)
{
    // Compare based on the percentage bonuses of the items
    int result = 0;

    // Compare AttackPercentBonus
    result = this.TotalAttackPercentBonus.CompareTo(other.TotalAttackPercentBonus);
    if (result != 0) return result;

    // Compare AttackSpeedPercentBonus
    result = this.TotalAttackSpeedPercentBonus.CompareTo(other.TotalAttackSpeedPercentBonus);
    if (result != 0) return result;

    // Compare DefencePercentBonus
    result = this.TotalDefencePercentBonus.CompareTo(other.TotalDefencePercentBonus);
    if (result != 0) return result;

    // Compare CriticalPercentBonus
    result = this.TotalCriticalPercentBonus.CompareTo(other.TotalCriticalPercentBonus);
    if (result != 0) return result;

    // Compare SpeedPercentBonus
    result = this.TotalSpeedPercentBonus.CompareTo(other.TotalSpeedPercentBonus);
    if (result != 0) return result;

    // Compare HealthPercentBonus
    result = this.TotalHealthPercentBonus.CompareTo(other.TotalHealthPercentBonus);
    if (result != 0) return result;

    // Compare ManaPercentBonus
    result = this.TotalManaPercentBonus.CompareTo(other.TotalManaPercentBonus);
    if (result != 0) return result;

    // Compare RecoveryPercentBonus
    result = this.TotalRecoveryPercentBonus.CompareTo(other.TotalRecoveryPercentBonus);
    if (result != 0) return result;

    // Compare EvadePercentBonus
    result = this.TotalEvadePercentBonus.CompareTo(other.TotalEvadePercentBonus);
    if (result != 0) return result;

    // If all percentage bonuses are equal, return 0
    return result;
}


            // Overriding the BuyPrice and SellPrice properties to include rarity multiplier
            public override int BuyPriceCopper
            {
                get { return Mathf.RoundToInt(base.BuyPriceCopper * GetRarityMultiplier()); }
            }

            public override int BuyPriceSilver
            {
                get { return Mathf.RoundToInt(base.BuyPriceSilver * GetRarityMultiplier()); }
            }

            public override int BuyPriceGold
            {
                get { return Mathf.RoundToInt(base.BuyPriceGold * GetRarityMultiplier()); }
            }

            public override int SellPriceCopper
            {
                get { return Mathf.RoundToInt(base.SellPriceCopper * GetRarityMultiplier()); }
            }

            public override int SellPriceSilver
            {
                get { return Mathf.RoundToInt(base.SellPriceSilver * GetRarityMultiplier()); }
            }

            public override int SellPriceGold
            {
                get { return Mathf.RoundToInt(base.SellPriceGold * GetRarityMultiplier()); }
            }
        }


can you fix this error 
UnassignedReferenceException: The variable projectilePrefab of EquippableItem has not been assigned.
You probably need to assign the projectilePrefab variable of the EquippableItem script in the inspector.
UnityEngine.Object.get_name () (at <56073df97ede4f769c2cc45d546d986d>:0)
WeaponTypeDetector.AssignWeaponProperties (EquippableItem item) (at Assets/Game Systems Mechanics/Player Attack System/WeaponTypeDetector.cs:61)
WeaponTypeDetector.UpdateWeaponType (BaseItemSlot slot) (at Assets/Game Systems Mechanics/Player Attack System/WeaponTypeDetector.cs:45)
WeaponTypeDetector.ManualUpdateWeaponType () (at Assets/Game Systems Mechanics/Player Attack System/WeaponTypeDetector.cs:75)
Character.Equip (EquippableItem item) (at Assets/Game Characters/Player/Player Scritps/Character.cs:384)
Character.InventoryRightClick (BaseItemSlot itemSlot) (at Assets/Game Characters/Player/Player Scritps/Character.cs:131)
ItemContainer.EventHelper (BaseItemSlot itemSlot, System.Action`1[T] action) (at Assets/Game Systems Mechanics/Inventory System/Items/ItemContainer.cs:39)
ItemContainer.<Awake>b__23_2 (BaseItemSlot slot) (at Assets/Game Systems Mechanics/Inventory System/Items/ItemContainer.cs:28)
BaseItemSlot.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) (at Assets/Game Systems Mechanics/Inventory System/BaseItemSlot.cs:136)
UnityEngine.EventSystems.ExecuteEvents.Execute (UnityEngine.EventSystems.IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at ./Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/ExecuteEvents.cs:57)
UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction`1[T1] functor) (at ./Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/ExecuteEvents.cs:272)
UnityEngine.EventSystems.EventSystem:Update() (at ./Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/EventSystem.cs:530)

i dont want for equippable item to have to use a prefab for projectile for it to have some form of booling or something to stop this error from happening