using Decimation.Content;
using Decimation.Lib.Items;
using Terraria;
using Terraria.ModLoader;

namespace Decimation.Lib.Util
{
    public static class PlayerUtils
    {
        public static DecimationPlayer GetModPlayer(this Player player)
        {
            return player.GetModPlayer<DecimationPlayer>();
        }

        public static void EquipAccessory(this Player player, DecimationAccessory accessory)
        {
            player.GetModPlayer().EquippedAccessories.Add(accessory.item.type);
        }

        public static bool HasEquippedAccessory(this Player player, int accessoryType)
        {
            return player.GetModPlayer().EquippedAccessories.Contains(accessoryType);
        }

        public static bool HasEquippedAccessory(this ModPlayer modPlayer, int accessoryType)
        {
            return modPlayer.player.GetModPlayer().EquippedAccessories.Contains(accessoryType);
        }

        public static bool HasEquippedAmulet(this Player player, int amuletType)
        {
            return player.GetModPlayer().AmuletSlotItem.type == amuletType;
        }
    }
}