@@ -54,8 +54,8 @@ for _, entry in pairs(data.flavourText) do
5454end
5555
5656local function isAnointable (item )
57- return (item .canBeAnointed or item .base .type == " Amulet" ) and not item . sanctified
58- and not item .corrupted and not item .mirrored
57+ return (item .canBeAnointed or item .base .type == " Amulet" )
58+ -- and not item.sanctified and not item.corrupted and not item.mirrored
5959end
6060
6161local function buildModSortList ()
@@ -916,7 +916,7 @@ holding Shift will put it in the second.]])
916916 if not self .displayItem or not self .displayItem .rangeLineList [1 ] then
917917 return 0
918918 end
919- if main .showAllItemAffixes and self .displayItem .rarity == " UNIQUE" then
919+ if main .showAllItemAffixes and ( self .displayItem .rarity == " UNIQUE" or self . displayItem . rarity == " RELIC " ) then
920920 local count = # self .displayItem .rangeLineList
921921 return count * 22 + 4
922922 else
@@ -927,7 +927,8 @@ holding Shift will put it in the second.]])
927927 self .controls .displayItemRangeSlider .val = self .displayItem .rangeLineList [index ].range
928928 end )
929929 self .controls .displayItemRangeLine .shown = function ()
930- return self .displayItem and self .displayItem .rangeLineList [1 ] ~= nil and not (main .showAllItemAffixes and self .displayItem .rarity == " UNIQUE" )
930+ return self .displayItem and self .displayItem .rangeLineList [1 ] ~= nil and
931+ not (main .showAllItemAffixes and (self .displayItem .rarity == " UNIQUE" or self .displayItem .rarity == " RELIC" ))
931932 end
932933 self .controls .displayItemRangeSlider = new (" SliderControl" , {" LEFT" ,self .controls .displayItemRangeLine ," RIGHT" }, {8 , 0 , 100 , 18 }, function (val )
933934 self .displayItem .rangeLineList [self .controls .displayItemRangeLine .selIndex ].range = val
@@ -956,7 +957,9 @@ holding Shift will put it in the second.]])
956957 return " "
957958 end )
958959 self .controls [" displayItemStackedRangeSlider" .. i ].shown = function ()
959- return main .showAllItemAffixes and self .displayItem and self .displayItem .rarity == " UNIQUE" and self .displayItem .rangeLineList [i ] ~= nil
960+ return main .showAllItemAffixes and self .displayItem and
961+ (self .displayItem .rarity == " UNIQUE" or self .displayItem .rarity == " RELIC" ) and
962+ self .displayItem .rangeLineList [i ] ~= nil
960963 end
961964
962965 self .controls [" displayItemStackedRangeLine" .. i ].shown = function ()
@@ -2008,6 +2011,7 @@ function ItemsTabClass:UpdateDisplayItemRangeLines()
20082011 end
20092012end
20102013
2014+ --- @param line string
20112015local function checkLineForAllocates (line , nodes )
20122016 if nodes and string.match (line , " Allocates" ) then
20132017 local nodeId = tonumber (string.match (line , " %d+" ))
@@ -2465,15 +2469,17 @@ end
24652469function ItemsTabClass :CorruptDisplayItem () -- todo implement vaal orb new outcomes this code is for poe 1
24662470 local controls = { }
24672471 local enchantList = { }
2468- local enchantNum = 1
2472+ local enchantNum = 2
24692473 local shownExplicits = {}
24702474 local explicitOffset = 0
24712475 local corruptedRanges = {}
24722476 local currentModType = " Corrupted"
24732477 local sourceList = { " Corrupted" }
24742478 local sortList , sortTransforms = buildModSortList ()
2479+
24752480 if self .displayItem .base .type == " Helmet" then
24762481 t_insert (sourceList , " Glimpse of Chaos" )
2482+ enchantNum = 8
24772483 end
24782484 local function buildEnchantList (modType )
24792485 if enchantList [modType ] then
@@ -2528,6 +2534,17 @@ function ItemsTabClass:CorruptDisplayItem() -- todo implement vaal orb new outco
25282534 end
25292535 end
25302536 end
2537+
2538+ local temp = {}
2539+ -- currently enchants are always either corruptions or anoints, so we
2540+ -- can just save the anoints
2541+ for _ , mod in ipairs (item .enchantModLines ) do
2542+ if mod .line :match (" Allocates .*" ) then
2543+ table.insert (temp , mod )
2544+ end
2545+ end
2546+ item .enchantModLines = temp
2547+
25312548 if # newEnchant > 0 then
25322549 table.sort (newEnchant , function (a , b )
25332550 return a .order < b .order
@@ -2553,7 +2570,7 @@ function ItemsTabClass:CorruptDisplayItem() -- todo implement vaal orb new outco
25532570 end
25542571 end
25552572 local function rebuildEnchantControls (resetSelection )
2556- for i = 1 , 8 do
2573+ for i = 1 , enchantNum do
25572574 local shown = i <= enchantNum
25582575 controls [" enchant" .. i ].shown = shown
25592576 controls [" enchant" .. i .. " Label" ].shown = shown
@@ -2571,7 +2588,7 @@ function ItemsTabClass:CorruptDisplayItem() -- todo implement vaal orb new outco
25712588 end
25722589 end
25732590 end
2574- local function corruptItem ()
2591+ local function corruptItem (enchanting )
25752592 local item = new (" Item" , self .displayItem :BuildRaw ())
25762593 item .id = self .displayItem .id
25772594 item .corrupted = true
@@ -2582,14 +2599,20 @@ function ItemsTabClass:CorruptDisplayItem() -- todo implement vaal orb new outco
25822599 t_insert (mods , control .list [control .selIndex ].mod )
25832600 end
25842601 end
2585- applyCorruptionMods (item , mods )
2586- for i , modLine in ipairs (item .explicitModLines ) do
2587- if corruptedRanges [i ] ~= 1 then modLine .corruptedRange = corruptedRanges [i ] end
2602+ -- avoid removing corruption mods or rolls so that the user can make a
2603+ -- vaal rolled item with enchants
2604+ if enchanting then
2605+ applyCorruptionMods (item , mods )
2606+
2607+ else
2608+ for i , modLine in ipairs (item .explicitModLines ) do
2609+ if corruptedRanges [i ] ~= 1 then modLine .corruptedRange = corruptedRanges [i ] end
2610+ end
25882611 end
25892612 item :BuildAndParseRaw ()
25902613 return item
25912614 end
2592- if self .displayItem .rarity == " UNIQUE" then
2615+ if self .displayItem .rarity == " UNIQUE" or self . displayItem . rarity == " RELIC " then
25932616 local item = new (" Item" , self .displayItem :BuildRaw ())
25942617 local offset = 20
25952618 for i , mod in ipairs (item .explicitModLines ) do
@@ -2660,10 +2683,10 @@ function ItemsTabClass:CorruptDisplayItem() -- todo implement vaal orb new outco
26602683 controls .save .y = 73 + 20 * enchantNum
26612684 end )
26622685 controls .enchants .shown = function ()
2663- return self .displayItem .rarity == " UNIQUE"
2686+ return self .displayItem .rarity == " UNIQUE" or self . displayItem . rarity == " RELIC "
26642687 end
26652688 controls .rolls = new (" ButtonControl" , {" LEFT" , controls .enchants , " RIGHT" }, {5 , 0 , 80 , 20 }, " Roll Ranges" , function ()
2666- for i = 1 , 8 do
2689+ for i = 1 , enchantNum do
26672690 controls [" enchant" .. i ].shown = false
26682691 controls [" enchant" .. i .. " Label" ].shown = false
26692692 end
@@ -2681,7 +2704,7 @@ function ItemsTabClass:CorruptDisplayItem() -- todo implement vaal orb new outco
26812704 controls .save .y = 25 + explicitOffset
26822705 end )
26832706 controls .rolls .shown = function ()
2684- return self .displayItem .rarity == " UNIQUE"
2707+ return self .displayItem .rarity == " UNIQUE" or self . displayItem . rarity == " RELIC "
26852708 end
26862709 controls .sourceLabel = new (" LabelControl" , {" TOPRIGHT" ,nil ," TOPLEFT" }, {95 , 30 , 0 , 16 }, " ^7Source:" )
26872710 controls .source = new (" DropDownControl" , {" TOPLEFT" ,nil ," TOPLEFT" }, {100 , 30 , 150 , 18 }, sourceList , function (index , value )
@@ -2696,7 +2719,6 @@ function ItemsTabClass:CorruptDisplayItem() -- todo implement vaal orb new outco
26962719 enchantNum = 2
26972720 end
26982721 end
2699-
27002722 if controls .sort then
27012723 sortEnchantList (controls .sort .list [controls .sort .selIndex ].stat )
27022724 end
@@ -2710,7 +2732,7 @@ function ItemsTabClass:CorruptDisplayItem() -- todo implement vaal orb new outco
27102732 sortEnchantList (value .stat )
27112733 rebuildEnchantControls ()
27122734 end )
2713- for i = 1 , 8 do
2735+ for i = 1 , enchantNum do
27142736 if i == 1 then
27152737 controls .enchant1Label = new (" LabelControl" , {" TOPRIGHT" ,nil ," TOPLEFT" }, {95 , 55 , 0 , 16 }, function ()
27162738 if enchantNum == 1 then -- update label so 1 doesn't appear in case of 1 enchant.
@@ -2737,12 +2759,12 @@ function ItemsTabClass:CorruptDisplayItem() -- todo implement vaal orb new outco
27372759 end
27382760 rebuildEnchantControls ()
27392761 controls .save = new (" ButtonControl" , nil , {- 45 , 69 + enchantNum * 20 , 80 , 20 }, " Corrupted" , function ()
2740- self :SetDisplayItem (corruptItem ())
2762+ self :SetDisplayItem (corruptItem (controls . enchant1 . shown ))
27412763 main :ClosePopup ()
27422764 end )
27432765 controls .save .tooltipFunc = function (tooltip )
27442766 tooltip :Clear ()
2745- self :AddItemTooltip (tooltip , corruptItem (), nil , true )
2767+ self :AddItemTooltip (tooltip , corruptItem (controls . enchant1 . shown ), nil , true )
27462768 end
27472769 controls .close = new (" ButtonControl" , nil , {45 , 69 + enchantNum * 20 , 80 , 20 }, " Cancel" , function ()
27482770 main :ClosePopup ()
0 commit comments