@@ -2631,6 +2631,9 @@ function ItemsTabClass:CorruptDisplayItem(modType)
26312631 local currentModType = modType or " Corrupted"
26322632 local controls = { }
26332633 local implicitList = { }
2634+ local shownExplicits = {}
2635+ local explicitOffset = 0
2636+ local corruptedRanges = {}
26342637 local sourceList = { " Corrupted" , " Scourge" }
26352638 local sortList , sortTransforms = buildModSortList ()
26362639 local function buildImplicitList (modType )
@@ -2719,7 +2722,7 @@ function ItemsTabClass:CorruptDisplayItem(modType)
27192722 end
27202723 end
27212724 local function applySort (stat )
2722- if not controls .implicit then
2725+ if not controls .implicit1 then
27232726 return
27242727 end
27252728 local slotName = self .displayItem :GetPrimarySlot ()
@@ -2732,15 +2735,15 @@ function ItemsTabClass:CorruptDisplayItem(modType)
27322735 sortModType (" ScourgeDownside" , stat , calcFunc , slotName , useFullDPS )
27332736 end
27342737 if currentModType == " Corrupted" then
2735- buildList (controls .implicit , controls .implicit2 , currentModType )
2736- buildList (controls .implicit2 , controls .implicit , currentModType )
2738+ buildList (controls .implicit1 , controls .implicit2 , currentModType )
2739+ buildList (controls .implicit2 , controls .implicit1 , currentModType )
27372740 else
2738- buildList (controls .implicit , controls .implicit2 , " ScourgeUpside" )
2739- buildList (controls .implicit2 , controls .implicit , " ScourgeUpside" )
2741+ buildList (controls .implicit1 , controls .implicit2 , " ScourgeUpside" )
2742+ buildList (controls .implicit2 , controls .implicit1 , " ScourgeUpside" )
27402743 buildList (controls .implicit3 , controls .implicit4 , " ScourgeDownside" )
27412744 buildList (controls .implicit4 , controls .implicit3 , " ScourgeDownside" )
27422745 end
2743- controls .implicit :UpdateSearch ()
2746+ controls .implicit1 :UpdateSearch ()
27442747 controls .implicit2 :UpdateSearch ()
27452748 if controls .implicit3 then controls .implicit3 :UpdateSearch () end
27462749 if controls .implicit4 then controls .implicit4 :UpdateSearch () end
@@ -2750,7 +2753,7 @@ function ItemsTabClass:CorruptDisplayItem(modType)
27502753 item .id = self .displayItem .id
27512754 item .corrupted = true
27522755 local newImplicit = { }
2753- for _ , control in ipairs { controls .implicit , controls .implicit2 , controls .implicit3 , controls .implicit4 } do
2756+ for _ , control in ipairs { controls .implicit1 , controls .implicit2 , controls .implicit3 , controls .implicit4 } do
27542757 if control .selIndex > 1 then
27552758 local mod = control .list [control .selIndex ].mod
27562759 for _ , modLine in ipairs (mod ) do
@@ -2772,140 +2775,204 @@ function ItemsTabClass:CorruptDisplayItem(modType)
27722775 item :BuildAndParseRaw ()
27732776 return item
27742777 end
2775- controls .sourceLabel = new (" LabelControl" ):LabelControl ({" TOPRIGHT" ,nil ," TOPLEFT" }, {95 , 20 , 0 , 16 }, " ^7Source:" )
2776- controls .source = new (" DropDownControl" ):DropDownControl ({" TOPLEFT" ,nil ," TOPLEFT" }, {100 , 20 , 150 , 18 }, sourceList , function (index , value )
2777- if value == " Scourge" then
2778- currentModType = " ScourgeUpside"
2779- buildImplicitList (" ScourgeUpside" )
2780- buildImplicitList (" ScourgeDownside" )
2781- controls .implicit .shown = true
2782- controls .implicitLabel .shown = true
2783- controls .implicit2 .shown = true
2784- controls .implicit2Label .shown = true
2785- controls .implicit3 .shown = true
2786- controls .implicit3Label .shown = true
2787- controls .implicitCannotBeChangedLabel .shown = false
2788- main .popups [1 ].height = 147
2789- controls .close .y = 117
2790- controls .save .y = 117
2791- if self .displayItem .rarity == " UNIQUE" or self .displayItem .rarity == " RELIC" then
2792- controls .implicit4Label .shown = true
2793- controls .implicit4 .shown = true
2794- main .popups [1 ].height = 165
2795- controls .close .y = 135
2796- controls .save .y = 135
2797- end
2798- controls .implicit2 .y = 85
2799- buildList (controls .implicit3 , controls .implicit4 , " ScourgeDownside" )
2800- buildList (controls .implicit4 , controls .implicit3 , " ScourgeDownside" )
2801- else
2802- currentModType = value
2803- controls .implicit .shown = not self .displayItem .implicitsCannotBeChanged
2804- controls .implicitLabel .shown = not self .displayItem .implicitsCannotBeChanged
2805- controls .implicit2 .shown = not self .displayItem .implicitsCannotBeChanged
2806- controls .implicit2Label .shown = not self .displayItem .implicitsCannotBeChanged
2807- controls .implicit3Label .shown = false
2808- controls .implicit3 .shown = false
2809- controls .implicit4Label .shown = false
2810- controls .implicit4 .shown = false
2811- controls .implicitCannotBeChangedLabel .shown = self .displayItem .implicitsCannotBeChanged
2812- controls .implicit2 .y = 65
2813- main .popups [1 ].height = 129
2814- controls .close .y = 99
2815- controls .save .y = 99
2816- end
2817- if controls .sort then
2818- applySort (controls .sort .list [controls .sort .selIndex ].stat , true )
2819- else
2820- buildList (controls .implicit , controls .implicit2 , currentModType )
2821- buildList (controls .implicit2 , controls .implicit , currentModType )
2822- end
2823- controls .implicit :SetSel (1 )
2824- controls .implicit2 :SetSel (1 )
2825- controls .implicit3 :SetSel (1 )
2826- controls .implicit4 :SetSel (1 )
2827- end )
2778+ if self .displayItem .rarity == " UNIQUE" or self .displayItem .rarity == " RELIC" then
2779+ local item = new (" Item" ):Item (self .displayItem :BuildRaw ())
2780+ local offset = 20
2781+ for i , mod in ipairs (item .explicitModLines ) do
2782+ local variantIds = {}
2783+ for id , _ in pairs (item .explicitModLines [i ].variantList or {}) do
2784+ t_insert (variantIds , id )
2785+ end
2786+ local selectedVariant
2787+ for _ , variantId in ipairs (variantIds ) do
2788+ if item .variant == variantId or item .variantAlt == variantId or item .variantAlt2 == variantId or item .variantAlt3 == variantId or item .variantAlt4 == variantId or item .variantAlt5 == variantId then
2789+ selectedVariant = true
2790+ end
2791+ end
2792+ if # variantIds > 0 and selectedVariant or # variantIds == 0 then
2793+ local label = " "
2794+ controls [" rollRangeValue" .. i ] = new (" LabelControl" ):LabelControl ({ " TOPLEFT" , nil , " TOPLEFT" },
2795+ { 10 , 10 + offset , 200 , 16 }, " ^71.00" )
2796+ controls [" rollRangeSlider" .. i ] = new (" SliderControl" ):SliderControl (
2797+ { " LEFT" , controls [" rollRangeValue" .. i ], " RIGHT" }, { 5 , 0 , 80 , 18 }, function (val )
2798+ corruptedRanges [i ] = 0.78 + round (0.44 * val , 2 ) -- 0.78-1.22
2799+ controls [" rollRangeValue" .. i ].label = " ^7" .. string.format (" %.2f" , corruptedRanges [i ])
2800+ local label = " "
2801+ for i , line in ipairs (main :WrapString (" ^7" .. itemLib .applyRange (mod .line , mod .range or main .defaultItemAffixQuality , mod .valueScalar or 1 , corruptedRanges [i ]), 16 , 430 )) do
2802+ if i == 1 then
2803+ label = line
2804+ else
2805+ label = label .. " \n " .. line
2806+ end
2807+ end
2808+ controls [" rollRangeLabel" .. i ].label = label
2809+ end )
2810+ corruptedRanges [i ] = mod .corruptedRange or 1
2811+ controls [" rollRangeSlider" .. i ].val = ((corruptedRanges [i ]) - 0.78 ) / 0.44
2812+ controls [" rollRangeValue" .. i ].label = " ^7" .. string.format (" %.2f" , corruptedRanges [i ])
2813+ for i , line in ipairs (main :WrapString (" ^7" .. itemLib .applyRange (mod .line , mod .range or main .defaultItemAffixQuality , mod .valueScalar or 1 , corruptedRanges [i ]), 16 , 430 )) do
2814+ if i == 1 then
2815+ label = line
2816+ else
2817+ offset = offset + 16
2818+ label = label .. " \n " .. line
2819+ end
2820+ end
2821+ controls [" rollRangeLabel" .. i ] = new (" LabelControl" ):LabelControl (
2822+ { " LEFT" , controls [" rollRangeSlider" .. i ], " RIGHT" },
2823+ { 5 , 0 , 200 , 16 }, label )
2824+ -- hide them by default as they are a secondary window
2825+ controls [" rollRangeLabel" .. i ].shown = false
2826+ controls [" rollRangeSlider" .. i ].shown = false
2827+ controls [" rollRangeValue" .. i ].shown = false
2828+ offset = offset + 20
2829+ t_insert (shownExplicits , i )
2830+ end
2831+ end
2832+ explicitOffset = offset
2833+ end
2834+ controls .implicits = new (" ButtonControl" ):ButtonControl ({ " TOPLEFT" , nil , " TOPLEFT" }, { 5 , 5 , 80 , 20 }, " Implicits" ,
2835+ function ()
2836+ local implicitNum = currentModType == " Corrupted" and 2 or 4
2837+ for i = 1 , implicitNum do
2838+ controls [" implicit" .. i ].shown = true
2839+ controls [" implicit" .. i .. " Label" ].shown = true
2840+ end
2841+ for _ , i in ipairs (shownExplicits ) do
2842+ controls [" rollRangeLabel" .. i ].shown = false
2843+ controls [" rollRangeSlider" .. i ].shown = false
2844+ controls [" rollRangeValue" .. i ].shown = false
2845+ end
2846+ controls .source .shown = true
2847+ controls .sourceLabel .shown = true
2848+ controls .sort .shown = true
2849+ controls .sortLabel .shown = true
2850+ main .popups [1 ].height = 103 + 20 * implicitNum
2851+ end )
2852+ controls .implicits .shown = function ()
2853+ return self .displayItem .rarity == " UNIQUE" or self .displayItem .rarity == " RELIC"
2854+ end
2855+ controls .rolls = new (" ButtonControl" ):ButtonControl ({ " LEFT" , controls .implicits , " RIGHT" }, { 5 , 0 , 80 , 20 },
2856+ " Roll Ranges" ,
2857+ function ()
2858+ for i = 1 , 4 do
2859+ controls [" implicit" .. i ].shown = false
2860+ controls [" implicit" .. i .. " Label" ].shown = false
2861+ end
2862+ for _ , i in ipairs (shownExplicits ) do
2863+ controls [" rollRangeLabel" .. i ].shown = true
2864+ controls [" rollRangeSlider" .. i ].shown = true
2865+ controls [" rollRangeValue" .. i ].shown = true
2866+ end
2867+ controls .source .shown = false
2868+ controls .sourceLabel .shown = false
2869+ controls .sort .shown = false
2870+ controls .sortLabel .shown = false
2871+ main .popups [1 ].height = 55 + explicitOffset
2872+ end )
2873+ controls .rolls .shown = function ()
2874+ return self .displayItem .rarity == " UNIQUE" or self .displayItem .rarity == " RELIC"
2875+ end
2876+ controls .sourceLabel = new (" LabelControl" ):LabelControl ({ " TOPRIGHT" , nil , " TOPLEFT" }, { 95 , 30 , 0 , 16 },
2877+ " ^7Source:" )
2878+ controls .source = new (" DropDownControl" ):DropDownControl ({ " TOPLEFT" , nil , " TOPLEFT" }, { 100 , 30 , 150 , 18 },
2879+ sourceList , function (index , value )
2880+ if value == " Scourge" then
2881+ currentModType = " ScourgeUpside"
2882+ buildImplicitList (" ScourgeUpside" )
2883+ buildImplicitList (" ScourgeDownside" )
2884+ controls .implicit1 .shown = true
2885+ controls .implicit1Label .shown = true
2886+ controls .implicit2 .shown = true
2887+ controls .implicit2Label .shown = true
2888+ controls .implicit3 .shown = true
2889+ controls .implicit3Label .shown = true
2890+ controls .implicitCannotBeChangedLabel .shown = false
2891+ main .popups [1 ].height = 103 + 20 * 3
2892+ if self .displayItem .rarity == " UNIQUE" or self .displayItem .rarity == " RELIC" then
2893+ controls .implicit4Label .shown = true
2894+ controls .implicit4 .shown = true
2895+ main .popups [1 ].height = 103 + 20 * 4
2896+ end
2897+ buildList (controls .implicit3 , controls .implicit4 , " ScourgeDownside" )
2898+ buildList (controls .implicit4 , controls .implicit3 , " ScourgeDownside" )
2899+ else
2900+ currentModType = value
2901+ controls .implicit1 .shown = not self .displayItem .implicitsCannotBeChanged
2902+ controls .implicit1Label .shown = not self .displayItem .implicitsCannotBeChanged
2903+ controls .implicit2 .shown = not self .displayItem .implicitsCannotBeChanged
2904+ controls .implicit2Label .shown = not self .displayItem .implicitsCannotBeChanged
2905+ controls .implicit3Label .shown = false
2906+ controls .implicit3 .shown = false
2907+ controls .implicit4Label .shown = false
2908+ controls .implicit4 .shown = false
2909+ controls .implicitCannotBeChangedLabel .shown = self .displayItem .implicitsCannotBeChanged
2910+ main .popups [1 ].height = 103 + 20 * 2
2911+ end
2912+ if controls .sort then
2913+ applySort (controls .sort .list [controls .sort .selIndex ].stat , true )
2914+ else
2915+ buildList (controls .implicit1 , controls .implicit2 , currentModType )
2916+ buildList (controls .implicit2 , controls .implicit1 , currentModType )
2917+ end
2918+ controls .implicit1 :SetSel (1 )
2919+ controls .implicit2 :SetSel (1 )
2920+ controls .implicit3 :SetSel (1 )
2921+ controls .implicit4 :SetSel (1 )
2922+ end )
28282923 controls .source .enabled = # sourceList > 1
28292924 controls .sortLabel = new (" LabelControl" ):LabelControl ({" TOPRIGHT" ,nil ," TOPLEFT" }, {350 , 20 , 0 , 16 }, " ^7Sort by:" )
28302925 controls .sort = new (" DropDownControl" ):DropDownControl ({" TOPLEFT" ,nil ," TOPLEFT" }, {355 , 20 , 240 , 18 }, sortList , function (index , value )
28312926 applySort (value .stat )
28322927 end )
2833- controls .implicitLabel = new (" LabelControl" ):LabelControl ({" TOPRIGHT" ,nil ," TOPLEFT" }, {75 , 45 , 0 , 16 }, " ^7Implicit #1:" )
2834- controls .implicit = new (" DropDownControl" ):DropDownControl ({" TOPLEFT" ,nil ," TOPLEFT" }, {80 , 45 , 440 , 18 }, nil , function ()
2835- buildList (controls .implicit2 , controls .implicit , currentModType )
2836- end )
2837- controls .implicit .tooltipFunc = function (tooltip , mode , index , value )
2838- tooltip :Clear ()
2839- if mode ~= " OUT" and value and value .mod then
2840- for _ , line in ipairs (value .mod ) do
2841- tooltip :AddLine (16 , " ^7" .. line )
2928+ local implicitRowSize = 20
2929+ local implicitYPos = 35
2930+ controls .implicitCannotBeChangedLabel = new (" LabelControl" ):LabelControl ({ " TOPLEFT" , nil , " TOPLEFT" }, { 20 , implicitYPos + implicitRowSize , 0 , 20 }, " ^7This Items Implicits Cannot Be Changed" )
2931+ controls .implicitCannotBeChangedLabel .shown = self .displayItem .implicitsCannotBeChanged
2932+ for i = 1 , 4 do
2933+ local controlName = " implicit" .. i
2934+ controls [controlName .. " Label" ] = new (" LabelControl" ):LabelControl ({ " TOPRIGHT" , nil , " TOPLEFT" }, { 75 , implicitYPos + i * implicitRowSize , 0 , 16 },
2935+ string.format (" ^7Implicit #%d:" , i ))
2936+ controls [controlName ] = new (" DropDownControl" ):DropDownControl ({ " TOPLEFT" , nil , " TOPLEFT" }, { 80 , implicitYPos + i * implicitRowSize , 440 , 18 }, nil )
2937+ controls [controlName ].tooltipFunc = function (tooltip , mode , index , value )
2938+ tooltip :Clear ()
2939+ if mode ~= " OUT" and value and value .mod then
2940+ for _ , line in ipairs (value .mod ) do
2941+ tooltip :AddLine (16 , " ^7" .. line )
2942+ end
2943+ self :AddModComparisonTooltip (tooltip , value .mod )
28422944 end
2843- self :AddModComparisonTooltip (tooltip , value .mod )
28442945 end
2845- end
2846- controls .implicit .shown = not self .displayItem .implicitsCannotBeChanged
2847- controls .implicitLabel .shown = not self .displayItem .implicitsCannotBeChanged
2848- controls .implicit2Label = new (" LabelControl" ):LabelControl ({" TOPRIGHT" ,nil ," TOPLEFT" }, {75 , 65 , 0 , 16 }, " ^7Implicit #2:" )
2849- controls .implicit2 = new (" DropDownControl" ):DropDownControl ({" TOPLEFT" ,nil ," TOPLEFT" }, {80 , 65 , 440 , 18 }, nil , function ()
2850- buildList (controls .implicit , controls .implicit2 , currentModType )
2851- end )
2852- controls .implicit2 .tooltipFunc = function (tooltip , mode , index , value )
2853- tooltip :Clear ()
2854- if mode ~= " OUT" and value and value .mod then
2855- for _ , line in ipairs (value .mod ) do
2856- tooltip :AddLine (16 , " ^7" .. line )
2857- end
2858- self :AddModComparisonTooltip (tooltip , value .mod )
2946+ local shownVal
2947+ if i < 3 then
2948+ shownVal = not self .displayItem .implicitsCannotBeChanged
2949+ else
2950+ shownVal = false
28592951 end
2952+ controls [controlName ].shown = shownVal
2953+ controls [controlName .. " Label" ].shown = shownVal
28602954 end
2861- controls .implicit2 .shown = not self .displayItem .implicitsCannotBeChanged
2862- controls .implicit2Label .shown = not self .displayItem .implicitsCannotBeChanged
2863- controls .implicit3Label = new (" LabelControl" ):LabelControl ({" TOPRIGHT" ,nil ," TOPLEFT" }, {75 , 85 , 0 , 16 }, " ^7Implicit #3:" )
2864- controls .implicit3 = new (" DropDownControl" ):DropDownControl ({" TOPLEFT" ,nil ," TOPLEFT" }, {80 , 65 , 440 , 18 }, nil , function ()
2865- buildList (controls .implicit4 , controls .implicit3 , " ScourgeDownside" )
2866- end )
2867- controls .implicit3 .tooltipFunc = function (tooltip , mode , index , value )
2868- tooltip :Clear ()
2869- if mode ~= " OUT" and value and value .mod then
2870- for _ , line in ipairs (value .mod ) do
2871- tooltip :AddLine (16 , " ^7" .. line )
2872- end
2873- self :AddModComparisonTooltip (tooltip , value .mod )
2955+ for i = 1 , 4 do
2956+ controls [" implicit" .. i ].selFunc = function ()
2957+ local otherIdx = (i % 2 == 0 ) and (i - 1 ) or (i + 1 )
2958+ buildList (controls [" implicit" .. i ], controls [" implicit" .. i + otherIdx ], i < 3 and currentModType or " ScourgeDownside" )
28742959 end
2875- end
2876- controls .implicit3Label .shown = false
2877- controls .implicit3 .shown = false
2878- controls .implicit4Label = new (" LabelControl" ):LabelControl ({" TOPRIGHT" ,nil ," TOPLEFT" }, {75 , 105 , 0 , 16 }, " ^7Implicit #4:" )
2879- controls .implicit4 = new (" DropDownControl" ):DropDownControl ({" TOPLEFT" ,nil ," TOPLEFT" }, {80 , 105 , 440 , 18 }, nil , function ()
2880- buildList (controls .implicit3 , controls .implicit4 , " ScourgeDownside" )
2881- end )
2882- controls .implicit4 .tooltipFunc = function (tooltip , mode , index , value )
2883- tooltip :Clear ()
2884- if mode ~= " OUT" and value and value .mod then
2885- for _ , line in ipairs (value .mod ) do
2886- tooltip :AddLine (16 , " ^7" .. line )
2887- end
2888- self :AddModComparisonTooltip (tooltip , value .mod )
2960+ if i < 3 then
2961+ controls [" implicit" .. i ].selFunc ()
28892962 end
28902963 end
2891- controls .implicit4Label .shown = false
2892- controls .implicit4 .shown = false
2893- controls .implicitCannotBeChangedLabel = new (" LabelControl" ):LabelControl ({" TOPLEFT" ,nil ," TOPLEFT" }, {20 , 45 , 0 , 20 }, " ^7This Items Implicits Cannot Be Changed" )
2894- controls .implicitCannotBeChangedLabel .shown = self .displayItem .implicitsCannotBeChanged
2895- buildList (controls .implicit , controls .implicit2 , currentModType )
2896- buildList (controls .implicit2 , controls .implicit , currentModType )
2897- controls .save = new (" ButtonControl" ):ButtonControl (nil , {- 45 , 99 , 80 , 20 }, modType , function ()
2964+ controls .save = new (" ButtonControl" ):ButtonControl ({ " BOTTOM" , nil , " BOTTOM" }, { - 45 , - 4 , 80 , 20 }, modType , function ()
28982965 self :SetDisplayItem (corruptItem ())
28992966 main :ClosePopup ()
29002967 end )
29012968 controls .save .tooltipFunc = function (tooltip )
29022969 tooltip :Clear ()
29032970 self :AddItemTooltip (tooltip , corruptItem (), nil , true )
29042971 end
2905- controls .close = new (" ButtonControl" ):ButtonControl (nil , { 45 , 99 , 80 , 20 }, " Cancel" , function ()
2972+ controls .close = new (" ButtonControl" ):ButtonControl ({ " BOTTOM " , nil , " BOTTOM " }, { 45 , - 4 , 80 , 20 }, " Cancel" , function ()
29062973 main :ClosePopup ()
29072974 end )
2908- main :OpenPopup (605 , 129 , modType .. " Item" , controls )
2975+ main :OpenPopup (605 , 103 + 20 * 2 , modType .. " Item" , controls )
29092976end
29102977
29112978-- Opens the custom modifier popup
0 commit comments