@@ -2748,28 +2748,37 @@ function ItemsTabClass:CorruptDisplayItem(modType)
27482748 if controls .implicit3 then controls .implicit3 :UpdateSearch () end
27492749 if controls .implicit4 then controls .implicit4 :UpdateSearch () end
27502750 end
2751- local function corruptItem ()
2751+ local function corruptItem (addingImplicits )
27522752 local item = new (" Item" ):Item (self .displayItem :BuildRaw ())
27532753 item .id = self .displayItem .id
27542754 item .corrupted = true
2755- local newImplicit = { }
2756- for _ , control in ipairs { controls .implicit1 , controls .implicit2 , controls .implicit3 , controls .implicit4 } do
2757- if control .selIndex > 1 then
2758- local mod = control .list [control .selIndex ].mod
2759- for _ , modLine in ipairs (mod ) do
2760- modLine = (currentModType == " ScourgeUpside" and " {scourge}" or " " ) .. modLine
2761- if mod .modTags [1 ] then
2762- t_insert (newImplicit , { line = " {tags:" .. table.concat (mod .modTags , " ," ) .. " }" .. modLine })
2763- else
2764- t_insert (newImplicit , { line = modLine })
2755+ -- either add implicits or roll ranges. if in the future it is possible
2756+ -- to double corrupt an item, this needs to be changed to not remove
2757+ -- implicits, like in pob2
2758+ if addingImplicits then
2759+ local newImplicit = {}
2760+ for _ , control in ipairs { controls .implicit1 , controls .implicit2 , controls .implicit3 , controls .implicit4 } do
2761+ if control .selIndex > 1 then
2762+ local mod = control .list [control .selIndex ].mod
2763+ for _ , modLine in ipairs (mod ) do
2764+ modLine = (currentModType == " ScourgeUpside" and " {scourge}" or " " ) .. modLine
2765+ if mod .modTags [1 ] then
2766+ t_insert (newImplicit , { line = " {tags:" .. table.concat (mod .modTags , " ," ) .. " }" .. modLine })
2767+ else
2768+ t_insert (newImplicit , { line = modLine })
2769+ end
27652770 end
27662771 end
27672772 end
2768- end
2769- if # newImplicit > 0 then
2770- wipeTable (currentModType == " Corrupted" and item .implicitModLines or item .scourgeModLines )
2771- for i , implicit in ipairs (newImplicit ) do
2772- t_insert (currentModType == " Corrupted" and item .implicitModLines or item .scourgeModLines , i , implicit )
2773+ if # newImplicit > 0 then
2774+ wipeTable (currentModType == " Corrupted" and item .implicitModLines or item .scourgeModLines )
2775+ for i , implicit in ipairs (newImplicit ) do
2776+ t_insert (currentModType == " Corrupted" and item .implicitModLines or item .scourgeModLines , i , implicit )
2777+ end
2778+ end
2779+ else
2780+ for i , modLine in ipairs (item .explicitModLines ) do
2781+ if corruptedRanges [i ] ~= 1 then modLine .corruptedRange = corruptedRanges [i ] end
27732782 end
27742783 end
27752784 item :BuildAndParseRaw ()
@@ -2964,12 +2973,12 @@ function ItemsTabClass:CorruptDisplayItem(modType)
29642973 end
29652974 end
29662975 controls .save = new (" ButtonControl" ):ButtonControl ({ " BOTTOM" , nil , " BOTTOM" }, { - 45 , - 4 , 80 , 20 }, modType , function ()
2967- self :SetDisplayItem (corruptItem ())
2976+ self :SetDisplayItem (corruptItem (controls . implicit1 . shown ))
29682977 main :ClosePopup ()
29692978 end )
29702979 controls .save .tooltipFunc = function (tooltip )
29712980 tooltip :Clear ()
2972- self :AddItemTooltip (tooltip , corruptItem (), nil , true )
2981+ self :AddItemTooltip (tooltip , corruptItem (controls . implicit1 . shown ), nil , false )
29732982 end
29742983 controls .close = new (" ButtonControl" ):ButtonControl ({ " BOTTOM" , nil , " BOTTOM" }, { 45 , - 4 , 80 , 20 }, " Cancel" , function ()
29752984 main :ClosePopup ()
0 commit comments