private static bool WeaponIsIdeal(WAEItem weapon)
    {
        if (weapon == null || !ItemSkillsDictionary.ContainsKey(weapon.ItemSubType))
        {
            return(false);
        }

        if (ClassSpec == ClassSpec.RogueAssassination &&
            ItemSkillsDictionary[weapon.ItemSubType] != SkillLine.Daggers)
        {
            return(false);
        }

        if ((ClassSpec == ClassSpec.WarriorArms && KnowTitansGrip) &&
            (ItemSkillsDictionary[weapon.ItemSubType] == SkillLine.TwoHandedSwords ||
             ItemSkillsDictionary[weapon.ItemSubType] == SkillLine.TwoHandedAxes ||
             ItemSkillsDictionary[weapon.ItemSubType] == SkillLine.TwoHandedMaces))
        {
            return(true);
        }

        if (AutoEquipSettings.CurrentSettings.EquipShields &&
            ItemSkillsDictionary[weapon.ItemSubType] == SkillLine.Shield)
        {
            return(true);
        }

        if (AutoEquipSettings.CurrentSettings.EquipTwoHanders &&
            TwoHanders.Contains(ItemSkillsDictionary[weapon.ItemSubType]))
        {
            return(true);
        }

        if (AutoEquipSettings.CurrentSettings.EquipOneHanders &&
            ItemSkillsDictionary[weapon.ItemSubType] != SkillLine.Shield &&
            OneHanders.Contains(ItemSkillsDictionary[weapon.ItemSubType]))
        {
            return(true);
        }

        return(false);
    }
    public static void AutoEquipWeapons()
    {
        //Logger.LogDebug($"************ Weapon scan debug *****************");
        bool currentWeaponsAreIdeal = WeaponIsIdeal(MainHand.Item) && WeaponIsIdeal(OffHand.Item) ||
                                      WeaponIsIdeal(MainHand.Item) && OffHand.Item == null && AutoEquipSettings.CurrentSettings.EquipTwoHanders && !AutoEquipSettings.CurrentSettings.EquipOneHanders;
        float unIdealDebuff = 0.6f;

        float currentMainHandScore = MainHand.Item != null ? MainHand.Item.WeightScore : 0f;
        float currentOffHandScore  = OffHand.Item != null?OffHand.Item.GetOffHandWeightScore() : 0f;

        float currentCombinedWeaponsScore = currentMainHandScore + currentOffHandScore;

        if (!currentWeaponsAreIdeal)
        {
            currentCombinedWeaponsScore = currentCombinedWeaponsScore * unIdealDebuff;
        }

        // Equip restricted to what we allow
        List <WAEItem> listAllMainHandWeapons = GetEquipableWeaponsFromBags(MainHand);

        if (MainHand.Item != null)
        {
            listAllMainHandWeapons.Add(MainHand.Item);
        }
        List <WAEItem> listAllOffHandWeapons = GetEquipableWeaponsFromBags(OffHand);

        if (OffHand.Item != null)
        {
            listAllOffHandWeapons.Add(OffHand.Item);
        }

        listAllMainHandWeapons = listAllMainHandWeapons.OrderByDescending(w => w.WeightScore).ToList();
        listAllOffHandWeapons  = listAllOffHandWeapons.OrderByDescending(w => w.WeightScore).ToList();

        // Get ideal Two Hand
        WAEItem ideal2H = listAllMainHandWeapons
                          .Where(w => TwoHanders.Contains(ItemSkillsDictionary[w.ItemSubType]))
                          .Where(weapon => WeaponIsIdeal(weapon))
                          .FirstOrDefault();

        // Get second choice Two Hand
        WAEItem secondChoice2H = listAllMainHandWeapons
                                 .Where(w => TwoHanders.Contains(ItemSkillsDictionary[w.ItemSubType]))
                                 .Where(w => w != ideal2H)
                                 .FirstOrDefault();

        // Get ideal Main hand
        WAEItem idealMainhand = listAllMainHandWeapons
                                .Where(w => OneHanders.Contains(ItemSkillsDictionary[w.ItemSubType]) ||
                                       SuitableForTitansGrips(w))
                                .Where(weapon => WeaponIsIdeal(weapon) || MainHand.Item == null)
                                .FirstOrDefault();

        // Get Second choice Main hand
        WAEItem secondChoiceMainhand = listAllMainHandWeapons
                                       .Where(w => OneHanders.Contains(ItemSkillsDictionary[w.ItemSubType]) || SuitableForTitansGrips(w))
                                       .Where(w => w != idealMainhand)
                                       .FirstOrDefault();

        // Swap if both ideal are One Hand/Main Hand
        if (idealMainhand != null &&
            secondChoiceMainhand != null &&
            secondChoiceMainhand.WeightScore > idealMainhand.WeightScore &&
            idealMainhand.ItemLink != secondChoiceMainhand.ItemLink &&
            idealMainhand.ItemEquipLoc == "INVTYPE_WEAPON" &&
            secondChoiceMainhand.ItemEquipLoc == "INVTYPE_WEAPONMAINHAND")
        {
            WAEItem first = idealMainhand;
            idealMainhand        = secondChoiceMainhand;
            secondChoiceMainhand = first;
        }

        // Get ideal OffHand
        WAEItem idealOffHand = listAllOffHandWeapons
                               //.Where(w => w.ItemSubType == "Miscellaneous" || OneHanders.Contains(ItemSkillsDictionary[w.ItemSubType]))
                               .Where(w => WeaponIsIdeal(w) || OffHand.Item == null || !WeaponIsIdeal(OffHand.Item))
                               .Where(w => DualWield.KnownSpell ||
                                      ItemSkillsDictionary[w.ItemSubType] == SkillLine.Shield ||
                                      !DualWield.KnownSpell && w.ItemSubType == "Miscellaneous" ||
                                      SuitableForTitansGrips(w))
                               .Where(w => w != idealMainhand && w != ideal2H)
                               .FirstOrDefault();

        // Get second choice OffHand
        WAEItem secondChoiceOffhand = listAllOffHandWeapons
                                      .Where(w => w.ItemSubType == "Miscellaneous" ||
                                             (DualWield.KnownSpell && OneHanders.Contains(ItemSkillsDictionary[w.ItemSubType])) ||
                                             SuitableForTitansGrips(w))
                                      .Where(w => DualWield.KnownSpell ||
                                             ItemSkillsDictionary[w.ItemSubType] == SkillLine.Shield ||
                                             !DualWield.KnownSpell && w.ItemSubType == "Miscellaneous")
                                      .Where(w => w != secondChoiceMainhand)
                                      .FirstOrDefault();

        float scoreIdealMainHand = idealMainhand == null ? 0 : idealMainhand.WeightScore;
        float scoreIdealOffhand  = idealOffHand == null ? 0 : idealOffHand.GetOffHandWeightScore();

        float scoreSecondChoiceMainHand = secondChoiceMainhand == null ? 0 : secondChoiceMainhand.WeightScore;
        float scoreSecondOffhand        = secondChoiceOffhand == null ? 0 : secondChoiceOffhand.GetOffHandWeightScore();

        float finalScore2hands    = ideal2H == null ? 0 : ideal2H.WeightScore;
        float finalScoreDualWield = scoreIdealMainHand + scoreIdealOffhand;

        float finalScoreSecondDualWield    = (scoreSecondChoiceMainHand + scoreSecondOffhand) * unIdealDebuff;
        float finalScoreSecondChoice2hands = secondChoice2H == null ? 0 : secondChoice2H.WeightScore * unIdealDebuff;

        /*
         * if (AutoEquipSettings.CurrentSettings.LogItemInfo)
         * {
         *  Logger.LogDebug($"Current is preffered : {currentWeaponsAreIdeal} ({currentCombinedWeaponsScore})");
         *  Logger.LogDebug($"2H 1 {ideal2H?.Name} ({finalScore2hands}) -- 2H 2 {secondChoice2H?.Name} ({finalScoreSecondChoice2hands})");
         *  Logger.LogDebug($"1H 1 {idealMainhand?.Name} ({scoreIdealMainHand}) -- 1H 2 {secondChoiceMainhand?.Name} ({scoreSecondChoiceMainHand})");
         *  Logger.LogDebug($"OFFHAND 1 {idealOffHand?.Name} ({scoreIdealOffhand}) -- OFFHAND 2 {secondChoiceOffhand?.Name} ({scoreSecondOffhand})");
         *  Logger.LogDebug($"COMBINED 1 {idealMainhand?.Name} + {idealOffHand?.Name} ({finalScoreDualWield}) -- COMBINED 2 {secondChoiceMainhand?.Name} + {secondChoiceOffhand?.Name} ({finalScoreSecondDualWield})");
         * }
         */

        if (finalScoreDualWield > currentCombinedWeaponsScore ||
            finalScore2hands > currentCombinedWeaponsScore)
        {
            if (finalScore2hands > finalScoreDualWield)
            {
                ideal2H.EquipSelectRoll(MainHand.InventorySlotID, "Better overall score");
                return;
            }
            else
            {
                if (idealMainhand != null)
                {
                    idealMainhand?.EquipSelectRoll(MainHand.InventorySlotID, "Better overall score");
                    idealOffHand?.EquipSelectRoll(OffHand.InventorySlotID, "Better overall score");
                    return;
                }
            }
        }

        if (finalScoreSecondDualWield > currentCombinedWeaponsScore ||
            finalScoreSecondChoice2hands > currentCombinedWeaponsScore)
        {
            if (finalScoreSecondChoice2hands > finalScoreSecondDualWield)
            {
                secondChoice2H.EquipSelectRoll(MainHand.InventorySlotID, "Better overall score");
                return;
            }
            else
            {
                if (secondChoiceMainhand != null)
                {
                    secondChoiceMainhand?.EquipSelectRoll(MainHand.InventorySlotID, "Better overall score");
                    secondChoiceOffhand?.EquipSelectRoll(OffHand.InventorySlotID, "Better overall score");
                    return;
                }
            }
        }
    }