public void ModifyItem(CraftingButton.CraftingOptionType optionType)
    {
        if (currentItem == null)
        {
            return;
        }

        int cost = 0;

        switch (optionType)
        {
        case CraftingButton.CraftingOptionType.REROLL_AFFIX:
            currentItem.RerollAffixesAtRarity(modifiers);
            currentItem.RemoveAllAffixLocks();
            cost = (int)(-AffixedItem.GetRerollAffixCost(currentItem) * costModifier);
            break;

        case CraftingButton.CraftingOptionType.REROLL_VALUES:
            currentItem.RerollValues();
            currentItem.RemoveAllAffixLocks();
            cost = -AffixedItem.GetRerollValuesCost(currentItem);
            break;

        case CraftingButton.CraftingOptionType.ADD_AFFIX:
            currentItem.AddRandomAffix(modifiers);
            cost = (int)(-AffixedItem.GetAddAffixCost(currentItem) * costModifier);
            break;

        case CraftingButton.CraftingOptionType.REMOVE_AFFIX:
            cost = -AffixedItem.GetRemoveAffixCost(currentItem);
            currentItem.RemoveRandomAffix();
            currentItem.RemoveAllAffixLocks();
            break;

        case CraftingButton.CraftingOptionType.UPGRADE_RARITY:
            cost = (int)(-AffixedItem.GetUpgradeCost(currentItem) * costModifier);
            currentItem.UpgradeRarity();
            currentItem.AddRandomAffix(modifiers);
            break;

        case CraftingButton.CraftingOptionType.TO_NORMAL:
            cost = -AffixedItem.GetToNormalCost(currentItem);
            currentItem.SetRarityToNormal();
            currentItem.RemoveAllAffixLocks();
            break;

        case CraftingButton.CraftingOptionType.LOCK_AFFIX:
            LockAffixOnClick();
            return;
        }
        GameManager.Instance.PlayerStats.ModifyItemFragments(cost);
        SaveManager.CurrentSave.SavePlayerData();
        SaveManager.CurrentSave.SaveEquipmentData(currentItem as Equipment);
        SaveManager.Save();

        UpdatePanels();
    }
    public void UpdateButton(AffixedItem currentItem)
    {
        var button = GetComponent <UIKeyButton>();

        if (!button.initialized)
        {
            button.Initialize();
        }

        GetComponentInChildren <TextMeshProUGUI>().text = button.localizedString;

        if (currentItem == null)
        {
            DisableButton(button);
        }
        else
        {
            int   itemFragments = GameManager.Instance.PlayerStats.ItemFragments;
            float cost;
            switch (optionType)
            {
            case CraftingOptionType.REROLL_AFFIX when currentItem.Rarity != RarityType.NORMAL && currentItem.Rarity != RarityType.UNIQUE:
                cost = AffixedItem.GetRerollAffixCost(currentItem) * UIManager.Instance.ItemCraftingPanel.costModifier;
                break;

            case CraftingOptionType.REROLL_VALUES when currentItem.Rarity != RarityType.NORMAL:
                cost = AffixedItem.GetRerollValuesCost(currentItem);
                break;

            case CraftingOptionType.ADD_AFFIX when currentItem.GetRandomOpenAffixType() != null:
                cost = AffixedItem.GetAddAffixCost(currentItem) * UIManager.Instance.ItemCraftingPanel.costModifier;

                break;

            case CraftingOptionType.REMOVE_AFFIX when currentItem.GetRandomAffix() != null:
                cost = AffixedItem.GetRemoveAffixCost(currentItem);

                break;

            case CraftingOptionType.UPGRADE_RARITY when currentItem.Rarity != RarityType.UNIQUE && currentItem.Rarity != RarityType.EPIC:
                cost = AffixedItem.GetUpgradeCost(currentItem) * UIManager.Instance.ItemCraftingPanel.costModifier;
                break;

            case CraftingOptionType.TO_NORMAL when currentItem.Rarity != RarityType.NORMAL && currentItem.Rarity != RarityType.UNIQUE:
                cost = AffixedItem.GetToNormalCost(currentItem);
                break;

            case CraftingOptionType.LOCK_AFFIX when currentItem.GetRandomAffix() != null || currentItem.Rarity == RarityType.UNIQUE:
                cost = AffixedItem.GetLockCost(currentItem);

                break;

            default:
                DisableButton(button);
                return;
            }

            cost = (int)(cost);

            costText = cost.ToString("N0") + " <sprite=10>";

            if (cost != 0)
            {
                GetComponent <Button>().interactable = cost <= itemFragments;
                if (!GetComponent <Button>().interactable)
                {
                    costText = "<color=#aa0000>" + costText + "</color>";
                }
                GetComponentInChildren <TextMeshProUGUI>().text += "\n" + costText;
            }
        }
    }