@@ -17,6 +17,7 @@ local SEASON_NAMES = {
1717};
1818local CATALYST_MARKUP = CreateAtlasMarkup (' CreationCatalyst-32x32' , 18 , 18 )
1919local UPGRADE_MARKUP = CreateAtlasMarkup (' CovenantSanctum-Upgrade-Icon-Available' , 18 , 18 )
20+ local WARBAND_MARKUP = CreateAtlasMarkup (' warbands-icon' , 18 , 18 )
2021local OK_MARKUP = " |TInterface\\ RaidFrame\\ ReadyCheck-Ready:0|t"
2122local NOK_MARKUP = " |TInterface\\ RaidFrame\\ ReadyCheck-NotReady:0|t"
2223local OTHER_MARKUP = CreateAtlasMarkup (' QuestRepeatableTurnin' , 14 , 16 )
@@ -408,6 +409,9 @@ function UI:BuildUI()
408409 if result .requiresCatalyse then
409410 text = CATALYST_MARKUP .. ' ' .. text ;
410411 end
412+ if result .distance > 0 then
413+ text = WARBAND_MARKUP .. ' ' .. text ;
414+ end
411415 GameTooltip :AddDoubleLine (text , result .location , 1 , 1 , 1 , 1 , 1 , 1 );
412416 end
413417 else
@@ -602,32 +606,31 @@ function UI:OnUpdate()
602606 end
603607 if results and next (results ) then
604608 table.sort (results , function (a , b )
605- if a .sortPriority ~= b .sortPriority then
606- return a .sortPriority > b .sortPriority ;
609+ -- Order as Catalyse, then Upgrade, then CatalyseUpgrade.
610+ if a .requiresUpgrade ~= b .requiresUpgrade then
611+ return not a .requiresUpgrade and b .requiresUpgrade ;
612+ end
613+ if a .requiresCatalyse ~= b .requiresCatalyse then
614+ return not a .requiresCatalyse and b .requiresCatalyse ;
615+ end
616+ if a .distance ~= b .distance then
617+ return a .distance < b .distance ;
607618 end
608619 if a .location ~= b .location then
609620 return a .location > b .location ;
610621 end
611622 return a .itemLink > b .itemLink ;
612623 end );
613- local catalystRequired = true ;
614- local upgradeRequired = true ;
615- for _ , result in pairs (results ) do
616- if not result .requiresUpgrade and not result .requiresCatalyseUpgrade then
617- upgradeRequired = false ;
618- catalystRequired = true ;
619- break ;
620- end
621- if not result .requiresCatalyse and not result .requiresCatalyseUpgrade then
622- catalystRequired = false ;
623- end
624- end
625- if upgradeRequired then
624+ local firstResult = results [1 ];
625+ if firstResult .requiresUpgrade then
626626 text = ' ' .. UPGRADE_MARKUP .. text ;
627627 end
628- if catalystRequired then
628+ if firstResult . requiresCatalyse then
629629 text = ' ' .. CATALYST_MARKUP .. text ;
630630 end
631+ if firstResult .distance > 0 then
632+ text = ' ' .. WARBAND_MARKUP .. text ;
633+ end
631634 end
632635 if text == other then
633636 column .Text :AdjustPointsOffset (- 3 , 0 );
@@ -735,18 +738,19 @@ local function checkResult(scanResult, classID, seasonID)
735738 local tumResult = TUM :IsAppearanceMissing (scanResult .itemLink , classID );
736739
737740 local location ;
738- local sortPriority = 0 ;
741+ local distance = 0 ;
739742 if scanResult .source .character then
740743 local classColor = C_ClassColor .GetClassColor (scanClassFile )
744+ local classFile = C_CreatureInfo .GetClassInfo (classID ).classFile
741745 location = string.format (
742746 ' %s: %s' ,
743747 classColor :WrapTextInColorCode (scanResult .source .character ),
744748 scanResult .source .container
745749 );
746- sortPriority = scanResult . source . character == playerFullName and 1000 or 10 ;
750+ distance = scanClassFile ~= classFile and 1000 or 0 ;
747751 elseif scanResult .source .warband then
748752 location = CreateAtlasMarkup (' warbands-icon' , 17 , 13 ) .. ' Warband bank' ;
749- sortPriority = 100 + scanResult .source .warband ;
753+ distance = 100 + scanResult .source .warband ;
750754 end
751755
752756 local info , upgradeInfo ;
@@ -758,10 +762,9 @@ local function checkResult(scanResult, classID, seasonID)
758762 knownFromOtherItem = tumResult .catalystAppearanceLearnedFromOtherItem ,
759763 requiresCatalyse = true ,
760764 requiresUpgrade = false ,
761- requiresCatalyseUpgrade = false ,
762765 itemLink = scanResult .itemLink ,
763766 location = location ,
764- sortPriority = sortPriority ,
767+ distance = distance ,
765768 };
766769 end
767770
@@ -773,10 +776,9 @@ local function checkResult(scanResult, classID, seasonID)
773776 knownFromOtherItem = (isItemCatalysed and tumResult .upgradeAppearanceLearnedFromOtherItem ) or tumResult .catalystUpgradeAppearanceLearnedFromOtherItem ,
774777 requiresCatalyse = not isItemCatalysed ,
775778 requiresUpgrade = true ,
776- requiresCatalyseUpgrade = not isItemCatalysed ,
777779 itemLink = scanResult .itemLink ,
778780 location = location ,
779- sortPriority = sortPriority ,
781+ distance = distance ,
780782 };
781783 end
782784
0 commit comments