<commit_before>local SWS_ADDON_NAME, StatWeightScore = ...;
local TooltipModule = StatWeightScore:NewModule(SWS_ADDON_NAME.."Tooltip");

local ScoreModule;
local ScanningTooltipModule;

local L;
local Utils;

local UniqueGroups = {
    ["Solium Band of Endurance"] = 1,
    ["Solium Band of Wisdom"] = 1,
    ["Solium Band of Dexterity"] = 1,
    ["Solium Band of Mending"] = 1,
    ["Solium Band of Might"] = 1,
    ["Timeless Solium Band of the Archmage"] = 1,
    ["Timeless Solium Band of the Bulwark"] = 1,
    ["Timeless Solium Band of Brutality"] = 1,
    ["Timeless Solium Band of Lifegiving"] = 1,
    ["Timeless Solium Band of the Assassin"] = 1,
    ["Spellbound Solium Band of Fatal Strikes"] = 1,
    ["Spellbound Solium Band of the Kirin-Tor"] = 1,
    ["Spellbound Solium Band of Sorcerous Strength"] = 1,
    ["Spellbound Solium Band of the Immortal Spirit"] = 1,
    ["Spellbound Solium Band of Sorcerous Invincibility"] = 1,
};

local SlotMap = {
    INVTYPE_AMMO = {0},
    INVTYPE_HEAD = {1},
    INVTYPE_NECK = {2},
    INVTYPE_SHOULDER = {3},
    INVTYPE_BODY = {4},
    INVTYPE_CHEST = {5},
    INVTYPE_ROBE = {5},
    INVTYPE_WAIST = {6},
    INVTYPE_LEGS = {7},
    INVTYPE_FEET = {8},
    INVTYPE_WRIST = {9},
    INVTYPE_HAND = {10},
    INVTYPE_FINGER = {11,12},
    INVTYPE_TRINKET = {13,14},
    INVTYPE_CLOAK = {15},
    INVTYPE_WEAPON = {16,17},
    INVTYPE_SHIELD = {17},
    INVTYPE_2HWEAPON = {16},
    INVTYPE_WEAPONMAINHAND = {16},
    INVTYPE_WEAPONOFFHAND = {17},
    INVTYPE_HOLDABLE = {17},
    INVTYPE_RANGED = {16,18},
    INVTYPE_THROWN = {18},
    INVTYPE_RANGEDRIGHT = {16,18},
    INVTYPE_RELIC = {18},
    INVTYPE_TABARD = {19},
};

local function FormatScore(score, diff)
    local str = string.format("%.2f", score);
    if(diff ~= 0) then
        local color;
        local sign;

        if(diff < 0) then
            color = "|cFFFF0000";
            sign = "";
        else
            color = "|cFF00FF00+";
            sign = "+";
        end

        str = str.." ("..color..string.format("%.2f ", diff)..((score == diff) and "+inf%" or string.format("%s%.f%%", sign, (score / (score - diff) - 1) * 100)).."|r)";
    end

    return str;
end

local function AreUniquelyExclusive(item1, item2)
    if(item1 == item2) then
        return true;
    end

    local item1Group = UniqueGroups[item1];
    local item2Group = UniqueGroups[item2];

    if(item1Group and item2Group and item1Group == item2Group) then
        return true;
    end

    return false;
end

local function GetItemLinkInfo(itemLink)
    if(not itemLink) then
        return nil;
    end

    local _, _, _, _, id, _, gem1, _, _, _, _, _, _, _ =
    string.find(itemLink,
        "|?c?f?f?(%x*)|?H?([^:]*):?(%d+):?(%d*):?(%d*):?(%d*):?(%d*):?(%d*):?(%-?%d*):?(%-?%d*):?(%d*):?(%d*):?(%-?%d*)|?h?%[?([^%[%]]*)%]?|?h?|?r?");

    return id, gem1;
end

function TooltipModule:OnInitialize()
    ScoreModule = StatWeightScore:GetModule(SWS_ADDON_NAME.."Score");
    ScanningTooltipModule = StatWeightScore:GetModule(SWS_ADDON_NAME.."ScanningTooltip");
    L = StatWeightScore.L;
    Utils = StatWeightScore.Utils;

    local addToPrimaryTooltip = function(tooltip)
        self:AddToTooltip(tooltip, true);
    end

    local addToComapreTooltip = function(tooltip)
        self:AddToTooltip(tooltip, false);
    end

    ItemRefTooltip:HookScript("OnTooltipSetItem", addToPrimaryTooltip);

    ItemRefShoppingTooltip1:HookScript("OnTooltipSetItem", addToComapreTooltip);
    ItemRefShoppingTooltip2:HookScript("OnTooltipSetItem", addToComapreTooltip);
<commit_msg>fixed an issue where item of same id, same ilvl, but one with socket and one without wasn't displaying comparison when one of those items was equipped (yet again)<commit_after>local SWS_ADDON_NAME, StatWeightScore = ...;
local TooltipModule = StatWeightScore:NewModule(SWS_ADDON_NAME.."Tooltip");

local ScoreModule;
local ScanningTooltipModule;

local L;
local Utils;

local UniqueGroups = {
    ["Solium Band of Endurance"] = 1,
    ["Solium Band of Wisdom"] = 1,
    ["Solium Band of Dexterity"] = 1,
    ["Solium Band of Mending"] = 1,
    ["Solium Band of Might"] = 1,
    ["Timeless Solium Band of the Archmage"] = 1,
    ["Timeless Solium Band of the Bulwark"] = 1,
    ["Timeless Solium Band of Brutality"] = 1,
    ["Timeless Solium Band of Lifegiving"] = 1,
    ["Timeless Solium Band of the Assassin"] = 1,
    ["Spellbound Solium Band of Fatal Strikes"] = 1,
    ["Spellbound Solium Band of the Kirin-Tor"] = 1,
    ["Spellbound Solium Band of Sorcerous Strength"] = 1,
    ["Spellbound Solium Band of the Immortal Spirit"] = 1,
    ["Spellbound Solium Band of Sorcerous Invincibility"] = 1,
};

local SlotMap = {
    INVTYPE_AMMO = {0},
    INVTYPE_HEAD = {1},
    INVTYPE_NECK = {2},
    INVTYPE_SHOULDER = {3},
    INVTYPE_BODY = {4},
    INVTYPE_CHEST = {5},
    INVTYPE_ROBE = {5},
    INVTYPE_WAIST = {6},
    INVTYPE_LEGS = {7},
    INVTYPE_FEET = {8},
    INVTYPE_WRIST = {9},
    INVTYPE_HAND = {10},
    INVTYPE_FINGER = {11,12},
    INVTYPE_TRINKET = {13,14},
    INVTYPE_CLOAK = {15},
    INVTYPE_WEAPON = {16,17},
    INVTYPE_SHIELD = {17},
    INVTYPE_2HWEAPON = {16},
    INVTYPE_WEAPONMAINHAND = {16},
    INVTYPE_WEAPONOFFHAND = {17},
    INVTYPE_HOLDABLE = {17},
    INVTYPE_RANGED = {16,18},
    INVTYPE_THROWN = {18},
    INVTYPE_RANGEDRIGHT = {16,18},
    INVTYPE_RELIC = {18},
    INVTYPE_TABARD = {19},
};

local function FormatScore(score, diff)
    local str = string.format("%.2f", score);
    if(diff ~= 0) then
        local color;
        local sign;

        if(diff < 0) then
            color = "|cFFFF0000";
            sign = "";
        else
            color = "|cFF00FF00+";
            sign = "+";
        end

        str = str.." ("..color..string.format("%.2f ", diff)..((score == diff) and "+inf%" or string.format("%s%.f%%", sign, (score / (score - diff) - 1) * 100)).."|r)";
    end

    return str;
end

local function AreUniquelyExclusive(item1, item2)
    if(item1 == item2) then
        return true;
    end

    local item1Group = UniqueGroups[item1];
    local item2Group = UniqueGroups[item2];

    if(item1Group and item2Group and item1Group == item2Group) then
        return true;
    end

    return false;
end

local function GetItemLinkInfo(itemLink)
    if(not itemLink) then
        return nil;
    end

    local _, _, _, _, id, _, gem1, _, _, _, _, _, _, _ =
    string.find(itemLink,
        "|?c?f?f?(%x*)|?H?([^:]*):?(%d+):?(%d*):?(%d*):?(%d*):?(%d*):?(%d*):?(%-?%d*):?(%-?%d*):?(%d*):?(%d*):?(%-?%d*)|?h?%[?([^%[%]]*)%]?|?h?|?r?");

    return id, tonumber(gem1);
end

function TooltipModule:OnInitialize()
    ScoreModule = StatWeightScore:GetModule(SWS_ADDON_NAME.."Score");
    ScanningTooltipModule = StatWeightScore:GetModule(SWS_ADDON_NAME.."ScanningTooltip");
    L = StatWeightScore.L;
    Utils = StatWeightScore.Utils;

    local addToPrimaryTooltip = function(tooltip)
        self:AddToTooltip(tooltip, true);
    end

    local addToComapreTooltip = function(tooltip)
        self:AddToTooltip(tooltip, false);
    end

    ItemRefTooltip:HookScript("OnTooltipSetItem", addToPrimaryTooltip);

    ItemRefShoppingTooltip1:HookScript("OnTooltipSetItem", addToComapreTooltip);
    ItemRefShoppingTooltip2:HookScript("OnTooltipSetItem", addToComapreTooltip);

{'fraction_non_alphanumeric': 0.15454917473741644, 'fraction_numerical': 0.027008593643432, 'mean_word_length': 3.270238788584741, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1725389', 'n_tokens_mistral': 2823, 'n_tokens_neox': 2706, 'n_words': 596}